Robopuppy ReduxAn interactive fiction by J.D. Clemens (2007) - the Inform 7 source text | |
| Home page Contents Previous Next Complete text | Section B - Performing one step each turn
[ This will cause the actor to execute one steep of the command each turn until done. ] A person can be scripted. A person is usually not scripted. After deciding the scope of the player when Robopuppy is in the location: repeat with item running through nonblank commands begin; place the item in scope; end repeat. The pending command is a command that varies. Performing is an action applying to one visible thing. Understand "[nonblank command]" as performing. Check performing: if Robopuppy is scripted, say "Robopuppy is already performing a command." instead; if the learning flag is true, say "Robopuppy is learning a command right now." instead. Carry out performing: change the pending command to the noun; change the command index to 1; now Robopuppy is scripted; say "You tell Robopuppy to [the message of noun].". Every turn when Robopuppy is scripted: let buffer be indexed text; let buffer be "[single command output]"; replace the regular expression "\s" in buffer with " "; replace the regular expression "\s\s" in buffer with " "; while buffer matches the regular expression "(?<=Robopuppy)(.*?\.\s)Robopuppy" begin; replace the regular expression "(?<=Robopuppy)(.*?\.\s)Robopuppy(.*)" in buffer with "\1[one of]He then[or]Next he[or]After that he[or]He now[or]Then he[or]A moment later he[or]Now he[or]He next[in random order]\2"; end while; replace the regular expression "(?<=Robopuppy)(.*?)Robopuppy" in buffer with "\1himself"; if buffer matches the regular expression "\S", say "[buffer][paragraph break]"; otherwise say "[run paragraph on]". To say single command output: perform the pending command; Instead of Robopuppy trying performing: try performing the noun. Performing is unteachable. |