Jump to content
Sign in to follow this  
Kia Sierota

Using a Menu to Manipulate a Prim

Recommended Posts

I'm a beginner scripter wanting to know how to use a menu(which I know the basics of it) and have it interact with an object in a way it changes form.

A friend inspried me to learn how to make a food-eating prim where you choose a food item from the menu and the sphere grows bigger until it inflates from all the size. How do I connect the scripts to end up doing similar?

Share this post


Link to post
Share on other sites

I am not sure what you mean by "you choose a food item from the menu and the sphere grows bigger until it inflates from all the size".  Please clarify this with more detail on what you are trying to accomplish.

Share this post


Link to post
Share on other sites

When you make an LSL llDialog() call you specify a list of strings which would be displayed on the buttons. You also specify a channel on which the server will send you a response when a button is clicked. You must listen on this channel, otherwise you would not hear responses. So llDialog() call and llListen() call must come together, one after another and have the same channel. It does not matter which one is the first and which one is the second, but there must be both of them.

You must also have a listen event via which you would get responses. In the listen event you make what programmers call  "switch". In some programming languages there is a specific syntax for that but not in LSL. An LSL a switch is just a bunch if else if's So it will look like this:

       listen(integer chan, string name, key id, string mes)
       {
         if(mes == text1)                          //whatever text you put on the first menu button
          UserFunction1();
        else if(mes == text2)                 //whatever you put on second menu button
          UserFunction2();
        else if(mes == text3)                //whatever you put on third menu button
          UserFunction3();                   
        else if...                                       //and so on as many else if's as you put button in the menu   
      }
         

In user functions you put whatever processing code you need. for instance UserFunction1() may include code to change prim size, UserFunction2() may have code to change prim color, etc.

You may code these User Functions, either separately above default state, or in-line within the listen event itself.

 

 

 

Share this post


Link to post
Share on other sites

One fine example of a menu system that manipulates prim's with sizing and changing shape etc is "Pipemaker".  It's a Freebie, opensource & full perm which you should be able to locate with a quick search in-world.   PipeMaker made by Lex Neva who has/had a store in Eldora.

Hopefully that will give you a good example template to see how it's done.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...