deamonsun Fang
Registered User
Join date: 17 Oct 2009
Posts: 2
|
10-24-2009 13:45
How would I make an object wait before executing the next line in the script?
I'm new to scripting in general. I just want to make my object whisper to me when I touch it, then a few seconds later whisper something else to me without me touching it. (This is possible to do right?)
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
10-24-2009 14:23
Two ways ..... touch_start(integer num) { llWhisper(llGetOwner(),"Psst! I'm here!"); llSleep(5); //Shut down execution for 5 seconds llWhisper(llGetOwner(),"I'm still here...."); }
or .... touch_start(integer num) { llSetTimerEvent(5); llWhisper(llGetOwner(), "Psst! I'm here!"); }
timer() { llWhisper(llGetOwner(),""I'm still here ...."); llSetTimerEvent(0); //Shuts off the timer }
The difference between the two is that the first one shuts down the entire script for 5 seconds but the second is still awake so other events can still take place while the timer is ticking down. If you had a listen event in this script, for example, you could not receive a chat message during the 5 second llSleep period in the first example, but you could during the 5 second countdown in the second example.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-24-2009 14:40
For what it's worth, I would strongly advise against pausing the script unless you're really sure that you actually want to shut the script down, and have it remain shut down the next time the object is rezzed, should you take it back into your inventory while it's sleeping. My instinct is always use a timer for preference, because with llPause it's just too easy for stuff to go wrong.
Normally, I only sleep things for very short times, to make sure other scripts or related objects have had time to do stuff before something else happens.
|
deamonsun Fang
Registered User
Join date: 17 Oct 2009
Posts: 2
|
10-24-2009 21:24
Thank you so much.
|