2012-10-12 177 views
8

Solo quiero pedirle al usuario una línea de texto en el medio de una acción. El efecto debería ser así:¿Cómo puedo leer una línea de entrada en Inform 7?

> north 

The robot steps in front of you as you approach the gate. 
"PAASSWAAAAWRD!!" it bellows. 

Enter the password: _ 

En este punto, el juego debe hacer una pausa y dejar que el jugador trata de adivinar la contraseña. Por ejemplo, supongamos que yo supongo “frívolo”, que no es la contraseña:

Enter the password: fribble 

"WRONG PASSWAAARD!" roars the robot. "CHECK CAPS LAAAWWWWK!" 

> 

El comportamiento que quiero es similar a if the player consents, pero quiero que toda la línea de entrada, no sólo un sí o un no.

Respuesta

11

Informar a las ofertas hay manera fácil de hacer esto, aunque es posible que pueda llegar a las primitivas de teclado dejando caer para informar 6.

Sin embargo, es posible lograr el efecto deseado:

The Loading Zone is a room. "Concrete with yellow stripes. The Hold is north." 
The robot is an animal in the Loading Zone. "However, a robot the size of an Arcturan megaladon guards the way." 

North of the Loading Zone is the Hold. 

Instead of going north from the Loading Zone: 
    say "The robot steps in front of you as you approach the gate. 'PAASSWAAAAWRD!!' it bellows."; 
    now the command prompt is "Enter password: ". 

After reading a command when the command prompt is "Enter password: ": 
    if the player's command matches "xyzzy": 
     say "The robot folds itself up into a cube to let you pass."; 
     move the player to the Hold; 
    otherwise: 
     say "'WRONG PASSWAAARD!' roars the robot. 'CHECK CAPS LAAAWWWWK!'"; 
    now the command prompt is ">"; 
    reject the player's command. 

Creo que este tipo de cosas se considera un juego pobre: ​​obliga al jugador a adivinar, lo que daña la ilusión de control y elección del jugador. La manera más convencional sería exigir que el jugador dicen la contraseña:

The Loading Zone is a room. "Concrete with yellow stripes. The Hold is north." 
The robot is an animal in the Loading Zone. The robot is either awake or asleep. The robot is awake. "[if awake]However, a robot the size of an Arcturan megaladon guards the way.[otherwise]A cube of metal the size of an Arctural megaladon snores loudly.[end if]". 
North of the Loading Zone is the Hold. 

Instead of going north from the Loading Zone when the robot is awake: 
    say "The robot steps in front of you as you approach the gate. 'PAASSWAAAAWRD!!' it bellows." 

Instead of answering the robot that some text: 
    if the topic understood matches "xyzzy": 
     say "The robot folds itself up into a cube to let you pass."; 
     now the robot is asleep; 
    otherwise: 
     say "'WRONG PASSWAAARD!' roars the robot. 'CHECK CAPS LAAAWWWWK!'" 

Los comandos dicen XYZZY y respuesta XYZZY y robot, XYZZY y decir XYZZY al robot hará todo trabajo.

3

La extensión Las preguntas de Michael Callaghan ayudarán con esto. Tenga en cuenta que es posible que no pueda probar con fiabilidad las mayúsculas y minúsculas.

Cuestiones relacionadas