Select script?

pugsmith
Essentially, I'm trying to make a thing where you can choose from a list of options. I've seen it done before.

I'm talking about this sort of thing:

There is a ghost. What do you do?
1. Fight
2. Run

Something like that. Is there a way I can put that in using scripts?

HegemonKhan
there's a built-in "show menu" function, but it causes a popup window of choices to select from:

run as script -> add a script -> output -> show menu

and you got to make a list (I don't know how to directly do it in the GUI~Editor, but here's a way of making a list:

run as script -> add a script -> variables -> set a variable or attribute -> game.your_list = split ("item1;item2;item3;etc", ";")

or, here's a design for exactly how it looks in your post:

run as script -> add a script -> output -> print a message -> [MESSAGE] -> There is a ghost. What do you do?
add a script -> variables -> set a variable or attribute -> x = 0
add a script -> ??? -> foreach -> (in code) foreach (item_x, game.my_list) { scripts: see below }
add a script -> variables -> set a variable or attribute -> x = x + 1
add a script -> output -> print a message -> [EXPRESSION] -> x + "." + item_x
add a script -> output -> print a message -> [MESSAGE] -> (leave blank)
add a script -> output -> print a message -> [MESSAGE] -> Type the number of your choice, please.
add a script -> output -> get input ->
-> add a script -> scripts -> switch -> result ->
->-> case (1) ->
->->-> // whatever script (add a script) you wanna do
->-> case (2) ->
->->-> // whatever script (add a script) you wanna do
->->// etc cases and their scripts

jaynabonne
Actually, "Show a menu" runs the inline menu. The popup menu is obsolete.

In script, you'd run it as:

      options = NewStringList()
list add (options, "Fight")
list add (options, "Run")
ShowMenu ("There is a ghost. What do you do?", options, false) {
if (result = "Fight") {
} else {
}
}

From the editor, it would look like this:

ShowMenu.png

pugsmith
Thank you to both of you! This is very helpful information. :)

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums