Author Topic: Drop down menus.  (Read 728 times)

Have you ever seen those drop down menus in Blockland?  Like the one on the 'Start a Game' screen that lets you choose the number of players.  I'm making a gui that will require one of those.  I need to know how to make the drop down part work.  I have the menu, but how do I fill it with choices?  Thanks.

Name it then dump its functions.

I don't fully understand.  Could you give me an example?

Give it a name, and hit apply.
Open console, type in itsname.dump();
Find a function relevant for doing what you need.
Put it in the script.

I need to make it so that it will set a variable to different things depending on what the list is set to.
How would I do this?

Edit: Would I type add(name here)
« Last Edit: October 01, 2009, 07:50:31 PM by Gadgethm »

I need to make it so that it will set a variable to different things depending on what the list is set to.
How would I do this?

Edit: Would I type add(name here)
Sort of. You would do PopUpName.add("String to be displayed",IntegerID,optionalIntegerScheme);
The optionalIntegerScheme will default to zero if you don't specify it.
Then assign a variable to it in the editor and just call upon that variable to check its selection. The value will be its IntegerID, I believe.
You can also assign a function for its "Command" and that will be called everytime you change its value.

So I make a function that will excecute a command if the variable equals certain things, or can I do that directly?  If so, how?

And also, it's not .add()
That adds an object to an object's group.


My bad, its .addFront() with all the same arguments. Although .add() seemed to work, use .addFront().
You would assign a global variable to it, then check the variable. The value of the variable should be the value of the selections integerID. So, say you set the variable to $PopUpMenu. You could check it doing something like this:
Code: [Select]
function checkPopUp()
{
   switch($PopUpMenu)
   {
      case 0:
         //This is the "0" value within the menu
         //You can add functions within here
      case 1:
         //This is the "1" value within the menu
         //You can do the same in here
      case 2:
         //This is the "2" value within the menu
         //Same as before and you can do however many of these
   }
}


Or you can use it like this:
Code: [Select]
switch(%menu.getValue())
{
        case 0:
                "blah blah"
}

Trying...

Edit: It works!  Now, how would I get rid of one option?
« Last Edit: October 02, 2009, 08:31:41 PM by Gadgethm »

Trying...

Edit: It works!  Now, how would I get rid of one option?
I think its .remove(integerID);  but just dump its functions and look for some remove function.