SeeAirAhh Josephina Posted February 24, 2021 Share Posted February 24, 2021 I bet this is going to be something simple but I can't figure out what I'm doing wrong, thanks in advance for any help. default { state_entry() { count=0; llSetTimerEvent(1.0); } on_rez(integer num) { llResetScript(); } timer() { llSetText("Countdown in: "+(string)(120-count)+"s\n \n \n ",<1,1,1>,1.0); count++; if (count>120) //do something } } Link to comment Share on other sites More sharing options...
Mollymews Posted February 24, 2021 Share Posted February 24, 2021 count needs to be a global integer variable integer count; Link to comment Share on other sites More sharing options...
SeeAirAhh Josephina Posted February 24, 2021 Author Share Posted February 24, 2021 Like this? It's still giving me an error integer count; default { state_entry() { count=0; llSetTimerEvent(1.0); } on_rez(integer num) { llResetScript(); } timer() { llSetText("Countdown in: "+(string)(120-count)+"s\n \n \n ",<1,1,1>,1.0); count++; if (count>120) //do something } } Link to comment Share on other sites More sharing options...
Rolig Loon Posted February 24, 2021 Share Posted February 24, 2021 That's the idea. You haven't included code to fill in what happens when you //do something so that's probably why you're getting an error after the if statement. Aside from that, you need to provide code to stop thee time when it reaches 120 seconds and the let you restart the timer (preferably without needing the reset the entire script). Link to comment Share on other sites More sharing options...
Bugs Larnia Posted February 26, 2021 Share Posted February 26, 2021 I think@Rolig Loon is correct and the lack of actual action is the issue. Perhaps something like this? integer giCount; integer giStartCount = 120; ResetTimer() { giCount = giStartCount; llSetTimerEvent(1.0); } default { state_entry() { ResetTimer(); } touch_start(integer piNum) { ResetTimer(); } on_rez(integer num) { llResetScript(); } timer() { llSetText("Countdown in: "+ (string)giCount + "s\n \n \n ", <1.0, 1.0, 1.0>, 1.0); --giCount; if (giCount == 0) { //Do something llSetTimerEvent(0.0); } } } 1 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