Simple Radio Buttons

4
Your rating: None Average: 4 (2 votes)
Difficulty Level: 
Beginner
Topic: 
Other

Simple Radio Buttons
How to evaluate the current selected radio button option.

Add a simple common button object to your frame and change the type to "Radio Button"
radiobutton1.gif

Add 3 texts lines for our radio button options
radiobutton2.gif

Here we just have
Option 1
Option 2
Option 3

radiobutton3.gif

Then just add a simple string object and our frame should look like this
radiobutton4.gif

Now lets jump over to the event editor and make a series of events to do the following: Change the string object to tell us what radio button is currently selected.

Radio buttons start at 0 -- so that is something to keep in mind.

Event 1:
Conditions:
Start of Frame

Actions:
[Button] - Set Radio button - Select a radio button - {0}
[String] - Set Alterable text to - {""}

Event 2:
Conditions:
[Special] - Compare 2 general values - [Button] Value of set radio button = "0"

Actions:
[String] - Set Alterable text to - {"Option 1 selected"}

Event 3:
Conditions:
[Special] - Compare 2 general values - [Button] Value of set radio button = "1"

Actions:
[String] - Set Alterable text to - {"Option 2 selected"}

Event 4:
Conditions:
[Special] - Compare 2 general values - [Button] Value of set radio button = "2"

Actions:
[String] - Set Alterable text to - {"Option 3 selected"}

If this seems confusing try looking at this example file.
Download Example File

Comments

Game_Master's picture
3

Nice tutorial. I finally worked out how to do something with radio buttons....