I’m trying to negotiate the transition of a player’s command into a temporary number variable. From the example below, the issue (I think) are the two lines:
if the player's command matches "[number]":
let N be the player's command;
I’ve tried multiple variations of turning the player’s command into “N”. How might I accomplish that within this framework? Bear in mind that the example below is just a quick test but the real thing needs to fit into a huge game without breaking anything else.
The Bedroom is a room. The clock is scenery in Bedroom.
TimerCountdown is a number which varies. TimerCountdown is initially 0.
ComputerGate is a number which varies. ComputerGate is initially 0.
Instead of pushing clock:
say "You press the 'time' button on the clock and it waits for you to change its 'minutes'.";
now ComputerGate is 1;
now the command prompt is "ENTER NUMBER (0-59) ";
After reading a command while ComputerGate is 1:
if the player's command matches "[number]":
let N be the player's command;
if N is less than 0 and N is greater than 59:
say "The clock's screen blinks to indicate an invalid entry.";
reject the player's command;
otherwise if N is greater than -1 and N is less than 60:
now TimerCountdown is N;
now ComputerGate is 0;
now the command prompt is ">";
say "The clock now reads, '12:[TimerCountDown]'";
reject the player's command;
Sorry, I asked the question and then haven’t been able to work on the game since!
I’ve reformulated the example, but Inform doesn’t recognize the conditionals using [the number recognized]. How might I rewrite the below?
The Bedroom is a room. The clock is scenery in Bedroom.
TimerCountdown is a number which varies. TimerCountUp is initially 0.
Typing is an action applying to one number. Understand "type [number]" as typing.
Instead of typing:
if [the number understood] is less than 0 and [the number understood] is greater than 59:
say "The clock's screen blinks to indicate an invalid entry.";
otherwise if [the number understood] is greater than -1 and [the number understood] is less than 60:
now TimerCountDown is [the number understood];
say "The clock now reads, '12:[TimerCountDown]'";
Thanks, though declaring it “of course” is a bit unfair. Sometimes brackets aren’t comments and I’m not expert enough to know when that is and is not true.
When the brackets are part of a quote, like "There are [book-count] books", it’s a variable in the description. When the brackets are outside of quotes, they form a comment, so the variable should be referred to without quotes (if book-count is greater than 0).
Yep, this is where it really helps to have an editor with syntax highlighting. Brackets outside strings (but not inside strings!) can also be nested, and highlighting helps to make sure you’ve closed 'em all!