"Menus" and Why I Don't Understand Them Now
Weezil_Of_Mods
26 Jul 2013, 21:35Back when I used version 4, and version 5 was still in beta, this was never an issue. But, after maybe a 10 month or so hiatus from this program, and after upgrading to Quest 5, I am lost. Before, adding a menu was like adding in a timer or a custom command. But now, I can't seem to find a way to add one. I tried searching back through about 8-9 topic pages, and found one topic about menus, although that was about how there wasn't an apparent way to not allow a menu to be skipped. However, the creation of the menu itself, i'm not certain about.
Now, I'm not sure if I'm referring to a list or a menu here, because I don't remember what it was called in version 4, and I know that the two are worlds apart. But what I'm referring to is for a window to be presented, with a list of clickable options, which upon clicking would print a message or run a script. Any help at all would be much appreciated.
Now, I'm not sure if I'm referring to a list or a menu here, because I don't remember what it was called in version 4, and I know that the two are worlds apart. But what I'm referring to is for a window to be presented, with a list of clickable options, which upon clicking would print a message or run a script. Any help at all would be much appreciated.

jaynabonne
26 Jul 2013, 21:46Here is a simple sample that puts up a menu using the "menu in a window" as opposed to the new inline menus.
The key parts are the options list and the call to "show menu". If you want the new menu style, you would use ShowMenu instead. You don't have to hard-code the options; that's just there to make it easier to see. If you wanted variable options, you'd have to write script to create a string list or dictionary and populate it.
The key parts are the options list and the call to "show menu". If you want the new menu style, you would use ShowMenu instead. You don't have to hard-code the options; that's just there to make it easier to see. If you wanted variable options, you'd have to write script to create a string list or dictionary and populate it.
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="MenuTest">
<gameid>70a12c2e-e157-4363-9c53-f76976adf16a</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<options type="stringlist">
<value>Option 1</value>
<value>Option 2</value>
<value>Option 3</value>
</options>
</game>
<object name="room">
<inherit name="editor_room" />
<firstenter type="script">
show menu("Caption", game.options, true) {
msg("result = " + result)
}
</firstenter>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>
HegemonKhan
27 Jul 2013, 05:18weezel wrote:But what I'm referring to is for a window to be presented, with a list of clickable options, which upon clicking would print a message or run a script. Any help at all would be much appreciated.
To make a MENU:
in the GUI~Editor:
Add a~new script -> Output -> show menu ->
show menu:
-> your question or whatever
-> your list of options~choices~selections*
-> can they cancel out of the menu?: true or false
In Code:
(old way) http://quest5.net/wiki/Show_menu
(new way, Jayne explains it above, as I still haven't worked with this in-line stuff yet) http://quest5.net/wiki/ShowMenu
*making a LIST:
the quick way (though, I think it is temporary, if you want your list to be permanent, then you'll have to make a permanent list): http://quest5.net/wiki/Split
the normal (longer way):
http://quest5.net/wiki/Using_Lists
http://quest5.net/wiki/NewStringList
http://quest5.net/wiki/List_add
http://quest5.net/wiki/ListCombine
http://quest5.net/wiki/List_remove
etc etc etc list stuff
Also, "switch" will likely be useful too:
http://quest5.net/wiki/Switch
so for example, in code:
show menu ("your_question", your_list, true_or_false) {
your_label = result // quest will recognize "result" as the list choice that you've selected, so for this example, quest engine will recognize "result" as being your selection of "princess" (see below)
// whatever script using "result" (or the label that you set "result" to it), such as: msg ("the princess is very beautiful, so your mission is to rescue her, duh!") // however, this is missing the script that comes before the message (msg) script. see far below for an example in full.
}
the "split" way (temporary~local list):
<verb name="chat">
show menu ("What do you want to know about?", split ("king;sword;dragon;princess",";"), false) {
topic_choice = result
switch (topic_choice) {
case ("king") {
msg ("he's the king, you better rescue the princess, or you'll be executed.")
}
case ("sword") {
msg ("you'll need the legendary dragon slayer sword to kill the evil dragon.")
}
case ("dragon") {
msg ("The evil dragon has stolen the princess, the king has ordered you to rescue her from the beast.")
}
case ("princess") {
msg ("the princess is very beautiful, so your mission is to rescue her, duh!")
}
}
}
</verb>
the "normal" way (permanent~global list):
<global_events_object type="object">
<inherit name="editor_object" />
<topic_list type="simplestringlist">king</topic_list>
</global_events_object>
<verb name="chat">
firsttime {
game.topic_list = NewStringList ()
list add (global_events_object.topic_list, "sword")
list add (global_events_object.topic_list, "dragon")
list add (global_events_object.topic_list, "princess")
on ready {
show menu ("What do you want to know about?", global_events_object.topic_list, false) {
topic_choice = result
switch (topic_choice) {
case ("king") {
msg ("he's the king, you better rescue the princess, or you'll be executed.")
}
case ("sword") {
msg ("you'll need the legendary dragon slayer sword to kill the evil dragon.")
}
case ("dragon") {
msg ("The evil dragon has stolen the princess, the king has ordered you to rescue her from the beast.")
}
case ("princess") {
msg ("the princess is very beautiful, so your mission is to rescue her, so you can marry her, duh! And less importantly, if you don't, your life will be over, anyways.")
}
}
}
}
} otherwise {
show menu ("What do you want to know about?", split ("king;sword;dragon;princess",";"), false) {
topic_choice = result
switch (topic_choice) {
case ("king") {
msg ("he's the king, you better rescue the princess, or you'll be executed.")
}
case ("sword") {
msg ("you'll need the legendary dragon slayer sword to kill the evil dragon.")
}
case ("dragon") {
msg ("The evil dragon has stolen the princess, the king has ordered you to rescue her from the beast.")
}
case ("princess") {
msg ("the princess is very beautiful, so your mission is to rescue her, duh!")
}
}
}
}
</chat>
Weezil_Of_Mods
28 Jul 2013, 22:44Thanks everyone for the help, I do appreciate it. Now I'm fairly certain I have a good grasp of this program.