2012-10-12 14 views
8

Voglio solo chiedere all'utente una riga di testo nel mezzo di un'azione. L'effetto dovrebbe essere il seguente:Come posso leggere una riga di input in Inform 7?

> north 

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

Enter the password: _ 

A questo punto il gioco dovrebbe fermarsi e consentire al giocatore di provare a indovinare la password. Ad esempio, supponiamo che io immagino “fribble”, che non è la password:

Enter the password: fribble 

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

> 

Il comportamento che voglio è simile a if the player consents, ma voglio tutta la linea di ingresso, non solo un sì o no.

risposta

11

Inform offerte un modo semplice per fare questo, anche se si potrebbe essere in grado di raggiungere le primitive di tastiera facendo cadere a informare 6.

Tuttavia, è possibile ottenere l'effetto desiderato:

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. 

Penso che questo genere di cose sia considerato un gameplay scadente: obbliga il giocatore a indovinare, il che danneggia l'illusione di controllo e scelta del giocatore. Il modo più convenzionale sarebbe quello di richiedere al giocatore di dire la password:

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!'" 

I comandi dicono xyzzy e risposta xyzzy e robot, xyzzy e dire xyzzy al robot saranno tutti lavoro.

3

L'estensione domande di Michael Callaghan aiuterà con questo. Si noti che potrebbe non essere possibile verificare in modo affidabile la causa dell'input in modo sensibile.

Problemi correlati