tutorial for creating 'Show menu' in browser version?

Hi,

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.

A little ShowMenu help:

image


The first line is the message that will print (or the question you will ask):
image


The second bit is the list Quest will use for the choices.

image


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.

  1. 1
  2. 2

The next part is where you decide if the player can ignore the menu:
image


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:

image


Whatever the player clicks can be referred to as result.

So...

Lets use a switch script here, because that's what Pixie prefers:

image


Put result in the first field, because that's what we're 'switching'.
image


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 "":

image


image


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:

image


Then put this:

"You chose: " + result + "."

Like so:
image


Now, add your other cases, and you're good to go:

image


Here's the whole thing:

image


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'.


I 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.")
      }
    }
  }
}

Thanks as always!


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

Support

Forums