Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Exiting a loop

ColdFire Bigwig
Anthro Techi Dragon
Join date: 11 Dec 2005
Posts: 93
01-17-2006 10:00
Anyone have a code snippit for exiting a do-while look when the opbect it touched? I can't find a way to check if the object is touched during the loop, so any help would be appriciated.


Thanks!!
Lit Noir
Arrant Knave
Join date: 3 Jan 2004
Posts: 260
01-17-2006 10:48
As I understand it, you can't. While still in the loop touches (or listens, or any other event) just get stacked in the event queue and starve to death.

There was a thread a few weeks ago on the subject if I recall, someone may have had a clever workaround that might satisfy your needs, depending.
ColdFire Bigwig
Anthro Techi Dragon
Join date: 11 Dec 2005
Posts: 93
01-17-2006 10:54
Well Drat =/

I wonder if I could run the loop once, check to see if it has been touched then run again if not.

I think they need to add a do {} while (!touched()) event handler that would make life easier.
Lit Noir
Arrant Knave
Join date: 3 Jan 2004
Posts: 260
01-17-2006 11:07
Depending on what is being looped, might be possible to encapsulate it in a function, have a timer call the function, and the timer will check to see if it has been tocuhed in the meantime. This should work fine for loops that have fixed time periods, but if not, then probably won't.
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
01-17-2006 11:08
Instead of running a while loop, you can run your code in the timer() event instead. Its not the fastest or most graceful, but it should work.

*edit Lit types faster then I do.
_____________________
Beatfox Xevious
is THOUSANDS OF PEOPLE
Join date: 1 Jun 2004
Posts: 879
01-17-2006 11:10
Would you mind explaining what it is you're trying to do? You may be able to achieve your goal by working with the event-driven nature of LSL, rather than against it.

Edit: And both Lit and Pete type faster than I do! :o
_____________________
My Beatworks: Zephyr Chimes wind chimes, the KanaMaster Japanese kana tutor, and the FREE Invisibility Prim Public. Look for them at the Luskwood General Store in Lusk (144, 165).

"You have been frozen. You cannot move or chat. A pony will contact you via instant message (IM)."
- mysterious system message I received after making off with Pony Linden
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-17-2006 11:31
There is a way out of loops:

http://secondlife.com/badgeo/wakka.php?wakka=jump

Not a good programming technique, but some times it is needed. :D