Package mudpy :: Module misc
[frames] | no frames]

Module misc

source code

Miscellaneous functions for the mudpy engine.

Classes
  Element
An element of the universe.
  Universe
The universe.
  User
This is a connected user.
Functions
 
broadcast(message, add_prompt=True)
Send a message to all connected users.
source code
 
log(message, level=0)
Log a message.
source code
 
get_loglines(level, start, stop)
Return a specific range of loglines filtered by level.
source code
 
glyph_columns(character)
Convenience function to return the column width of a glyph.
source code
 
wrap_ansi_text(text, width)
Wrap text with arbitrary width while ignoring ANSI colors.
source code
 
weighted_choice(data)
Takes a dict weighted by value and returns a random key.
source code
 
random_name()
Returns a random character name.
source code
 
replace_macros(user, text, is_input=False)
Replaces macros in text output.
source code
 
escape_macros(text)
Escapes replacement macros in text.
source code
 
first_word(text, separator=u' ')
Returns a tuple of the first word and the rest.
source code
 
on_pulse()
The things which should happen on each pulse, aside from reloads.
source code
 
reload_data()
Reload all relevant objects.
source code
 
check_for_connection(listening_socket)
Check for a waiting connection and return a new user object.
source code
 
get_menu(state, error=None, choices=None)
Show the correct menu text to a user.
source code
 
menu_echo_on(state)
True if echo is on, false if it is off.
source code
 
get_echo_message(state)
Return a message indicating that echo is off.
source code
 
get_default_menu_choice(state)
Return the default choice for a menu.
source code
 
get_formatted_default_menu_choice(state)
Default menu choice foratted for inclusion in a prompt string.
source code
 
get_menu_description(state, error)
Get the description or error text.
source code
 
get_menu_prompt(state)
Try to get a prompt, if it was defined.
source code
 
get_menu_choices(user)
Return a dict of choice:meaning.
source code
 
get_formatted_menu_choices(state, choices)
Returns a formatted string of menu choices.
source code
 
get_menu_branches(state)
Return a dict of choice:branch.
source code
 
get_default_branch(state)
Return the default branch.
source code
 
get_choice_branch(user, choice)
Returns the new state matching the given choice.
source code
 
get_menu_actions(state)
Return a dict of choice:branch.
source code
 
get_default_action(state)
Return the default action.
source code
 
get_choice_action(user, choice)
Run any indicated script for the given choice.
source code
 
handle_user_input(user)
The main handler, branches to a state-specific handler.
source code
 
generic_menu_handler(user)
A generic menu choice handler.
source code
 
handler_entering_account_name(user)
Handle the login account name.
source code
 
handler_checking_password(user)
Handle the login account password.
source code
 
handler_entering_new_password(user)
Handle a new password entry.
source code
 
handler_verifying_new_password(user)
Handle the re-entered new password for verification.
source code
 
handler_active(user)
Handle input for active users.
source code
 
command_halt(actor, parameters)
Halt the world.
source code
 
command_reload(actor)
Reload all code modules, configs and data.
source code
 
command_quit(actor)
Leave the world and go back to the main menu.
source code
 
command_help(actor, parameters)
List available commands and provide help for commands.
source code
 
command_move(actor, parameters)
Move the avatar in a given direction.
source code
 
command_look(actor, parameters)
Look around.
source code
 
command_say(actor, parameters)
Speak to others in the same area.
source code
 
command_chat(actor)
Toggle chat mode.
source code
 
command_show(actor, parameters)
Show program data.
source code
 
command_create(actor, parameters)
Create an element if it does not exist.
source code
 
command_destroy(actor, parameters)
Destroy an element if it exists.
source code
 
command_set(actor, parameters)
Set a facet of an element.
source code
 
command_delete(actor, parameters)
Delete a facet from an element.
source code
 
command_error(actor, input_data)
Generic error for an unrecognized command word.
source code
 
daemonize(universe)
Fork and disassociate from everything.
source code
 
create_pidfile(universe)
Write a file containing the current process ID.
source code
 
remove_pidfile(universe)
Remove the file containing the current process ID.
source code
 
excepthook(excepttype, value, tracebackdata)
Handle uncaught exceptions.
source code
 
sighook(what, where)
Handle external signals.
source code
 
override_excepthook()
Redefine sys.excepthook with our own.
source code
 
assign_sighook()
Assign a customized handler for some signals.
source code
 
setup()
This contains functions to be performed when starting the engine.
source code
 
finish()
This contains functions to be performed when shutting down the engine.
source code
Variables
  __package__ = None