Jump to content
You are about to reply to a thread that has been inactive for 75 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

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 post
Share on other sites

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 post
Share on other sites

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 post
Share on other sites

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);
        }        
    }
}

 

  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 75 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...