MongooseA living laboratory of myriad worlds.

All help topics · Link to this topic

Showing help on '$command_utils'

command utilities ($command_utils #56)

$command_utils is the repository for verbs that are of general usefulness to authors of all sorts of commands. For more details about any of these verbs, use `help $command_utils:<verb-name>'.

Detecting and Handling Failures in Matching


:object_match_failed(match_result, name)
Test whether or not a :match_object() call failed and print messages if so.
:player_match_failed(match_result, name)
Test whether or not a :match_player() call failed and print messages if so.
:player_match_result(match_results, names)
...similar to :player_match_failed, but does a whole list at once.

Reading Input from the Player


:read() -- Read one line of input from the player and return it.
:yes_or_no([prompt])
/help/ -- Prompt for and read a `yes' or `no' answer.
:read_lines() -- Read zero or more lines of input from the player.
:dump_lines(lines)
/help/ -- Return list of lines quoted so that feeding them to
:read_lines() will reproduce the original lines.
:read_lines_escape(escapes[,help])
/help/ -- Like read_lines, except you can provide more escapes
to terminate the read.

Feature Objects


:validate_feature -- compare command line against feature verb argument spec

Utilities for Suspending


:running_out_of_time()
/help/ -- Return true if we're low on ticks or seconds.
:suspend_if_needed(time)
/help/ -- Suspend (and return true) if we're running out of time.

Client Support for Lengthy Commands


:suspend(args) -- Handle PREFIX and SUFFIX for clients in long commands.

:object_match_failed - Usage: object_match_failed(object, string)
:player_match_failed(result,string)
:read - $command_utils:read() -- read a line of input from the player and return it
:read_lines - $command_utils:read_lines([max]) -- read zero or more lines of input
:yes-or-no([prompt]) -- prompts the player for a yes or no answer and returns a true value iff the player enters a line of input that is some prefix of "yes"
:read_lines_escape - $command_utils:read_lines_escape(escapes[,help]) -- read zero or more lines of input
:suspend - Suspend, using output_delimiters() in case a client needs to keep track
:running_out_of_time - Return true if we're running out of ticks or seconds.
:suspend_if_needed - Usage: $command_utils:suspend_if_needed(<time>[, @<announcement>])
:dump_lines(text) => text `.'-quoted for :read_lines()
:explain_syntax(here,verb,args)
:do_huh(verb,args) what :huh should do by default.
:task_info - task_info(task id)
:kill_if_laggy - Kills this task if the current lag is greater than args[1].
:validate_feature(verb, args)
:read_json - Call read_lines, joined into a string and return parse_json
:dispatch_subcommand - dispatch_subcommand(obj, argstr, ?prefix, ?player) - Dispatch to cmd_<subcommand> verbs.

Also from $generic_utils: 1 documented verb. help $generic_utils