Difference between revisions of "User:Toady Nakamura/Count down Timer"

From Second Life Wiki
Jump to navigation Jump to search
(add script etc.)
 
m (Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura)
 
Line 39: Line 39:


</source>
</source>
Visit my LSL wiki page for my library of simple scripts !  [[User:Toady Nakamura|Toady Nakamura]]

Latest revision as of 14:32, 11 January 2016

  • Put this script in a prim.
  • Set the countdown time in the Global variables, and touch prim to start.


// global variables can be used by all states & events in a script.
integer CountDownTime = 10;
float CountDownIncrements = 1;
integer StartTime;
integer Rounds;

// Script starts here .... 
default 
{
    touch_start(integer numbb)
    {
        llSay(0, (string)CountDownTime + " ...");
        llSetTimerEvent(CountDownIncrements);
        StartTime = llGetUnixTime(); 
    }
    
    timer() 
    {
        if (llGetUnixTime() >= StartTime +CountDownTime)
        {
            llSay(0, "Boom!");
            llSetTimerEvent(0);
        } 
        
        else 
        {
            Rounds++;
            llSay(0, (string)(CountDownTime -  Rounds) + " ...");
        }
    }
}

Visit my LSL wiki page for my library of simple scripts ! Toady Nakamura