Hello and thanks for your time,
I have been following along clipping and cutting parts of scripts and pasting them in, what might turn out to be a decent turnout.
With that said I have an issue with an pay script that pays person when touched. I pasted into it a countdown timer to pay after time reaches 0 and it does just that! it works in that sense. My problem now is that after it pays out i want it to become functional again for another person to touch it. My problem is after it is touched once the counter counts ... 10, -01, -02, -03, ect.
i had placed a call to reset the script but it then asks me for debt permission.
Any ideas would be helpful,
integer giCountDownTime = 10;
float gfCountDownIncrements = 1;
integer giStartTime;
integer giRounds;
integer limit = 4; //in meters
key id;
integer amount = 1; // amount to give
default
{
on_rez( integer param )
{
llResetScript();
}
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
touch_start(integer total_number) {
id = llDetectedKey(0);
integer number = 0;
vector mypos = llGetPos();
vector yourpos = llList2Vector(llGetObjectDetails(llDetectedKey(0), [OBJECT_POS]), 0);
if (llVecDist(mypos,yourpos)>(float)limit)
{
//avatar is too far away
llInstantMessage(llDetectedKey(0), "You are too far away. Move closer and touch again.");
} else {
llSetText((string)giCountDownTime + " ...", <1.0, 1.0, 1.0>, 1.0);
llSetTimerEvent(gfCountDownIncrements);
giStartTime = llGetUnixTime();
}}
timer() {
if (llGetUnixTime() >= giStartTime +giCountDownTime) {
llGiveMoney(id, amount);
llSetTimerEvent(0);
llSleep(1.0);
// llDie(); might go here //
} else {
giRounds++;
llSetText((string)(giCountDownTime - giRounds) + " ...", <1.0, 1.0, 1.0>, 1.0);;
}
}
}