SYNOPSIS

string query_verb( void)
string query_verb( int flag)

DESCRIPTION

Return the verb of the current command, of 0 if not executing from a command. If flag is 0 or not given, the verb as given by the user is returned (this is the first word from the line input by the player, up to but not including the first space or lineend). If flag is non-0, the verb as specified in the add_action(E) statement is returned.

USAGE

When the user is in the presence of an object defined as:

void init() {
   ...
   add_action("sing","sing");
   add_action("sing","chant", 1);
   ...
}
int sing(string str) {
   write("Your command was: "+query_verb()+(str ? str : "")+"\n");
   write("The action verb was: "+query_verb(1)+(str ? str : "")+"\n");
   return 1;
}

the command ‘sing ...’ will print:

Your command was: sing
The action verb was: sing

the command ‘chant ...’ will print:

Your command was: chant
The action verb was: chant

and the command ‘chantit ...’ will print:

Your command was: chantit
The action verb was: chant

HISTORY

  • changed (3.2.9) – added the optional flag argument.