Jump to content

Demo Script


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

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

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

  • 10 years later...
6 hours ago, Tinkarbell said:

Reviving an old thread I know. 

Could I use on_attach instead of on_rez to use this for clothing demos?

According to the wiki, yes. It's arguably better, too, though there are more cases you need to test for to make sure you don't count them if you don't need to. (P.S. It's "attach", not "on_attach".)

on_rez() triggers when the object goes from "not existing in world" to "existing in world". That means:

  • dragging into the world from inventory
  • attaching from inventory
  • logging in with the object already attached

attach() triggers when the object becomes attached or detached. That means:

  • attaching from inventory, OR detaching into inventory
  • attached from existing on the ground, OR dropped directly from being worn
  • logging in with the object already attached

 

Edited by Quarrel Kukulcan
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1148 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...