Jump to content


Photo

Drop Boxes


  • Please log in to reply
5 replies to this topic

#1 The Legend

The Legend

    Unashamed

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 30 March 2012 - 07:40 PM

How do I make drop boxes? I want to use them to avoid massive selection screens with customizable build features in my new project The Laboratory
EDIT: Not sure if "Drop Box" is what they are called. I think it might be "Menu Boxes"? Like when you right-click.

Edited by The Legend, 30 March 2012 - 07:56 PM.

  • 0

#2 Cpt Chuckles

Cpt Chuckles

    GMC Member

  • GMC Member
  • 312 posts
  • Version:GM8.1

Posted 30 March 2012 - 08:19 PM

did you even give it an attempt before asking for code?
  • 0

#3 The Legend

The Legend

    Unashamed

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 30 March 2012 - 08:21 PM

I know of no code for it to begin with. If I did I would've tried it before hand but I'm clueless.
  • 0

#4 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1411 posts
  • Version:GM:Studio

Posted 30 March 2012 - 08:46 PM

In the Global Right Mouse Button event, put
instance_create(mouse_x, mouse_y, obj_contextMenu)
The right click menu is actually called a Context Menu.
  • 0

#5 Desert Dog

Desert Dog

    GMC Member

  • Global Moderators
  • 6409 posts
  • Version:Unknown

Posted 30 March 2012 - 08:51 PM

show_menu(str,def)
Shows a popup menu. str indicates the menu text. This consists of the different menu items with a vertical bar between them. For example, str = 'menu0|menu1|menu2'. When the first item is selected a 0 is returned, etc. When the player selects no item, the default value def is returned.

show_menu_pos(x,y,str,def)
Shows a popup menu as in the previous function but at position x,y on the screen.


So you'd use it a bit like this:
var ii;
ii=show_menu("Buy Gun|Buy Knife|Buy flower",-1);

if (ii==0)
{
    show_message("You bought a gun");
}
else
if (ii==1)
{
    show_message("You bought a Knife");
}
else
if (ii==2)
{
    show_message("You bought a flower");
}
else
{
    show_message("You buy nothing?!");
}

show_menu_pos() is used similarly, only you can define where the popup menu will appear.

Edited by Desert Dog, 30 March 2012 - 08:51 PM.

  • 0

#6 The Legend

The Legend

    Unashamed

  • GMC Member
  • 1062 posts
  • Version:GM:Studio

Posted 30 March 2012 - 08:52 PM

Thanks!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users