xxQUAKExx Posted February 20, 2020 Share Posted February 20, 2020 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);; } } } Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted February 20, 2020 Share Posted February 20, 2020 (edited) Your countdown is continuing into the negatives because you never reset the giRounds variable to 0 when the game ends. Edit: and it jumps from 10 to -1 because on the touch event, you set the hovertext to giCountDowntime, which is always 10, but then when the timer event fires, the text is set to (giCountDowntime - giRounds) which at that point is (10-11) or -1 Edited February 20, 2020 by Fenix Eldritch Link to comment Share on other sites More sharing options...
xxQUAKExx Posted February 20, 2020 Author Share Posted February 20, 2020 Thanks for your reply! It is beyond my scope of fully understanding. I do thank you for your time Link to comment Share on other sites More sharing options...
Fenix Eldritch Posted February 20, 2020 Share Posted February 20, 2020 If you're new to LSL scripting (or programming in general), it would be a good idea to brush up on the basics. I recommend taking an afternoon and going through some tutorials. The LSL 101 wikibook might be a good place to start. It will introduce you to all the basics. 1 Link to comment Share on other sites More sharing options...
Scaler Rexen Posted February 20, 2020 Share Posted February 20, 2020 It's risky to copy and paste code dealing with L$ if you do not understand how it functions as it could lead to you losing all of your L$ on your account. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now