Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Timeout!

Ephraim Kappler
Reprobate
Join date: 9 Jul 2007
Posts: 1,946
07-05-2009 05:12
So I was having trouble getting llSetTimerEvent to work in this scrap of boolean tomfoolery and I hit on llSleep:

CODE

Slide()
{
if(!isOpen)
{
llSetPos(llGetPos() + delta);
llSleep(TimeInterval);
{
llSetPos(llGetPos() - delta);
}
}
}


Yes? No?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
07-05-2009 06:24
From: Ephraim Kappler
Yes? No?
Why not? What was the question again?
_____________________
From Studio Dora
Ephraim Kappler
Reprobate
Join date: 9 Jul 2007
Posts: 1,946
07-05-2009 07:26
From: Dora Gustafson
Why not? What was the question again?

Perhaps I'm overly cautious but I like to get a second opinion since I'm never quite sure what I'm doing with a script. In this case, llSetTimerEvent seems to have been created for just this purpose so I wanted to be sure I'm not doing something the system might regret someway down the line.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
07-05-2009 07:48
The timer is event based. As that the timer event handler will be called each time the set time has elapsed. In between other events can be handled by the script.
Apposed to that llSleep() holds the script for the specified time and the script will not do anything until the set time is over.
Only you will know what you want from the script and only you can decide what will suit your purpose best.
_____________________
From Studio Dora
Ephraim Kappler
Reprobate
Join date: 9 Jul 2007
Posts: 1,946
07-05-2009 09:32
From: Dora Gustafson
Only you will know what you want from the script and only you can decide what will suit your purpose best.

Thanks for the layman's explanation, Dora. In this case it's just about holding a door open so I can shift my pixel ass through. I guess it's ok then.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-05-2009 12:46
one thing to note... sleep has historically been a little less reliable for timing. it never under sleeps, but can frequently oversleep (especially at small intervals). so it's something to be aware of when using it.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Ephraim Kappler
Reprobate
Join date: 9 Jul 2007
Posts: 1,946
07-05-2009 22:47
From: Void Singer
one thing to note... sleep has historically been a little less reliable for timing. it never under sleeps, but can frequently oversleep (especially at small intervals). so it's something to be aware of when using it.

Thanks for that, Void. In this case I won't worry even if it lags for a few seconds so long as the door closes eventually and provided I am not being chased indoors by a pack of wolves, of course - the last thing I need is to be locked indoors with a hungry horde.

I guess it's certainly something to watch for if the question of timing is sensitive.

Living with the script for a few days, the only thing that concerns me is I think the touch_end event will need to sleep also: I'm in the habit of touching to close so with this new version I keep setting off an it's-closed-no-it's-open-again-no-it's-ok-it's-closed-or-is-it-? kind of situation.
Ee Maculate
Owner of Fourmile Castle
Join date: 11 Jan 2007
Posts: 919
07-06-2009 01:12
From: Void Singer
one thing to note... sleep has historically been a little less reliable for timing. it never under sleeps, but can frequently oversleep (especially at small intervals). so it's something to be aware of when using it.


Sounds like me in the mornings! :p