Jump to content

Hovertext Countdown


haruspero
 Share

You are about to reply to a thread that has been inactive for 1517 days.

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

Recommended Posts

I am attempting to make an overhead timer on an object. It's supposed to work in that as soon as the object is rezzed, the timer will show how many seconds until the object is deleted. I've been able to get it to say the seconds in the chat, but I want it to show as hovertext. Is this possible?

Link to comment
Share on other sites

Rez a prim, put this script in, and touch it :)

integer counter;

default
{
    touch_start(integer total_number)
    {
        counter = 10; // chosen amount of living time in seconds
        llSetTimerEvent(1.0);  // setting timer to the interval of a second
    }
    
    timer()
    {
        --counter; // counter preceded by 2x minus dashes
        llSetLinkPrimitiveParamsFast(0, [PRIM_TEXT, (string)counter + " sec", <1.0,1.0,1.0>, 1.0]); 
        {
            llOwnerSay("KABOOOOUMMMMMmmmm.....");
            llDie();
        }
    }
}
 

Edited by Badena
Link to comment
Share on other sites

  • 3 weeks later...

integer counter = 10;  // chosen amount of living time in seconds.
float CountDownSpeed = 1.0; // how fast to count down.
DoText(string output)
{
    llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXT, output, <1.0,1.0,1.0>, 1.0]); // set text based on output
}
DoPayload()
{
    llSleep(CountDownSpeed); // lol lazy sleep to keep the timing correct after it reaches zero
    DoText("KABOOM!!!!! lolzolz"); // send payload text to output.
    llResetScript(); //doing this instead of llDie for testing. lol
    //llDie();   
}
default
{
    state_entry() //Can remove state entry if not using llResetScript, just here for example.
    {
        llSleep(CountDownSpeed); // lol lazy sleep
        DoText(""); // blank out text   
    }
    touch_start(integer total_number)
    {
        llSetTimerEvent(CountDownSpeed);  // setting timer to the interval of a second
    }
    timer()
    {
        DoText((string)counter-- + " seconds"); // send count text to output.
    if(counter < 0)
    {
        DoPayload(); // do payload.
    }
    }
}

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1517 days.

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
 Share

×
×
  • Create New...