evennia.game_template.server.conf package

Submodules

evennia.game_template.server.conf.at_initial_setup module

At_initial_setup module template

Custom at_initial_setup method. This allows you to hook special modifications to the initial server startup process. Note that this will only be run once - when the server starts up for the very first time! It is called last in the startup process and can thus be used to overload things that happened before it.

The module must contain a global function at_initial_setup(). This will be called without arguments. Note that tracebacks in this module will be QUIETLY ignored, so make sure to check it well to make sure it does what you expect it to.

evennia.game_template.server.conf.at_initial_setup.at_initial_setup()[source]

evennia.game_template.server.conf.at_server_startstop module

Server startstop hooks

This module contains functions called by Evennia at various points during its startup, reload and shutdown sequence. It allows for customizing the server operation as desired.

This module must contain at least these global functions:

at_server_start() at_server_stop() at_server_reload_start() at_server_reload_stop() at_server_cold_start() at_server_cold_stop()

evennia.game_template.server.conf.at_server_startstop.at_server_cold_start()[source]

This is called only when the server starts “cold”, i.e. after a shutdown or a reset.

evennia.game_template.server.conf.at_server_startstop.at_server_cold_stop()[source]

This is called only when the server goes down due to a shutdown or reset.

evennia.game_template.server.conf.at_server_startstop.at_server_reload_start()[source]

This is called only when server starts back up after a reload.

evennia.game_template.server.conf.at_server_startstop.at_server_reload_stop()[source]

This is called only time the server stops before a reload.

evennia.game_template.server.conf.at_server_startstop.at_server_start()[source]

This is called every time the server starts up, regardless of how it was shut down.

evennia.game_template.server.conf.at_server_startstop.at_server_stop()[source]

This is called just before the server is shut down, regardless of it is for a reload, reset or shutdown.

evennia.game_template.server.conf.cmdparser module

Changing the default command parser

The cmdparser is responsible for parsing the raw text inserted by the user, identifying which command/commands match and return one or more matching command objects. It is called by Evennia’s cmdhandler and must accept input and return results on the same form. The default handler is very generic so you usually don’t need to overload this unless you have very exotic parsing needs; advanced parsing is best done at the Command.parse level.

The default cmdparser understands the following command combinations (where [] marks optional parts.)

