MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 2 | string query_verb(void) |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 3 | string query_verb(int flag) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 4 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 5 | DESCRIPTION |
| 6 | Return the verb of the current command, of 0 if not executing from |
| 7 | a command. If <flag> is 0 or not given, the verb as given by the user |
| 8 | is returned (this is the first word from the line input by the player, |
| 9 | up to but not including the first space or lineend). If <flag> is |
| 10 | non-0, the verb as specified in the add_action() statement is returned. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 12 | EXAMPLES |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 13 | void init() { |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 14 | ... |
| 15 | add_action("sing","sing"); |
| 16 | add_action("sing","chant", 1); |
| 17 | ... |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 18 | } |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 19 | int sing(string str) { |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 20 | write("Your command was: "+query_verb()+(str ? str : "")+"\n"); |
| 21 | write("The action verb was: "+query_verb(1)+(str ? str : "")+"\n"); |
| 22 | return 1; |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 23 | } |
| 24 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 25 | The command 'sing ...' will print: |
| 26 | Your command was: sing |
| 27 | The action verb was: sing |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 28 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 29 | The command 'chant ...' will print: |
| 30 | Your command was: chant |
| 31 | The action verb was: chant |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 32 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 33 | The command 'chantit ...' will print: |
| 34 | Your command was: chantit |
| 35 | The action verb was: chant |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 36 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 37 | HISTORY |
| 38 | LDMud 3.2.9 added the optional flag argument. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 39 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 40 | SEE ALSO |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 41 | add_action(E), query_command(E) |