Jump to content

Using a Menu to Manipulate a Prim


Kia Sierota
 Share

You are about to reply to a thread that has been inactive for 4400 days.

Please take a moment to consider if this thread is worth bumping.

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?

Link to comment
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.

 

 

 

Link to comment
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.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4400 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...