Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Run an inactive script from another script?

Psyfire Tigereye
Registered User
Join date: 25 Oct 2003
Posts: 4
02-27-2005 20:50
What I'd like to do would be to have multiple scripts in one prim, but only have a few of them runnin at a time. Actually, the object would create duplicates of itself on command (not freely, don't worry) and the object would have different modes.

For example, when the first object is created, it's in control mode. In control mode, you can command it to create duplicates of itself in other modes. When the duplicate loads, the only script running in it will activate the correct scripts for that mode.

The reason I want to do this is because in some modes, the object will be able to replicate itself in other modes.

Anyway, as far as I can tell the only way to do this requires llRemoteLoadScriptPin. Either have a controlling script load a copy of the script into the same prim, then delete the old one, or use a child prim which holds all the scripts, and then loads them into the parent prim on command.

Is there any better way?
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
02-28-2005 09:10
Try having your scripts that aren't running all the time have two states, "running" and "waiting" (the latter can be the default state). In the "waiting" state, it just waits for a link message from another script in the object that tells it to wake up and do its thing. At that point, it switches state to "running". When it finishes, it can go back to waiting if you'd like.
Psyfire Tigereye
Registered User
Join date: 25 Oct 2003
Posts: 4
02-28-2005 10:17
Okay, yeah, that's another possibility. Thank you. The only problem with that one is that there may be quite a few scripts, and each inactive one would proccess a link_message event every time a script sends a link message, and there are going to be a lot of those gong around in some modes. I'll probably just use the child prim method I mentioned.

Thank you for the idea though.
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
02-28-2005 14:03
Unless your scripts will all be very long you might consider using each script as a state in one main script (or a few main scripts if memory becomes a problem)
instead of scripta, scriptb scriptc
you could have
scripta containing default,statea,stateb,statec so that each script's function becomes a seperate state. This will lessen the ammount of scripts picking up link_messages (as you mentioned above) and you will use less scripts in total which is always(usually) a good thing :)
_____________________
"Bad News is - I cant script a thing....
Good News is - I buy less asprin than those who can :D"
-Rosa Gardner