Which scripts to use?

I'm new to Quest. (I'm more familiar with Inform, but I'm impressed with Quest's visual capabilities, so I wanted to try it.)

I like the opening of "First Times" by Hero Robb (here on textadventures.co.uk) and how it requires the player to enter a specific command to begin the game. How did Robb use the scripts to achieve this?

Aside from that, I'd also like to know how to ask a yes or no question that can start the game or end it. I am building a horror game and would like to include a 'would you like to proceed' type of message before play.

Lastly, is it possible to put the game's big title back after I run a script to clear the screen?

Thanks :)


I know in my game I stick them in a room with no exits. But any command will teleport them out.

This is how I start my game, in full. First, I ask what the player's name is. The game asks if an unexpected command was registered. If there was one, it moves the player. If the command/input was reasonable/what was expected, it asks another question.
http://textadventures.co.uk/forum/samples/topic/dzenkpsg8k6elyk12bdvpq/how-to-get-the-name-gender-and-pronouns-of-the-player-rpg-style

And about an input for the message...
(ON SECOND THOUGHT, use mrangel's version! ...unless you prefer this option.)

msg ("Do you want to proceed? ")
get input {
  if (result = "yes") {
    MoveObject (player, room)
  }
  if (result = "no") {
    finish
  }
}

Thank you @jmnevil54! This looks great.


I suppose my last question is my only question remaining - I'll make a new thread/post out of that though!


it requires the player to enter a specific command to begin the game.

I've not tried the game in question, but I know a few games that start with the player asleep and require a command like "open eyes" or "wake up" before you can do anything.
The easiest way to do something like that is to put some commands in the room with the player. If the player's input matches both a command in the room, and a global command, the one in the room will be used.

First command, name asleep, pattern #text# (or . if you're using regular expressions), script:

msg ("You can't do that while you're asleep.")

That pattern will match anything the player types, so the command script will be run any time they type anything.

Then the second command. Name wake, pattern wake up;wake;awake, script:

msg ("You open your eyes.")
ShowRoomDescription()
RemoveObject (asleep)

This removes the restriction on what the player can enter.


An alternative is for the start script or the first room's "enter" script to present the player with a menu. If the menu doesn't allow the player to cancel it, then they can't enter commands until it is dealt with. This option is more often used with RPG type games that have some kind of character creation, games that ask you to select a difficulty level, or similar.


Aside from that, I'd also like to know how to ask a yes or no question that can start the game or end it.

jmnevil's solution works if you want to require the player to type "yes" or "no". Note that as given, nothing will happen if the player types something else (like "y", or "YES").

If you want to use something like this, I'd strongly suggest handling the default case. If this is in the "on first enter" script for the starting room, you might want to do something like:

msg ("Do you want to proceed? ")
get input {
  switch (LCase (result)) {
    case ("yes", "y") {
      MoveObject (player, room)
    }
    case ("no", "n") {
      finish
    }
    default {
      msg ("Please type 'yes' or 'no'.")
      do (starting room, "firstenter")
    }
  }
}

This version:

  • uses LCase to convert "Yes" or "YES" to "yes", in case the player has caps lock on or something
  • uses switch rather than if, so that "yes" and "y" are understood as the same thing (you can list as many variants as you want)
  • runs a default section if the player types something unexpected
    • The do (starting room, "firstenter") line runs the on-first-enter script of the room named starting room; asking the question again.

Aside from that, I'd also like to know how to ask a yes or no question that can start the game or end it.

However, the more user-friendly way to ask a yes or no question is:

Ask ("Do you want to proceed?") {
  if (result) {
    MoveObject (player, room)
  }
  else {
    finish
  }
}

This uses Ask, which displays "yes" and "no" buttons on the screen.


Also note that it's not necessary to put the player in a separate starting room (though some people prefer to). You can also turn off showing the room description for the starting room; if a script shows a menu, this means that the player won't see the starting room immediately. Then instead of moving them to another room, the 'yes' option can just do ShowRoomDescription().


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

Support

Forums