How to add player name in gamebook?

I'm very new to making text adventures and have no idea what I'm doing. Can someone help me? I can get the prompt to appear, but I can't put an input. Thank you in advance!


Hi!

I am new here as well, although I am practicing with both gamebook and textadventure variants for about a month now. I think you want something like this:

msg ("Enter your name:")
GetInput() {
  player.alias = result
  msg ("You are " + player.alias)
}

GetInput, ShowMenu and Ask all store the answer in a variable called result, which is available within the curly braces. Also be aware that control flow splits here, and only the block within the curly braces is waiting for player input, not the code after that. There are workarounds for that, but first get familiar with this stuff before you look into that.

When in a gamebook you need the page to be either script or script + text. If it is script only you need to set up the page links differently or move the player to a different page within the script.

In general, following the tutorial and trying to convert an existing gamebook (pdf) to Quest was a big help in learning this system. Just keep in mind that if you use existing gamebooks as template there is most likely a copyright, so you are not allowed to share your work on it. It is just for your personal training purposes. So just look through it and pick some pages that include some "mechanics" that need some work.


I'm trying to do something similar I think where I take player input to use it as the player character's name, but I get this error:

Failed to load game.
The following errors occurred:
Error: Error adding script attribute 'description' to element 'p2void': Function not found: 'GetInput'

GetInput seems to be a built-in function so I'm confused by this, do you have any idea what might be causing this? p2void is the room the name selection takes place in by the way.


GetInput is obsolete since Quest 5.4

It was replaced by the async get input. So the code would be:

msg ("Enter your name:")
get input {
  game.pov.alias = result
  msg ("You are {=game.pov.alias}.")
}

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

Support

Forums