Page 1 of 1

Using a number in a command

Posted: Tue Oct 09, 2012 11:53 am
by Tdarcos
Is there a way to have a number as a command short of putting every number as a verb option like I did in Teleporter Test, so that someone can type:

PAY 3500

or

PAY AGENT 3500

and be able to have any number in the number range?

Right now I'm having the operator calculate amounts due, but if someone was in an auction they might post a bid or for other purposes.

Posted: Tue Oct 09, 2012 12:28 pm
by Roody_Yogurt
You want to use the number grammar token in your verb definition:

verb "pay"
* number DoPay

When DoPay is performed, the object global is set to the number entered.

Your second example command is harder to do, as it's generally impossible to support commands with no separator words between the object and xobject without some trickery, like:

verb "pay"
* "agent" number DoAgentPay