Jump to content
You are about to reply to a thread that has been inactive for 74 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?

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

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.
    }
    }
}

Share this post


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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...