[Package Index | Mudlib Index | Effect Index]
Since this class is a nexus of control for player commands, it is also the natural place for a number of other utilities and functions which also affect the execution of all commands. Among these are things like drunk_check(), do_soul(), etc.
See also:
/global/new_parse->add_command(), /global/player->heart_beat() and query_passed_out_message()
Written by Pinkfish
.
int adjust_time_left(int i)Change the amount of time a player has left. You call this after a command has been executed to make it take more time.
void bypass_queue()To make the next single command be executed directly rather than being placed in the command queue, call this function.
void command_override(function func)Use this function to set a function that is called with the players input before the command handlers get to it, return 1 from the function if the input needs no further parsing (ie the command is handled)
void do_soul(string str, mixed bing)All soul commands eventually call this function to output their messages. This is nothing more than a wrapper for say(), but it provides a convenient name by which a shadow on the player object can replace any soul behavior.
void interupt_command(object interupter)This method interupts the current command.
int lower_check(string str)This function will get called when all other commands and actions have refused to do anything for this input from the user. This function adds some extra time for the user, and then returns.
This function is registered via add_action() with a
priority of -10000. If you want to bypass it, then use a priority
higher than that. If you want to see what strings get dropped by the
entire add_action() stack, then use a priority lower.
void no_time_left()Ensure that the player has no more time for executing commands. This will force the next command to be queued.
mixed * query_interupt_command()This method returns the current value associated with tine interupt command.
int query_queued_commands()You can use this function to see if there are any commands queued for this player.
int query_time_left()The amount of time units left. A time unit is 1/40th of a second.
void remove_queue()This is called by the stop command. It sets the entire queue back to empty. It calls the interrupt functions and stuff if they need to be called.
void set_interrupt_command(function func)Fixes a spelling error. This one only takes a function pointer as an input.
void set_interupt_command(mixed func, mixed ob, mixed arg)Sets the function to be executed if the command is interrupted. It is also executed if teh command finished. If it is interrupted the first arguement to the called function will be the amount of time it had left to complete. If it complets successfuly, this argument will be 0. If the first argument is a function pointer, this will be used instead.
Eg: set_interupt_command("frog", this_object());
void frog(int time_left, mixed arg) {
...
}
... void frog(int time_left, mixed arg); ... set_interupt_commant((: frog :)); ... void frog(int time_left, mixed arg) { ... } /* frog() */
int soul_com_force(string str)Some of the soul commands force the target to do something. An example is the 'tickle' soul, which forces the target to 'giggle'. Those soul-forces call this function. But only the soul object can use this function: any other object which calls this function will be ignored. This prevents this function from being used to bypass the security checking on the 'force' command.
void soul_commands()This is a setup function that is called by the player object. It is used to register the lower_check() and drunk_check() functions. Plus it initializes the alias object, the nickname object, and the history object.
int drunk_check(string str)This poorly named function was originally used to affect the player's behavior when they are drunk, and to prevent any player from doing anything in the event that they are passed out. Now the function also is responsible for adding commands to the player's command queue, for implementing the 'stop' and 'restart' commands, and for ensuring that the player can quit the game, even when queueing.
To see if a player is passed out, it checks the "passed out" property. If that property is nonzero, then the player will be prevented from doing the command unless that player is also a creator. By default, it will print a message that says: "You are unconscious. You can't do anything.\n". If the function query_passed_out_message() is defined on the player object (usually by a shadow), and returns a string, then that string is printed instead.
This function is registered with
add_action("drunk_check", "*", 10000),
so it can be avoided by registering a higher priority add_action.
But that is not necessary, because if bypass_queue() has
been called, this function will do nothing. Please note that
you should not be using add_action.
void flush_queue()This method flushes all the queued commands. It increments the time by the ROUND_TIME define and checks to see if any of the commands now need to be executed. This should be called each heart beat..
string process_input(string str)This is the command called by the driver on a player object every time a command is executed. It expands the history comands.