00:00
00:00
Newgrounds Background Image Theme

Patrick8008 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Lists and combo boxes

444 Views | 2 Replies

Lists and combo boxes 2010-12-10 03:30:24


Ok, I'm trying to make a type of RPG layout. What I got is a list/combo box with a few attacks in them. I want to be able to select an item from the list/box and have it execute the command, like if I select "fire ball" I chuck a "fire ball" or if I select "fire rain" and attack all enemies with "fire". I only got commands like, "when box is selected" or "when it scrolls" to execute a command.

What do I do?

Response to Lists and combo boxes 2010-12-10 11:01:41


Maybe have a button beside the dropdown too.

And then have a command that is - when button is clicked (AND) compare 'dropdown' string to ["attack"], Then Player Launches Fireball.

I haven't played with dropdowns yet so I'm not familiar with their breadth of commands... if its limited you'll probably need to have them affect some other sort of variable in order direct your actions.


Self-published fiction: Mostly Lies

Response to Lists and combo boxes 2010-12-10 12:34:55


This is something that a lot of people encounter for the first time with the Windows controls like the list box ;)

What you need to do here is to check the selected value of the dropdown list to something else - and as the list itself doesn't provide an action for that like Active Objects do, you have to use the "Compare two general values" action of the Special object, as Zerok implied.

Instead of looking for an action in the dropdown list, right-click the first object in the list of objects when you're setting up a new event (it looks like two monitors) and select "Compare two general values". You'll get a new dialog box with two fields - for the first, click the "Retrieve data from an object" button and then find the expression that gets the selected value of the dropdown list (this time, it'll be in the dropdown list object itself). Then enter the string you want to compare to, such as "Attack", on the bottom half of the compare dialog.

You'll need to insert a second condition to the same event (right-click on the event and select "Insert") to also check for the button being clicked.