Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Menu - Triggering scripts

Amaris Laval
Registered User
Join date: 20 Mar 2007
Posts: 9
08-04-2007 07:29
Okay. I am new to scripting and trying to come up with a way to do this:

I got an object with lets say 5 prims. It's linked. There are 4 scripts, some in the linked parts of the object meaning in the base prim is the script that is supposed to trigger script1, script2, script3 or script 4 which each is in another (linked) prim. (does it make any sense?)

Okay, so when I click the object I want a menu that gives me a choice on what script to activate (script1, script2, script3 or script4). How would I go about doing that?
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
08-04-2007 07:48
I'd use the llMessageLinked function in the root script, and use link_message events in the child scripts.

You could have the child scripts go into a standby state where the only event is the link_message event, and when they receive the correct info through there, they switch to the state where they do their actual work. That state would need a way to switch 'off' (i.e. change back to the standby state) so either another link message (if they are turned off manually) or a timer or something (if they turn off automatically.)

Either way though, I would think link messages are your best bet.

-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
Kidd Krasner
Registered User
Join date: 1 Jan 2007
Posts: 1,938
08-04-2007 07:52
I assume that by 'menu', you mean one of the blue boxes that appears in the upper right with a bunch of buttons. I've heard many people call these menus, but in lsl, they're dialogs, created (naturally) with the llDialog function. There are fancier ways of doing things, but this is a good way to start.

As for actually triggering the right script, the llMessageLinked function lets you specify which prim should receive the message. In theory, you could figure this out once and then hardwire the prim numbers, but that's fragile. Anything that relinks the prims could break it. What you could do instead is determine the numbers automatically whenever the script is reset. If the prims each have a different name, you could loop through them to find the number corresponding to each name. Or you could have each subsidiary script send a message to the root script identifying itself, which would provide the link number.
Amaris Laval
Registered User
Join date: 20 Mar 2007
Posts: 9
08-04-2007 08:00
Thank you. Am always glad to learn new stuff! Will try it out and see what I come up with :o)