Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reset all Scripts on Attach

Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
07-29-2009 16:12
Hi all (again),

i have an multi-prim object with scripts scattered throughout and am looking for a way to reset all scripts in the prim on attach.

i do have some ideas.

1. on_rez reset in each script (P.I.T.A)

2. a move all the scripts to a single prim & somehow do it that way.


(yes this is related to my "Laser Tag" system)
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
07-29-2009 16:19
Do you use states in your scripts? if so you have to have the reset in each state on_rez since you may not know what state the script is in.
You could also use a master control script to reset all other scripts to be on the safe side.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
07-29-2009 16:21
From: Tabris Daxter
1. on_rez reset in each script (P.I.T.A)
Almost. Use the attach event.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
07-29-2009 17:38
From: Destiny Niles

You could also use a master control script to reset all other scripts to be on the safe side.


This is basically what i'm looking for.


From: someone
Almost. Use the attach event.

some of the scripts already have this in them but some don't.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
07-29-2009 18:20
Well, you can use llResetOtherScript(name); for scripts in the same prim. As for the rest in other prims, you will have to either add the aforementioned events, or have the scripts respond to some global linkmessage reset command (like llMessageLinked(LINK_SET,-1,"","";); for example).

Either way, there is no way for a script to forcibly reset another script that is in another prim, even in the same linkset. Also, other scripts that have "crashed" with run-time errors cannot be reset via LSL at all.
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
Thank You Thank You
07-29-2009 22:28
exactly what i was looking for. it solves the problem of not having to rewrite about 20 scripts (oh Dear God, took me long enough the first time)

and tidy's up the item putting all the scripts together.


TY

(now i just have to write it.)

Will post if it works.
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
Thank You Thank You
07-30-2009 03:22
exactly what i was looking for. it solves the problem of not having to rewrite about 20 scripts (oh Dear God, took me long enough the first time)

and tidy's up the item putting all the scripts together.


TY

(now i just have to write it.)

Will post if it works.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
07-30-2009 05:11
Why do you have 20 scripts in the object in the first place?
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Tabris Daxter
Snake oil Salesman
Join date: 22 Feb 2009
Posts: 61
07-30-2009 21:34
From: Argent Stonecutter
Why do you have 20 scripts in the object in the first place?

Short answer: Confusion. :P

Long Answer: some are particles (can't be moved) some are show/hide, & some are animation and i think some are turned off.
they are all distributed around the object in around 5 different prims.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-30-2009 22:09
From: Tabris Daxter
they are all distributed around the object in around 5 different prims.

In that case, you could also copy a simple script using llResetOtherScript() into each of those 5 prims. Of course that's just adding more scripts and complication, so it's not the best idea if you ARE willing to add a small snippet to each of those necessary scripts (using either 'on_rez', 'attach', or a link message).
Jack Abraham
Lantern By Day
Join date: 11 Apr 2008
Posts: 113
07-31-2009 18:19
Yeah, I encounter a similar situation... llLinkParticleSystem and llSetLinkPrimitiveParamsWithoutDelay (or llSetListOfPrimitivesParams) would cut the number of scripts in my creations by 50-75%.