Problem with get input function

Jonathan O
21 Oct 2020, 08:25

I'm trying to create a Help facility which the player can use at the cost of a few points. I want to give them the option to quit before using it, so have the following script (actual help facility redacted):

msg ("Each use of the Help facility will cost you 2 points. Do you want to continue? (Y/N)")
get input {
  game.ans = CapFirst(result)
}
if (game.ans = "N") {
  msg ("Help aborted.")
}
else {
  // actual help function goes here
}

However, instead of waiting for the player's input, the script just runs straight on to the Help facility code. What am I doing wrong?


Pertex
21 Oct 2020, 09:37

You must put all code in the "get input" brackets

msg ("Each use of the Help facility will cost you 2 points. Do you want to continue? (Y/N)")
get input {
  game.ans = CapFirst(result)
  if (game.ans = "N") {
    msg ("Help aborted.")
  }
  else {
    // actual help function goes here
  }
}

Jonathan O
21 Oct 2020, 12:31

Thanks, it works fine now.