tutorial for creating 'Show menu' in browser version?

NecroDeath
24 Sept 2017, 16:46Hi,
I'm struggling to work out how to make a 'show menu' in the browser version, can someone please point me to a tutorial or forum post (the info I can find in the tutorial is for off line version)?
Thanks!

K.V.
24 Sept 2017, 18:47A little ShowMenu help:
The first line is the message that will print (or the question you will ask):
The second bit is the list Quest will use for the choices.
In this field, if you want the choices to be 1 or 2, put this:
Split("1;2", ";")
That creates a list. The "1;2"
tells Quest what your ingredients are. The ";"
tells it where to split.
So this yields List: 1, 2
.
So, ShowMenu
would print:
Choose an option.
The next part is where you decide if the player can ignore the menu:
I put no, because I don't think NecroDeath wants the player to be able to ignore this particular menu.
Now for the script that runs:
Whatever the player clicks can be referred to as result
.
So...
Lets use a switch script here, because that's what Pixie prefers:
Put result
in the first field, because that's what we're 'switching'.
Then, create your cases.
In this instance, we are checking against text strings, so we will need to wrap whatever is entered as a case in quotation marks ""
:
Now, add the script you want to run for that selection:
If you want to print what the player selected, print a message, but change it to expression
:
Then put this:
"You chose: " + result + "."
Like so:
Now, add your other cases, and you're good to go:
Here's the whole thing:
NOTE: I didn't select a default script because the player has to select one of the options here. We put NO for 'Allow player to ignore menu'.
jmnevil54
24 Sept 2017, 18:59I copy paste everything.
Code view
msg ("See something that catches your eye?")
options = Split("Potion (100);Hyper Potion (200);Ammo (40)", ";")
ShowMenu ("Shop", options, true) {
switch (result) {
case ("Potion (100)") {
if (player.gold >= 100) {
player.gold = player.gold - 100
player.potion = player.potion + 1
msg ("You bought a Potion.")
}
else {
msg ("You don't have enough gold.")
}
}
case ("Hyper Potion (200)") {
if (player.gold >= 200) {
player.gold = player.gold - 200
player.hyper_potion = player.hyper_potion + 1
msg ("You bought a Hyper Potion.")
}
else {
msg ("You don't have enough gold.")
}
}
case ("Ammo (40)") {
if (player.gold >= 40) {
player.gold = player.gold - 40
player.ammo = player.ammo + 20
}
else {
msg ("You don't have enough gold.")
}
}
}
}
show menu
msg ("See something that catches your eye?")
options = Split("Potion (100);Hyper Potion (200);Ammo (40)", ";")
show menu ("Shop", options, true) {
switch (result) {
case ("Potion (100)") {
if (player.gold >= 100) {
player.gold = player.gold - 100
player.potion = player.potion + 1
msg ("You bought a Potion.")
}
else {
msg ("You don't have enough gold.")
}
}
case ("Hyper Potion (200)") {
if (player.gold >= 200) {
player.gold = player.gold - 200
player.hyper_potion = player.hyper_potion + 1
msg ("You bought a Hyper Potion.")
}
else {
msg ("You don't have enough gold.")
}
}
case ("Ammo (40)") {
if (player.gold >= 40) {
player.gold = player.gold - 40
player.ammo = player.ammo + 20
}
else {
msg ("You don't have enough gold.")
}
}
}
}

NecroDeath
24 Sept 2017, 19:35Thanks as always!