Text Adventure/Gamebook : Quizzes

I'd like to find out how to create a situation where there's 3 or 4 link text available to choose from after a question, all of which lead to a different answer in the end. I'd also like some 'link text' answers to lead to unique questions. Any way I can try this?

I've heard it to be called a loop or something similar. Is it feasible to program into Text Adventure (or less feasibly Gamebook)?


This is the ShowMenu function. It prints choices and links. Please do not copy paste this code straight into code view. Copy this code by the regular way. Change the code.
(Typing something to edit)

msg ("See something that catches your eye?")
options = Split("Potion (100);Hyper Potion (200)", ";")
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.")
      }
    }
  }
}

Or you could do this.

get input {
  msg ("")
  player.answer = result
  if  () {
  }
}

Or something like that.

Also P.S., you CANNOT use ShowMenu in a gamebook, or at least you would have trouble using it. You need to have each room/page BE your answers/results, instead!


So, with game book, it would be:
Here is your Question A:
Answer 1: goto room A1
Answer 2: goto room A2
Answer 3: goto room A3

But, I'm not sure if several rooms can lead back to the same room to get Question B.


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

Support

Forums