You should probably use singleNumber instead of singleLiteral. You can then get the value as an integer with numMatch.getval(). As a bonus, this allows stuff like:
>zap seven turns
Which is quite l33t :mrgreen:
Anyway, I didn’t look at your whole attempt (scripted waiting and all that), but I think what you want here is to extend WaitAction with a new form that also takes a number. So that in addition to the default form:
>Z [or WAIT]
Time passes...
You will also have:
>Z 10 [or WAIT 10]
10 turns worth of time pass...
Something like:
DefineIAction(WaitTurns)
execAction()
{
"<<numMatch.getval()>> turns worth of time pass... ";
// ...
}
;
VerbRule(WaitTurns)
('wait' | 'z') singleNumber ( | 'turn' | 'turns')
: WaitTurnsAction
verbPhrase = 'wait/waiting (a number of turns)'
;
Whenever you define new grammar, you’re not tinkering with an existing action, you’re creating an entirely new action. For instance:
DefineTAction(WaitFor);
VerbRule(WaitFor)
('wait' | 'z') 'for' singleDobj
: WaitForAction
verbPhrase = 'wait/waiting (for what)'
;
This doesn’t affect the library’s existing Wait action in any way. At least, I hope it doesn’t, because I do this sort of thing a fair amount, and I’ve never noticed any untoward side effects.