Jump to content

Demo Script


Recommended Posts

I am working on a script that I can place inside an object that will delete the object after a specified period of time. I don't know too much about scripting, but was able to come up with this after looking around the lsl wiki.

 

default
{
    on_rez(integer start_param)
    {
        llSetTimerEvent(300);
        llOwnerSay("This is a demo, you have 5 minutes before it will automatically delete itself.");
    }
    
    timer()
    {
        llOwnerSay("Your trial has ended.");
        llDie();
    }
}

 

The above script works well, but I was wondering how I could make the script update the user on the amount of time left on the demo. For example, at the 4 minute mark, it will say, "You have 4 minutes remaining." And it would continue to do this every minute until the time is up. I would also like it to update at the 30 second, 10 second,  and 5 second marks. Would someone be able to help me accomplish this?

Thanks,

Lucky

 

Link to comment
Share on other sites

list gLstTime =["5 minutes", 60, "4 minutes", 60, "3 minutes", 60, "2 minutes", 60, "1 minutes", 30, "30 seconds", 20, "10 seconds", 5, "5 seconds", 5, "Times up", 0];integer gIntTrack = 1;//-- some codetimer(){    ++gIntTrack;    llOwnerSay( llList2String( gLstTime, gIntTrack ) );    ++gIntTrack;    llSetTimerEvent( llList2Float( gLstTime, gIntTrack ) );    if (llList2Integer( gLstTime, gIntTrack ) == 0){        llDie():    }}

this of course does not prevent anyone from resetting the script, removing it, or using it in a no script area, or attaching it to prevent it from dying.

Link to comment
Share on other sites

the supplied variables go in the top, the timer event replaces your owner timer event,

all that's left is to add the code to read the first list item and send it to the user as a message, and set the timer for the amount of time in the list at the index given in gIntTrack...... you can do that in the state entry, but really it should be done when the owner changes, or they'll miss the first message.

Link to comment
Share on other sites

Thank you Void. I have it up and running now. Works great! I like how the user is able to take the item back into their inventory, and then when they take it back out, it will continue counting down from where it left off. As for them using the demo in an area that doesnt allow running scripts, I plan on marking the item with demo textures and make it no mod/no copy/no transfer and maybe that will make it less appealing to keep the demo instead of buying the real thing. And as for the user wearing the item - I plan on using this script in houses (since I don't have land to display the houses in world), so I don't think the user will be wanting to wear the house.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...