Using a number in a command

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Tdarcos
Posts: 9333
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Using a number in a command

Post 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.
Alan Francis wrote a book containing everything men understand about women. It consisted of 100 blank pages.

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post 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

Post Reply