How to get the user to input a number

I’m sure I’ve seen this in the documentation or in Jim Aikin’s handbook, but I just can’t find it.

My intent is obvious from this:

[code]Typing is an action applying to one number and requiring light. Understand “Type [number]” as typing.

Carry out typing:
if the index machine is not in the location:
say “Nothing here you can type on. Sorry.”;
stop the action;
else if the [number understood] is not a number:
say “The Index Machine needs a number. Just type a number.”;
else say " [number understood] ".
[/code]

I know I could do it by capturing the input line. Is that how to do it?

Perhaps the “Safety” example where you “spin” number to open a safe:

inform7.com/learn/man/RB_9_2.html

Copy of the example:

     "Safety" 

    The Vault is a room. "Snug yet paranoid, this represents the state of the art in cheerless security." The Safe is here. "A mammoth safe, with a dial which can spin to any number, has pride of place. It must weigh about the same as a small car, so don't get any ideas." Instead of opening the safe, say "The safe opens only when turned to the correct combination." 

    In the Safe is a silver florin. The Safe is closed and fixed in place. Understand "dial" as the Safe. 

    Spinning it to is an action applying to one thing and one number. Check spinning it to: if the noun is not the Safe, say "[The noun] does not spin." instead. Report spinning it to: say "Click! and nothing else happens." 

    Understand "spin [something] to [a number]" as spinning it to. 

    After spinning the closed Safe to 1384: now the Safe is open; say "Clonk! and the safe door swings slowly open, revealing [a list of things in the Safe]." 

    Test me with "open safe / spin safe to 1131 / open safe / spin safe to 1384 / x safe / get florin". 

Anything in square brackets outside text is considered a comment and ignored by the compiler, so the first else line should be “else if the number understood is not a number:” and the last line should have “else:” on its own line.

Typing is an action applying to one number and requiring light. Understand "Type [number]" as typing.

Carry out typing:
   if the index machine is not in the location:
      say "Nothing here you can type on. Sorry.";
      stop the action;
   else if the number understood is not a number:
      say  "The Index Machine needs a number. Just type a number.";
   else:
      say " [number understood] ". 

That should make it compile, but the logical problem is that “number understood is not a number” is never true because firstly numbers can never be “not a number” and secondly the grammar line “type [number]” can never match anything else other than a number. You can either let the parser print its own error message (“I didn’t understand that number”) or add a new action for “type [text]” that’ll catch everything except numbers.

Thank you both, and especially Juhana, for that tactful pointer to my error!

All fixed now.