end game by typing command? (Solved)

Hello,

Is it possible to 'answer' a character and then end the game.

Example: the quest is to solve puzzles in order to find out the name of a girl that is in a room. Everytime you talk to her, the only thing she asks is: whats my name.
When you finally figured out her name and return to the girl, is it possible to answer her question and then end the game when you have the right name?

The only way I can come up with this is using verb with the object (the girl) and then run a script. The only problem is that when using the verb, you have t type the name and then the objects name behind it.


'girl' Object's Verb:

msg ("What is my name?")
get input {
  if (result = "YOUR_NAME_OF_GIRL") {
    msg ("You guessed the name and won the game congradulations!")
    msg ("YOU WON THE GAME!")
    finish // this is the code command/function to end/stop/freeze the game
  } else {
    msg ("Wrong, now you die! muwahaha!")
    msg ("The girl is an evil witch and turns you into a frog, which she then stomps you with her boot, your guts flying out, and you're very dead.")
    msg ("GAME OVER")
    finish
  }
}

there's only two ways of getting typed-in input:

  1. the 'get input' Script/Function (see my post above)
  2. the 'Command' Element: http://docs.textadventures.co.uk/quest/elements/command.html

(Commands work anywhere if they're globally made: NOT put/wrote-coded in a room, else you made a local Command, aka put/wrote-coded it inside of a room, which only works for within that room)

an example:

<command name="end_game_command"> // or name the Command whatever you want, lol
  <pattern>endgame</pattern> // this is what you type (during game play) to activate this Command
  <script>
    msg ("You chose to end the game")
    msg ("GAME OVER")
    finish
  </script>
</command>

Hahaha Thanks. Also ending the game when you enter it wrong is awesome.


just an example, I like having fun, when I can with them. You may not want to end the game for a wrong answer.


if you want some ideas on some things that can be done, you can take a look here:

http://textadventures.co.uk/forum/samples/topic/4988/character-creation-crude-code-and-sample-game

(the code is horribly redudent and very bad/inefficient, my brain had stopped working when I was struggling with coding this stuff, as I can combine many of the Functions into a single Function, but it's still good for showing ideas on what you can do)


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

Support

Forums