[cmdname[ cmdname2 cmdname3 …] [the rest]

A command may consist of any number of space-separated words of any length, and contain any character. It may also be empty.

The parser makes use of the cmdset to find command candidates. The parser return a list of matches. Each match is a tuple with its first three elements being the parsed cmdname (lower case), the remaining arguments, and the matched cmdobject from the cmdset.

This module is not accessed by default. To tell Evennia to use it instead of the default command parser, add the following line to your settings file:

COMMAND_PARSER = “server.conf.cmdparser.cmdparser”

evennia.game_template.server.conf.cmdparser.cmdparser(raw_string, cmdset, caller, match_index=None)[source]

This function is called by the cmdhandler once it has gathered and merged all valid cmdsets valid for this particular parsing.

raw_string - the unparsed text entered by the caller. cmdset - the merged, currently valid cmdset caller - the caller triggering this parsing match_index - an optional integer index to pick a given match in a

list of same-named command matches.

Returns

[(cmdname, args, cmdobj, cmdlen, mratio), …]

where cmdname is the matching command name and args is everything not included in the cmdname. Cmdobj is the actual command instance taken from the cmdset, cmdlen is the length of the command name and the mratio is some quality value to (possibly) separate multiple matches.

Return type

list of tuples

evennia.game_template.server.conf.connection_screens module

Connection screen

This is the text to show the user when they first connect to the game (before they log in).

To change the login screen in this module, do one of the following:

  • Define a function connection_screen(), taking no arguments. This will be called first and must return the full string to act as the connection screen. This can be used to produce more dynamic screens.

  • Alternatively, define a string variable in the outermost scope of this module with the connection string that should be displayed. If more than one such variable is given, Evennia will pick one of them at random.

The commands available to the user when the connection screen is shown are defined in evennia.default_cmds.UnloggedinCmdSet. The parsing and display of the screen is done by the unlogged-in “look” command.

evennia.game_template.server.conf.inlinefuncs module

Inlinefunc

Inline functions allow for direct conversion of text users mark in a special way. Inlinefuncs are deactivated by default. To activate, add

INLINEFUNC_ENABLED = True

to your settings file. The default inlinefuncs are found in evennia.utils.inlinefunc.

In text, usage is straightforward:

$funcname([arg1,[arg2,…]])

Example 1 (using the “pad” inlinefunc):

say This is $pad(“a center-padded text”, 50,c,-) of width 50. -> John says, “This is ————– a center-padded text————— of width 50.”

Example 2 (using nested “pad” and “time” inlinefuncs):

say The time is $pad($time(), 30)right now. -> John says, “The time is Oct 25, 11:09 right now.”

To add more inline functions, add them to this module, using the following call signature:

def funcname(text, *args, **kwargs)

where text is always the part between {funcname(args) and {/funcname and the *args are taken from the appropriate part of the call. If no {/funcname is given, text will be the empty string.

It is important that the inline function properly clean the incoming args, checking their type and replacing them with sane defaults if needed. If impossible to resolve, the unmodified text should be returned. The inlinefunc should never cause a traceback.

While the inline function should accept **kwargs, the keyword is never accepted as a valid call - this is only intended to be used internally by Evennia, notably to send the session keyword to the function; this is the session of the object viewing the string and can be used to customize it to each session.

evennia.game_template.server.conf.inputfuncs module

Input functions

Input functions are always called from the client (they handle server input, hence the name).

This module is loaded by being included in the settings.INPUT_FUNC_MODULES tuple.

All global functions included in this module are considered input-handler functions and can be called by the client to handle input.

An input function must have the following call signature:

cmdname(session, *args, **kwargs)

Where session will be the active session and *args, **kwargs are extra incoming arguments and keyword properties.

A special command is the “default” command, which is will be called when no other cmdname matches. It also receives the non-found cmdname as argument.

default(session, cmdname, *args, **kwargs)

evennia.game_template.server.conf.lockfuncs module

Lockfuncs

Lock functions are functions available when defining lock strings, which in turn limits access to various game systems.

All functions defined globally in this module are assumed to be available for use in lockstrings to determine access. See the Evennia documentation for more info on locks.

A lock function is always called with two arguments, accessing_obj and accessed_obj, followed by any number of arguments. All possible arguments should be handled with *args, **kwargs. The lock function should handle all eventual tracebacks by logging the error and returning False.

Lock functions in this module extend (and will overload same-named) lock functions from evennia.locks.lockfuncs.

evennia.game_template.server.conf.mssp module

MSSP (Mud Server Status Protocol) meta information

Modify this file to specify what MUD listing sites will report about your game. All fields are static. The number of currently active players and your game’s current uptime will be added automatically by Evennia.

You don’t have to fill in everything (and most fields are not shown/used by all crawlers anyway); leave the default if so needed. You need to reload the server before the updated information is made available to crawlers (reloading does not affect uptime).

After changing the values in this file, you must register your game with the MUD website list you want to track you. The listing crawler will then regularly connect to your server to get the latest info. No further configuration is needed on the Evennia side.

evennia.game_template.server.conf.portal_services_plugins module

Start plugin services

This plugin module can define user-created services for the Portal to start.

This module must handle all imports and setups required to start twisted services (see examples in evennia.server.portal.portal). It must also contain a function start_plugin_services(application). Evennia will call this function with the main Portal application (so your services can be added to it). The function should not return anything. Plugin services are started last in the Portal startup process.

evennia.game_template.server.conf.portal_services_plugins.start_plugin_services(portal)[source]

This hook is called by Evennia, last in the Portal startup process.

portal - a reference to the main portal application.

evennia.game_template.server.conf.secret_settings module

evennia.game_template.server.conf.server_services_plugins module

Server plugin services

This plugin module can define user-created services for the Server to start.

This module must handle all imports and setups required to start a twisted service (see examples in evennia.server.server). It must also contain a function start_plugin_services(application). Evennia will call this function with the main Server application (so your services can be added to it). The function should not return anything. Plugin services are started last in the Server startup process.

evennia.game_template.server.conf.server_services_plugins.start_plugin_services(server)[source]

This hook is called by Evennia, last in the Server startup process.

server - a reference to the main server application.

evennia.game_template.server.conf.serversession module

ServerSession

The serversession is the Server-side in-memory representation of a user connecting to the game. Evennia manages one Session per connection to the game. So a user logged into the game with multiple clients (if Evennia is configured to allow that) will have multiple sessions tied to one Account object. All communication between Evennia and the real-world user goes through the Session(s) associated with that user.

It should be noted that modifying the Session object is not usually necessary except for the most custom and exotic designs - and even then it might be enough to just add custom session-level commands to the SessionCmdSet instead.

This module is not normally called. To tell Evennia to use the class in this module instead of the default one, add the following to your settings file:

SERVER_SESSION_CLASS = “server.conf.serversession.ServerSession”

class evennia.game_template.server.conf.serversession.ServerSession[source]

Bases: evennia.server.serversession.ServerSession

This class represents a player’s session and is a template for individual protocols to communicate with Evennia.

Each account gets one or more sessions assigned to them whenever they connect to the game server. All communication between game and account goes through their session(s).

evennia.game_template.server.conf.settings module

evennia.game_template.server.conf.web_plugins module

Web plugin hooks.

evennia.game_template.server.conf.web_plugins.at_webproxy_root_creation(web_root)[source]

This function can modify the portal proxy service. :param web_root: The Evennia

Website application. Use .putChild() to add new subdomains that are Portal-accessible over TCP; primarily for new protocol development, but suitable for other shenanigans.

evennia.game_template.server.conf.web_plugins.at_webserver_root_creation(web_root)[source]

This is called as the web server has finished building its default path tree. At this point, the media/ and static/ URIs have already been added to the web root.

Parameters

web_root (twisted.web.resource.Resource) – The root resource of the URI tree. Use .putChild() to add new subdomains to the tree.

Returns

The potentially

modified root structure.

Return type

web_root (twisted.web.resource.Resource)

Example

from twisted.web import static my_page = static.File(“web/mypage/”) my_page.indexNames = [“index.html”] web_root.putChild(“mypage”, my_page)