diff --git a/docs/sphinx/source/wiki/ApacheConfig.rst b/docs/sphinx/source/wiki/ApacheConfig.rst index 19da9bd6f2..b548bfc05a 100644 --- a/docs/sphinx/source/wiki/ApacheConfig.rst +++ b/docs/sphinx/source/wiki/ApacheConfig.rst @@ -113,5 +113,8 @@ are trouble. :: - /evennia/game/web"> Options +ExecCGI Allow from all + /evennia/game/web"> + Options +ExecCGI + Allow from all + diff --git a/docs/sphinx/source/wiki/AsyncProcess.rst b/docs/sphinx/source/wiki/AsyncProcess.rst index 60350ac160..14f7c161ad 100644 --- a/docs/sphinx/source/wiki/AsyncProcess.rst +++ b/docs/sphinx/source/wiki/AsyncProcess.rst @@ -17,7 +17,9 @@ Consider this piece of code: :: - print "before call ..." long_running_function() print "after call ..." + print "before call ..." + long_running_function() + print "after call ..." When run, this will print ``"before call ..."``, after which the ``long_running_function`` gets to work for however long time. Only once @@ -43,7 +45,10 @@ use of the ``run_async()`` function in ``src/utils/utils.py``. :: - from src.utils import utils print "before call ..." utils.run_async(long_running_function) print "after call ..." + from src.utils import utils + print "before call ..." + utils.run_async(long_running_function) + print "after call ..." Now, when running this you will find that the program will not wait around for ``long_running_function`` to finish. Infact you will see @@ -74,7 +79,8 @@ called automatically. :: - def at_return(r): print r + def at_return(r): + print r - ``at_err(e)`` (the *errback*) is called if the asynchronous function fails and raises an exception. This exception is passed to the @@ -93,7 +99,19 @@ An example of making an asynchronous call from inside a :: - from src.utils import utils from game.gamesrc.commands.basecommand import Command class CmdAsync(Command): key = "asynccommand" def func(self): def long_running_function(): #[... lots of time-consuming code return final_value def at_return(r): self.caller.msg("The final value is %s" % r) def at_err(e): self.caller.msg("There was an error: %s" % e) # do the async call, setting all callbacks utils.run_async(long_running_function, at_return, at_err) + from src.utils import utils + from game.gamesrc.commands.basecommand import Command + + class CmdAsync(Command): key = "asynccommand" def func(self): + + def long_running_function(): + #[... lots of time-consuming code + return final_value + + def at_return(r): + self.caller.msg("The final value is %s" % r) def at_err(e): + self.caller.msg("There was an error: %s" % e) # do the async call, setting all callbacks + utils.run_async(long_running_function, at_return, at_err) That's it - from here on we can forget about ``long_running_function`` and go on with what else need to be done. *Whenever* it finishes, the diff --git a/docs/sphinx/source/wiki/Attributes.rst b/docs/sphinx/source/wiki/Attributes.rst index fbc1b00f12..143b1d7cb5 100644 --- a/docs/sphinx/source/wiki/Attributes.rst +++ b/docs/sphinx/source/wiki/Attributes.rst @@ -29,7 +29,9 @@ assign data to it. Let's try to save some data to a *Rose* (an :: - # saving rose.has_thorns = True# getting it back is_ouch = rose.has_thorns + # saving + rose.has_thorns = True# getting it back + is_ouch = rose.has_thorns Whether this data is saved *persistently* to the database or not (i.e. if it survives a server reboot) depends on the setting of the variable @@ -41,7 +43,9 @@ of ``FULL_PERSISTENCE``, use the ``db`` (!DataBase) interface. :: - # saving rose.db.has_thorns = True # getting it back is_ouch = rose.db.has_thorns + # saving + rose.db.has_thorns = True # getting it back + is_ouch = rose.db.has_thorns This creates a new ``Attribute`` object and links it uniquely to ``rose``. Using ``db`` ``will`` always save data to the database. @@ -51,7 +55,9 @@ It works in the same way: :: - # saving rose.ndb.has_thorns = True # getting it back is_ouch = rose.ndb.has_thorns + # saving + rose.ndb.has_thorns = True # getting it back + is_ouch = rose.ndb.has_thorns (Using ``ndb`` like this will **NEVER** use the database.) @@ -156,7 +162,18 @@ Examples of valid attribute data: :: - # a single value obj.db.test1 = 23 obj.db.test1 = False # a database object (will be stored as dbref) obj.db.test2 = myobj # a list of objects obj.db.test3 = [obj1, 45, obj2, 67] # a dictionary obj.db.test4 = 'str':34, 'dex':56, 'agi':22, 'int':77 # a mixed dictionary/list obj.db.test5 = 'members': [obj1,obj2,obj3], 'enemies':[obj4,obj5]# a tuple will stored and returned as a list [1,2,3,4,5]! obj.db.test6 = (1,2,3,4,5) + # a single value + obj.db.test1 = 23 + obj.db.test1 = False + # a database object (will be stored as dbref) + obj.db.test2 = myobj + # a list of objects + obj.db.test3 = [obj1, 45, obj2, 67] + # a dictionary + obj.db.test4 = 'str':34, 'dex':56, 'agi':22, 'int':77 + # a mixed dictionary/list + obj.db.test5 = 'members': [obj1,obj2,obj3], 'enemies':[obj4,obj5]# a tuple will stored and returned as a list [1,2,3,4,5]! + obj.db.test6 = (1,2,3,4,5) Notes ----- diff --git a/docs/sphinx/source/wiki/BatchCodeProcessor.rst b/docs/sphinx/source/wiki/BatchCodeProcessor.rst index c6e118bf6f..f2beac8bbe 100644 --- a/docs/sphinx/source/wiki/BatchCodeProcessor.rst +++ b/docs/sphinx/source/wiki/BatchCodeProcessor.rst @@ -75,7 +75,13 @@ Below is a version of the example file found in # # This is an example batch-code build file for Evennia. - ##HEADER# This will be included in all other #CODE blocksfrom src.utils import create, search from game.gamesrc.objects.examples import red_button from game.gamesrc.objects import baseobjectslimbo = search.objects(caller, 'Limbo', global_search=True)[0]#CODE (create red button)red_button = create.create_object(red_button.RedButton, key="Red button", location=limbo, aliases=["button"])# caller points to the one running the script caller.msg("A red button was created.")#CODE (create table and chair) table, chairtable = create.create_object(baseobjects.Object, key="Blue Table", location=limbo) chair = create.create_object(baseobjects.Object, key="Blue Chair", location=limbo)string = "A %s and %s were created. If debug was active, they were deleted again." caller.msg(string % (table, chair)) + ##HEADER# This will be included in all other #CODE blocksfrom src.utils import create, search + from game.gamesrc.objects.examples import red_button + from game.gamesrc.objects import baseobjectslimbo = search.objects(caller, 'Limbo', global_search=True)[0]#CODE (create red button)red_button = create.create_object(red_button.RedButton, key="Red button", + location=limbo, aliases=["button"])# caller points to the one running the script + caller.msg("A red button was created.")#CODE (create table and chair) table, chairtable = create.create_object(baseobjects.Object, key="Blue Table", location=limbo) + chair = create.create_object(baseobjects.Object, key="Blue Chair", location=limbo)string = "A %s and %s were created. If debug was active, they were deleted again." + caller.msg(string % (table, chair)) This uses Evennia's Python API to create three objects in sequence. @@ -137,7 +143,11 @@ batch-processor version of ``look``). :: - from src.utils import create, search from game.gamesrc.objects.examples import red_button from game.gamesrc.objects import baseobjectslimbo = search.objects(caller, 'Limbo', global_search=True)[0]red_button = create.create_object(red_button.RedButton, key="Red button", location=limbo, aliases=["button"])# caller points to the one running the script caller.msg("A red button was created.") + from src.utils import create, search + from game.gamesrc.objects.examples import red_button + from game.gamesrc.objects import baseobjectslimbo = search.objects(caller, 'Limbo', global_search=True)[0]red_button = create.create_object(red_button.RedButton, key="Red button", + location=limbo, aliases=["button"])# caller points to the one running the script + caller.msg("A red button was created.") Compare with the example code given earlier. Notice how the content of ``#HEADER`` has been pasted at the top of the ``#CODE`` block. Use diff --git a/docs/sphinx/source/wiki/BatchCommandProcessor.rst b/docs/sphinx/source/wiki/BatchCommandProcessor.rst index 2b13ef817a..c8c8e39bf7 100644 --- a/docs/sphinx/source/wiki/BatchCommandProcessor.rst +++ b/docs/sphinx/source/wiki/BatchCommandProcessor.rst @@ -60,7 +60,21 @@ Below is a version of the example file found in :: - # # This is an example batch build file for Evennia. ## This creates a red button button@create button:examples.red_button.RedButton# (This comment ends input for @create) # Next command. Let's create something. @set button/desc = This is a large red button. Now and then it flashes in an evil, yet strangely tantalizing way. A big sign sits next to it. It says:----------- Press me! ----------- ... It really begs to be pressed! You know you want to! # (This ends the @set command). Note that single line breaks # and extra whitespace in the argument are ignored. Empty lines # translate into line breaks in the output. # Now let's place the button where it belongs (let's say limbo #2 is # the evil lair in our example)@teleport #2# (This comments ends the @teleport command.) # Now we drop it so others can see it. # The very last command in the file needs not be ended with #.drop button + # + # This is an example batch build file for Evennia. + ## This creates a red button button@create button:examples.red_button.RedButton# (This comment ends input for @create) + # Next command. Let's create something. @set button/desc = + This is a large red button. Now and then + it flashes in an evil, yet strangely tantalizing way. A big sign sits next to it. It says:----------- Press me! ----------- ... It really begs to be pressed! You + know you want to! + + # (This ends the @set command). Note that single line breaks + # and extra whitespace in the argument are ignored. Empty lines + # translate into line breaks in the output. + # Now let's place the button where it belongs (let's say limbo #2 is + # the evil lair in our example)@teleport #2# (This comments ends the @teleport command.) + # Now we drop it so others can see it. + # The very last command in the file needs not be ended with #.drop button To test this, run ``@batchcommand`` on the file. A button will be created, described and dropped in Limbo. All commands will be executed diff --git a/docs/sphinx/source/wiki/BuildingQuickstart.rst b/docs/sphinx/source/wiki/BuildingQuickstart.rst index e228558c1e..0710ddb69f 100644 --- a/docs/sphinx/source/wiki/BuildingQuickstart.rst +++ b/docs/sphinx/source/wiki/BuildingQuickstart.rst @@ -101,7 +101,8 @@ you log in as another user than #1 and try to get the box now: :: - > get box You can't get that. + > get box + You can't get that. Think the default error message looks dull? The ``get`` command looks for an `Attribute `_ named ``get_err_msg`` for diff --git a/docs/sphinx/source/wiki/Colours.rst b/docs/sphinx/source/wiki/Colours.rst index d8baa197ef..34e768daab 100644 --- a/docs/sphinx/source/wiki/Colours.rst +++ b/docs/sphinx/source/wiki/Colours.rst @@ -26,7 +26,8 @@ mark colour: :: - This is a %crRed text%cn This is normal text again. %cRThis text has red background%cn this is normal text. + This is a %crRed text%cn This is normal text again. + %cRThis text has red background%cn this is normal text. ``%c#`` - markup works like a switch that is on until you actively turn it off with ``%cn`` (this returns the text to your default setting). diff --git a/docs/sphinx/source/wiki/CommandPrompt.rst b/docs/sphinx/source/wiki/CommandPrompt.rst index 74e6d274ed..c7844a5d66 100644 --- a/docs/sphinx/source/wiki/CommandPrompt.rst +++ b/docs/sphinx/source/wiki/CommandPrompt.rst @@ -15,7 +15,9 @@ of the look command, followed by the prompt. As an example: :: - > look You see nothing special. HP:10, SP:20, MP: 5 + > look + You see nothing special. + HP:10, SP:20, MP: 5 MUD clients can be set to detect prompts like this and display them in various client-specific ways. @@ -31,7 +33,12 @@ administration for example). :: - class MyCommand(Command): [...] def at_post_cmd(self): # we assume health/stamina/magic are just stored # as simple attributes on the character. hp = self.caller.db.hp sp = self.caller.db.sp mp = self.caller.db.mp self.caller.msg("HP: %i, SP: %i, MP: %i" % (hp, sp, mp)) + class MyCommand(Command): [...] def at_post_cmd(self): + + # we assume health/stamina/magic are just stored + # as simple attributes on the character. hp = self.caller.db.hp + sp = self.caller.db.sp + mp = self.caller.db.mp self.caller.msg("HP: %i, SP: %i, MP: %i" % (hp, sp, mp)) Prompt on the same line ----------------------- @@ -41,7 +48,8 @@ return of every command, on the same line: :: - > look HP: 10, SP:20, MP:5 -- You see nothing special. + > look + HP: 10, SP:20, MP:5 -- You see nothing special. Now, there is an ``at_pre_cmd()`` hook analogous to the hook from last section except called just *before* parsing of the command. But putting @@ -50,7 +58,9 @@ before* the function return: :: - > look HP:10, SP:20, MP: 5 You see nothing special. + > look + HP:10, SP:20, MP: 5 + You see nothing special. ... which might be cool too, but not what we wanted. To have the prompt appear on the same line as the return this, we need to change how @@ -63,7 +73,8 @@ player. This is defined in ``src/objects/models.py``, on the :: - def msg(self, outgoing_message, from_obj=None, data=None): ... + def msg(self, outgoing_message, from_obj=None, data=None): + ... The only argument we are interested in here is the ``outgoing_message``, which contains the text that is about to be passed on to the player. We @@ -74,7 +85,13 @@ custom Character typeclass add this: :: - def msg(self, outgoing_message, from_obj=None, data=None): # prepend the prompt in front of the message hp = self.db.hp sp = self.db.sp mp = self.db.mp prompt = "%i, %i, %i -- " % (hp, sp, mp) outgoing_message = prompt + outgoing_message # pass this on to the original msg() method on the database object self.dbobj.msg(outgoing_message, from_obj=from_obj, data=data) + def msg(self, outgoing_message, from_obj=None, data=None): + + # prepend the prompt in front of the message hp = self.db.hp + sp = self.db.sp + mp = self.db.mp + prompt = "%i, %i, %i -- " % (hp, sp, mp) + outgoing_message = prompt + outgoing_message # pass this on to the original msg() method on the database object self.dbobj.msg(outgoing_message, from_obj=from_obj, data=data) Note that this solution will *always* give you the prompt, also if you use admin commands, which could get annoying. You might want to have diff --git a/docs/sphinx/source/wiki/Commands.rst b/docs/sphinx/source/wiki/Commands.rst index 127ca31e25..e1a9b54518 100644 --- a/docs/sphinx/source/wiki/Commands.rst +++ b/docs/sphinx/source/wiki/Commands.rst @@ -124,17 +124,42 @@ to take one example. pre-parsed input to actually do whatever the command is supposed to do. This is the main body of the command. -Finally, you should always make an informative ```__doc__`` +Finally, you should always make an informative `doc string `_ -at the top of your class. This string is dynamically read by the `Help -system `_ to create the help entry for this command. -You should decide on a way to format your help and stick to that. +(``__doc__``) at the top of your class. This string is dynamically read +by the `Help system `_ to create the help entry for +this command. You should decide on a way to format your help and stick +to that. Below is how you define a simple alternative "``look at``" command: :: - from game.gamesrc.commands.basecommand import Commandclass CmdLookAt(Command): """ An alternative (and silly) look command Usage: look at Where may only be 'here' in this example. This initial string (the __doc__ string) is also used to auto-generate the help for this command ... """ key = "look at" # this is the command name to use aliases = ["la", "look a"] # aliases to the command name locks = "cmd:all()" help_category = "General" def parse(self): "Very trivial parser" self.what = self.args.strip() def func(self): "This actually does things" caller = self.caller if not self.what: caller.msg("Look at what?") elif self.what == 'here': # look at the current location description = caller.location.db.desc caller.msg(description) else: # we don't add any more functionality in this example caller.msg("Sorry, you can only look 'here'...") + from game.gamesrc.commands.basecommand import Commandclass CmdLookAt(Command): + """ + An alternative (and silly) look command Usage: + look at Where may only be 'here' in this example. This initial string (the __doc__ string) + is also used to auto-generate the help + for this command ... + """ + + key = "look at" # this is the command name to use + aliases = ["la", "look a"] # aliases to the command name + locks = "cmd:all()" + help_category = "General" def parse(self): + "Very trivial parser" + self.what = self.args.strip() def func(self): + "This actually does things" + caller = self.caller + if not self.what: + caller.msg("Look at what?") + elif self.what == 'here': + # look at the current location + description = caller.location.db.desc + caller.msg(description) + else: + # we don't add any more functionality in this example + caller.msg("Sorry, you can only look 'here'...") The power of having commands as classes and to separate ``parse()`` and ``func()`` lies in the ability to inherit functionality without having @@ -191,7 +216,17 @@ rules `_ section). :: - from src.commands.cmdset import CmdSet from game.gamesrc.commands import mycommandsclass MyCmdSet(CmdSet): def at_cmdset_creation(self): """ The only thing this method should need to do is to add commands to the set. """ self.add(mycommands.MyCommand1()) self.add(mycommands.MyCommand2()) self.add(mycommands.MyCommand3()) + from src.commands.cmdset import CmdSet + from game.gamesrc.commands import mycommandsclass MyCmdSet(CmdSet): + + def at_cmdset_creation(self): + """ + The only thing this method should need + to do is to add commands to the set. + """ + self.add(mycommands.MyCommand1()) + self.add(mycommands.MyCommand2()) + self.add(mycommands.MyCommand3()) The !CmdSet's ``add()`` method can also take another CmdSet as input. In this case all the commands from that CmdSet will be appended to this one @@ -199,7 +234,10 @@ as if you added them line by line: :: - at_cmdset_creation(): ... self.add(AdditionalCmdSet) # adds all command from this set ... + at_cmdset_creation(): + ... + self.add(AdditionalCmdSet) # adds all command from this set + ... If you added your command to an existing cmdset (like to the default cmdset), that set is already loaded into memory. You need to make the @@ -261,7 +299,19 @@ look: :: - from game.gamesrc.commands.basecommand import MuxCommandclass MyCommand(MuxCommand): """ Simple command example Usage: mycommand This command simply echoes text back to the caller. (this string is also the help text for the command) """ key = "mycommand" locks = "cmd:all()" def func(self): "This actually does things" if not self.args: self.caller.msg("You didn't enter anything!") else: self.caller.msg("You gave the string: '%s'" % self.args) + from game.gamesrc.commands.basecommand import MuxCommandclass MyCommand(MuxCommand): + """ + Simple command example Usage: + mycommand This command simply echoes text back to the caller. + (this string is also the help text for the command) + """ key = "mycommand" + locks = "cmd:all()" def func(self): + "This actually does things" + + if not self.args: + self.caller.msg("You didn't enter anything!") + else: + self.caller.msg("You gave the string: '%s'" % self.args) Next we want to make this command available to us. There are many ways to do this, but all of them involves putting this command in a *Command @@ -278,7 +328,10 @@ This is what we have now: :: from game.gamesrc.commands.basecmdset import CmdSet - from game.gamesrc.commands import mycommandclass MyCmdSet(CmdSet): key = "MyCmdSet" def at_cmdset_creation(self): self.add(mycommand.MyCommand()) + from game.gamesrc.commands import mycommandclass MyCmdSet(CmdSet): + + key = "MyCmdSet" def at_cmdset_creation(self): + self.add(mycommand.MyCommand()) This new command set could of course contain any number of commands. We will now temporarily *merge* this command set to your current set. This @@ -342,7 +395,15 @@ class and you will in fact append it to the existing command set. :: - # file gamesrc/commands/basecmdset.py ... from game.gamesrc.commands import mycommandclass DefaultSet(BaseDefaultSet): key = DefaultMUX def at_cmdset_creation(self): # this first adds all default commands super(DefaultSet, self).at_cmdset_creation() # all commands added after this point will extend or # overwrite the default commands. self.add(mycommand.MyCommand()) + # file gamesrc/commands/basecmdset.py + ... + from game.gamesrc.commands import mycommandclass DefaultSet(BaseDefaultSet): + + key = DefaultMUX def at_cmdset_creation(self): # this first adds all default commands + super(DefaultSet, self).at_cmdset_creation() # all commands added after this point will extend or + # overwrite the default commands. + + self.add(mycommand.MyCommand()) Again, you need to run the ``@reload`` command to make these changes available. @@ -431,7 +492,8 @@ Same-key commands are merged by priority. :: - # Union A1,A2 + B1,B2,B3,B4 = A1,A2,B3,B4 + # Union + A1,A2 + B1,B2,B3,B4 = A1,A2,B3,B4 **Intersect** - Only commands found in *both* cmdsets (i.e. which have the same keys) end up in the merged cmdset, with the higher-priority @@ -439,7 +501,8 @@ cmdset replacing the lower one's commands. :: - # Intersect A1,A3,A5 + B1,B2,B4,B5 = A1,A5 + # Intersect + A1,A3,A5 + B1,B2,B4,B5 = A1,A5 **Replace** - The commands of the higher-prio cmdset completely replaces the lower-priority cmdset's commands, regardless of if same-key commands @@ -447,7 +510,8 @@ exist or not. :: - # Replace A1,A3 + B1,B2,B4,B5 = A1,A3 + # Replace + A1,A3 + B1,B2,B4,B5 = A1,A3 **Remove** - The high-priority command sets removes same-key commands from the lower-priority cmdset. They are not replaced with anything, so @@ -456,7 +520,8 @@ high-prio one as a template. :: - # Remove A1,A3 + B1,B2,B3,B4,B5 = B2,B4,B5 + # Remove + A1,A3 + B1,B2,B3,B4,B5 = B2,B4,B5 Besides ``priority`` and ``mergetype``, a command set also takes a few other variables to control how they merge: @@ -483,7 +548,17 @@ More advanced cmdset example: :: - class MyCmdSet(CmdSet): key = "MyCmdSet" priority = 4 mergetype = "Replace" key_mergetype = 'MyOtherCmdSet':'Union' def at_cmdset_creation(self): """ The only thing this method should need to do is to add commands to the set. """ self.add(mycommands.MyCommand1()) self.add(mycommands.MyCommand2()) self.add(mycommands.MyCommand3()) + class MyCmdSet(CmdSet): key = "MyCmdSet" + priority = 4 + mergetype = "Replace" + key_mergetype = 'MyOtherCmdSet':'Union' def at_cmdset_creation(self): + """ + The only thing this method should need + to do is to add commands to the set. + """ + self.add(mycommands.MyCommand1()) + self.add(mycommands.MyCommand2()) + self.add(mycommands.MyCommand3()) System commands --------------- @@ -534,7 +609,12 @@ command must be added to a cmdset as well before it will work. :: - from src.commands import cmdhandler from game.gamesrc.commands.basecommand import Commandclass MyNoInputCommand(Command): "Usage: Just press return, I dare you" key = cmdhandler.CMD_NOINPUT def func(self): self.caller.msg("Don't just press return like that, talk to me!") + from src.commands import cmdhandler + from game.gamesrc.commands.basecommand import Commandclass MyNoInputCommand(Command): + "Usage: Just press return, I dare you" + key = cmdhandler.CMD_NOINPUT + def func(self): + self.caller.msg("Don't just press return like that, talk to me!") How commands actually work -------------------------- diff --git a/docs/sphinx/source/wiki/Communications.rst b/docs/sphinx/source/wiki/Communications.rst index 615679f1e8..93232fbda7 100644 --- a/docs/sphinx/source/wiki/Communications.rst +++ b/docs/sphinx/source/wiki/Communications.rst @@ -80,7 +80,12 @@ send a non-persistent message, also if you send it a ``Msg`` object. :: - # assume we have a 'sender' object and a channel named 'mychan'# send and store in database from src.utils import create mymsg = create.create_message(sender, "Hello!", channels=[mychan]) mychan.msg(mymsg)# send a one-time message mychan.msg("Hello!")# send a one-time message created from a Msg object mychan.tempmsg(mymsg) + # assume we have a 'sender' object and a channel named 'mychan'# send and store in database + from src.utils import create + mymsg = create.create_message(sender, "Hello!", channels=[mychan]) + mychan.msg(mymsg)# send a one-time message + mychan.msg("Hello!")# send a one-time message created from a Msg object + mychan.tempmsg(mymsg) As a more advanced note, sending text to channels is a "special exception" as far as commands are concerned, and you may completely diff --git a/docs/sphinx/source/wiki/ConnectionScreen.rst b/docs/sphinx/source/wiki/ConnectionScreen.rst index 966b7106cc..39e8f9d4e9 100644 --- a/docs/sphinx/source/wiki/ConnectionScreen.rst +++ b/docs/sphinx/source/wiki/ConnectionScreen.rst @@ -8,7 +8,11 @@ tells you how to connect. :: ============================================================== - Welcome to Evennia, version SVN-Alpha! If you have an existing account, connect to it by typing: connect If you need to create an account, type (without the <>'s): create "" Enter help for more info. look will re-show this screen. ============================================================== + Welcome to Evennia, version SVN-Alpha! If you have an existing account, connect to it by typing: + connect + If you need to create an account, type (without the <>'s): + create "" Enter help for more info. look will re-show this screen. + ============================================================== Effective, but not very exciting. You will most likely want to change this to be more unique for your game. diff --git a/docs/sphinx/source/wiki/DefaultCommandHelp.rst b/docs/sphinx/source/wiki/DefaultCommandHelp.rst index 0255f2cf11..1321542cec 100644 --- a/docs/sphinx/source/wiki/DefaultCommandHelp.rst +++ b/docs/sphinx/source/wiki/DefaultCommandHelp.rst @@ -34,7 +34,13 @@ module [: reason] Switches: quiet - Silently boot without informing player port - boot by port number instead of name or dbref Boot a player object from the server. If a reason is supplied it will be echoed to the user unless /quiet is set. + @boot Usage + @boot[/switches] [: reason] Switches: + quiet - Silently boot without informing player + port - boot by port number instead of name or dbref + + Boot a player object from the server. If a reason is + supplied it will be echoed to the user unless /quiet is set. @boot ~~~~~ @@ -48,7 +54,13 @@ module [: reason] Switches: quiet - Silently boot without informing player port - boot by port number instead of name or dbref Boot a player object from the server. If a reason is supplied it will be echoed to the user unless /quiet is set. + @boot Usage + @boot[/switches] [: reason] Switches: + quiet - Silently boot without informing player + port - boot by port number instead of name or dbref + + Boot a player object from the server. If a reason is + supplied it will be echoed to the user unless /quiet is set. @delplayer ~~~~~~~~~~ @@ -62,7 +74,13 @@ module [: reason] Switch: delobj - also delete the player's currently assigned in-game object. Completely deletes a user from the server database, making their nick and e-mail again available. + delplayer - delete player from server Usage: + @delplayer[/switch] [: reason] + + Switch: + delobj - also delete the player's currently + assigned in-game object. Completely deletes a user from the server database, + making their nick and e-mail again available. @delplayer ~~~~~~~~~~ @@ -76,7 +94,13 @@ module [: reason] Switch: delobj - also delete the player's currently assigned in-game object. Completely deletes a user from the server database, making their nick and e-mail again available. + delplayer - delete player from server Usage: + @delplayer[/switch] [: reason] + + Switch: + delobj - also delete the player's currently + assigned in-game object. Completely deletes a user from the server database, + making their nick and e-mail again available. @emit ~~~~~ @@ -90,7 +114,19 @@ module , , ... =] @remit [, , ... =] @pemit [, , ... =] Switches: room : limit emits to rooms only (default) players : limit emits to players only contents : send to the contents of matched objects too Emits a message to the selected objects or to your immediate surroundings. If the object is a room, send to its contents. @remit and @pemit are just limited forms of @emit, for sending to rooms and to players respectively. + @emit Usage: + @emit[/switches] [, , ... =] + @remit [, , ... =] + @pemit [, , ... =] Switches: + room : limit emits to rooms only (default) + players : limit emits to players only + contents : send to the contents of matched objects too + + Emits a message to the selected objects or to + your immediate surroundings. If the object is a room, + send to its contents. @remit and @pemit are just + limited forms of @emit, for sending to rooms and + to players respectively. @perm ~~~~~ @@ -104,7 +140,14 @@ module [= [,,...]] @perm[/switch] * [= [,,...]] Switches: del : delete the given permission from or . player : set permission on a player (same as adding * to name) This command sets/clears individual permission strings on an object or player. If no permission is given, list all permissions on . + @perm - set permissions Usage: + @perm[/switch] [= [,,...]] + @perm[/switch] * [= [,,...]] + + Switches: + del : delete the given permission from or . + player : set permission on a player (same as adding * to name) This command sets/clears individual permission strings on an object + or player. If no permission is given, list all permissions on . @userpassword ~~~~~~~~~~~~~ @@ -118,7 +161,8 @@ module = Set a player's password. + @setpassword Usage: + @userpassword = Set a player's password. @userpassword ~~~~~~~~~~~~~ @@ -132,7 +176,8 @@ module = Set a player's password. + @setpassword Usage: + @userpassword = Set a player's password. @wall ~~~~~ @@ -146,7 +191,10 @@ module Announces a message to all connected players. + @wall Usage: + @wall + + Announces a message to all connected players. Building -------- @@ -166,7 +214,13 @@ module [= [alias[,alias,alias,...]]] Assigns aliases to an object so it can be referenced by more than one name. Assign empty to remove all aliases from object. Observe that this is not the same thing as aliases created with the 'alias' command! Aliases set with @alias are changing the object in question, making those aliases usable by everyone. + Adding permanent aliases Usage: + @alias [= [alias[,alias,alias,...]]] Assigns aliases to an object so it can be referenced by more + than one name. Assign empty to remove all aliases from object. + Observe that this is not the same thing as aliases + created with the 'alias' command! Aliases set with @alias are + changing the object in question, making those aliases usable + by everyone. @batchcode ~~~~~~~~~~ @@ -180,7 +234,15 @@ module Switch: interactive - this mode will offer more control when executing the batch file, like stepping, skipping, reloading etc. debug - auto-delete all objects that has been marked as deletable in the script file (see example files for syntax). This is useful so as to to not leave multiple object copies behind when testing out the script. Runs batches of commands from a batch-code text file (*.py). + Build from batch-code file Usage: + @batchcode[/interactive] Switch: + interactive - this mode will offer more control when + executing the batch file, like stepping, + skipping, reloading etc. + debug - auto-delete all objects that has been marked as + deletable in the script file (see example files for + syntax). This is useful so as to to not leave multiple + object copies behind when testing out the script. Runs batches of commands from a batch-code text file (*.py). @batchcommands ~~~~~~~~~~~~~~ @@ -194,7 +256,11 @@ module Switch: interactive - this mode will offer more control when executing the batch file, like stepping, skipping, reloading etc. Runs batches of commands from a batch-cmd text file (*.ev). + Build from batch-command file Usage: + @batchcommands[/interactive] Switch: + interactive - this mode will offer more control when + executing the batch file, like stepping, + skipping, reloading etc. Runs batches of commands from a batch-cmd text file (*.ev). @cmdsets ~~~~~~~~ @@ -208,7 +274,9 @@ module [= new_name][;alias;alias..][:new_location] [,new_name2 ...] switch: reset - make a 'clean' copy off the object, thus removing any changes that might have been made to the original since it was first created. Create one or more copies of an object. If you don't supply any targets, one exact copy of the original object will be created with the name *_copy. + @copy - copy objects + + Usage: + @copy[/reset] [= new_name][;alias;alias..][:new_location] [,new_name2 ...] switch: + reset - make a 'clean' copy off the object, thus + removing any changes that might have been made to the original + since it was first created. Create one or more copies of an object. If you don't supply any targets, one exact copy + of the original object will be created with the name *_copy. @cpattr ~~~~~~~ @@ -236,7 +311,17 @@ module / = / [,/,/,...] @cpattr[/switch] / = [,,,...] @cpattr[/switch] = / [,/,/,...] @cpattr[/switch] = [,,,...] Switches: move - delete the attribute from the source object after copying. Example: @cpattr coolness = Anna/chillout, Anna/nicety, Tom/nicety -> copies the coolness attribute (defined on yourself), to attributes on Anna and Tom. Copy the attribute one object to one or more attributes on another object. If you don't supply a source object, yourself is used. + @cpattr - copy attributes Usage: + @cpattr[/switch] / = / [,/,/,...] + @cpattr[/switch] / = [,,,...] + @cpattr[/switch] = / [,/,/,...] + @cpattr[/switch] = [,,,...] Switches: + move - delete the attribute from the source object after copying. Example: + @cpattr coolness = Anna/chillout, Anna/nicety, Tom/nicety + -> + copies the coolness attribute (defined on yourself), to attributes + on Anna and Tom. Copy the attribute one object to one or more attributes on another object. If + you don't supply a source object, yourself is used. @create ~~~~~~~ @@ -250,7 +335,16 @@ module Switches: obj - debug an object script - debug a script Examples: @debug/script game.gamesrc.scripts.myscript.MyScript @debug/script myscript.MyScript @debug/obj examples.red_button.RedButton This command helps when debugging the codes of objects and scripts. It creates the given object and runs tests on its hooks. + Debug game entities Usage: + @debug[/switch] Switches: + obj - debug an object + script - debug a script Examples: + @debug/script game.gamesrc.scripts.myscript.MyScript + @debug/script myscript.MyScript + @debug/obj examples.red_button.RedButton This command helps when debugging the codes of objects and scripts. + It creates the given object and runs tests on its hooks. @desc ~~~~~ @@ -278,7 +379,10 @@ module =] >description> Setts the "desc" attribute on an object. If an object is not given, describe the current room. + @desc - describe an object or room Usage: + @desc [ =] >description> Setts the "desc" attribute on an + object. If an object is not given, + describe the current room. @destroy ~~~~~~~~ @@ -292,7 +396,18 @@ module [/attrname]] examine [*[/attrname]] Switch: player - examine a Player (same as adding *) raw - don't parse escape codes for data. The examine command shows detailed game info about an object and optionally a specific attribute on it. If object is not specified, the current location is examined. Append a * before the search string to examine a player. + examine - detailed info on objects Usage: + examine [[/attrname]] + examine [*[/attrname]] Switch: + player - examine a Player (same as adding *) + raw - don't parse escape codes for data. The examine command shows detailed game info about an + object and optionally a specific attribute on it. + If object is not specified, the current location is examined. Append a * before the search string to examine a player. @find ~~~~~ @@ -334,7 +464,14 @@ module [= dbrefmin[ dbrefmax]] Switches: room - only look for rooms (location=None) exit - only look for exits (destination!=None) char - only look for characters (BASE_CHARACTER_TYPECLASS) Searches the database for an object of a particular name or dbref. Use *playername to search for a player. The switches allows for limiting matches to certain game entities. Dbrefmin and dbrefmax limits matches to within the given dbrefs, or above/below if only one is given. + find objects Usage: + @find[/switches] [= dbrefmin[ dbrefmax]] Switches: + room - only look for rooms (location=None) + exit - only look for exits (destination!=None) + char - only look for characters (BASE_CHARACTER_TYPECLASS) Searches the database for an object of a particular name or dbref. + Use *playername to search for a player. The switches allows for + limiting matches to certain game entities. Dbrefmin and dbrefmax + limits matches to within the given dbrefs, or above/below if only one is given. @help ~~~~~ @@ -348,7 +485,18 @@ module [,category[,locks]] = Switches: add - add or replace a new topic with text. append - add text to the end of topic with a newline between. merge - As append, but don't add a newline between the old text and the appended text. delete - remove help topic. force - (used with add) create help topic also if the topic already exists. Examples: @sethelp/add throw = This throws something at ... @sethelp/append pickpocketing,Thievery,is_thief, is_staff) = This steals ... @sethelp/append pickpocketing, ,is_thief, is_staff) = This steals ... + @help - edit the help database Usage: + @help[/switches] [,category[,locks]] = Switches: + add - add or replace a new topic with text. + append - add text to the end of topic with a newline between. + merge - As append, but don't add a newline between the old + text and the appended text. + delete - remove help topic. + force - (used with add) create help topic also if the topic + already exists. Examples: + @sethelp/add throw = This throws something at ... + @sethelp/append pickpocketing,Thievery,is_thief, is_staff) = This steals ... + @sethelp/append pickpocketing, ,is_thief, is_staff) = This steals ... @home ~~~~~ @@ -362,7 +510,11 @@ module [= home_location] The "home" location is a "safety" location for objects; they will be moved there if their current location ceases to exist. All objects should always have a home location for this reason. It is also a convenient target of the "home" command. If no location is given, just view the object's home location. + @home - control an object's home location Usage: + @home [= home_location] The "home" location is a "safety" location for objects; they + will be moved there if their current location ceases to exist. All + objects should always have a home location for this reason. + It is also a convenient target of the "home" command. If no location is given, just view the object's home location. @link ~~~~~ @@ -376,7 +528,18 @@ module = @link[/switches] = @link[/switches] Switch: twoway - connect two exits. For this to work, BOTH and must be exit objects. If is an exit, set its destination to . Two-way operation instead sets the destination to the *locations* of the respective given arguments. The second form (a lone =) sets the destination to None (same as the @unlink command) and the third form (without =) just shows the currently set destination. + @link - connect objects Usage: + @link[/switches] = + @link[/switches] = + @link[/switches] + + Switch: + twoway - connect two exits. For this to work, BOTH + and must be exit objects. If is an exit, set its destination to . Two-way operation + instead sets the destination to the *locations* of the respective given + arguments. + The second form (a lone =) sets the destination to None (same as the @unlink command) + and the third form (without =) just shows the currently set destination. @lock ~~~~~ @@ -390,7 +553,28 @@ module [ = ] or @lock[/switch] object/ Switch: del - delete given access type view - view lock associated with given access type (default) If no lockstring is given, shows all locks on object. Lockstring is on the form 'access_type:[NOT] func1(args)[ AND|OR][ NOT] func2(args) ...] Where func1, func2 ... valid lockfuncs with or without arguments. Separator expressions need not be capitalized. For example: 'get: id(25) or perm(Wizards)' The 'get' access_type is checked by the get command and will an object locked with this string will only be possible to pick up by Wizards or by object with id 25. You can add several access_types after oneanother by separating them by ';', i.e: 'get:id(25);delete:perm(Builders)' + lock - assign a lock definition to an object Usage: + @lock [ = ] + or + @lock[/switch] object/ + + Switch: + del - delete given access type + view - view lock associated with given access type (default) + + If no lockstring is given, shows all locks on + object. Lockstring is on the form + 'access_type:[NOT] func1(args)[ AND|OR][ NOT] func2(args) ...] + Where func1, func2 ... valid lockfuncs with or without arguments. + Separator expressions need not be capitalized. For example: + 'get: id(25) or perm(Wizards)' + The 'get' access_type is checked by the get command and will + an object locked with this string will only be possible to + pick up by Wizards or by object with id 25. + + You can add several access_types after oneanother by separating + them by ';', i.e: + 'get:id(25);delete:perm(Builders)' @mvattr ~~~~~~~ @@ -404,7 +588,13 @@ module / = / [,/,/,...] @mvattr[/switch] / = [,,,...] @mvattr[/switch] = / [,/,/,...] @mvattr[/switch] = [,,,...] Switches: copy - Don't delete the original after moving. Move an attribute from one object to one or more attributes on another object. If you don't supply a source object, yourself is used. + @mvattr - move attributes Usage: + @mvattr[/switch] / = / [,/,/,...] + @mvattr[/switch] / = [,,,...] + @mvattr[/switch] = / [,/,/,...] + @mvattr[/switch] = [,,,...] Switches: + copy - Don't delete the original after moving. Move an attribute from one object to one or more attributes on another object. If + you don't supply a source object, yourself is used. @name ~~~~~ @@ -418,7 +608,12 @@ module [;alias;alias..][:typeclass] [,[;alias;..][:typeclass]]] = Handles the creation of exits. If a destination is given, the exit will point there. The argument sets up an exit at the destination leading back to the current room. Destination name can be given both as a #dbref and a name, if that name is globally unique. + @open - create new exit + + Usage: + @open [;alias;alias..][:typeclass] [,[;alias;..][:typeclass]]] = Handles the creation of exits. If a destination is given, the exit + will point there. The argument sets up an exit at the + destination leading back to the current room. Destination name + can be given both as a #dbref and a name, if that name is globally + unique. @script ~~~~~~~ @@ -446,7 +648,18 @@ module [= ] Switches: start - start a previously added script stop - stop a previously added script Attaches the given script to the object and starts it. Script path can be given from the base location for scripts as given in settings. If stopping/starting an already existing script, the script's key can be given instead (if giving a path, *all* scripts with this path on will be affected). If no script name is given, all scripts on the object is affected (or displayed if no start/stop switch is set). + attach scripts Usage: + @script[/switch] [= ] + + Switches: + start - start a previously added script + stop - stop a previously added script Attaches the given script to the object and starts it. Script path + can be given from the base location for scripts as given in + settings. If stopping/starting an already existing script, the + script's key can be given instead (if giving a path, *all* scripts + with this path on will be affected). If no script name is given, + all scripts on the object is affected (or displayed if no start/stop + switch is set). @set ~~~~ @@ -460,7 +673,18 @@ module / = @set / = @set / Sets attributes on objects. The second form clears a previously set attribute while the last form inspects the current value of the attribute (if any). You can also set lists [...] and dicts ... on attributes with @set (but not nested combinations). Also note that such lists/dicts will always hold strings (never numbers). Use @py if you need to set arbitrary lists and dicts. + @set - set attributes Usage: + @set / = + @set / = + @set / + + Sets attributes on objects. The second form clears + a previously set attribute while the last form + inspects the current value of the attribute + (if any). You can also set lists [...] and dicts ... + on attributes with @set (but not nested combinations). Also + note that such lists/dicts will always hold strings (never numbers). + Use @py if you need to set arbitrary lists and dicts. @tel ~~~~ @@ -474,7 +698,13 @@ module =] Switches: quiet - don't inform the source and target locations about the move. Teleports an object somewhere. If no object is given we are teleporting ourselves. + teleport Usage: + @tel/switch [ =] Switches: + quiet - don't inform the source and target + locations about the move. + + Teleports an object somewhere. If no object is + given we are teleporting ourselves. @tunnel ~~~~~~~ @@ -488,7 +718,23 @@ module [= roomname[;alias;alias;...][:typeclass]] Switches: oneway - do not create an exit back to the current location tel - teleport to the newly created room Example: @tunnel n @tunnel n = house;mike's place;green building This is a simple way to build using pre-defined directions: wn,ne,e,se,s,sw,w,nwn (north, northeast etc) wu,dn (up and down) wi,on (in and out) The full names (north, in, southwest, etc) will always be put as main name for the exit, using the abbreviation as an alias (so an exit will always be able to be used with both "north" as well as "n" for example). Opposite directions will automatically be created back from the new room unless the /oneway switch is given. For more flexibility and power in creating rooms, use @dig. + dig in often-used directions Usage: + @tunnel[/switch] [= roomname[;alias;alias;...][:typeclass]] Switches: + oneway - do not create an exit back to the current location + tel - teleport to the newly created room Example: + @tunnel n + @tunnel n = house;mike's place;green building + + This is a simple way to build using pre-defined directions: + wn,ne,e,se,s,sw,w,nwn (north, northeast etc) + wu,dn (up and down) + wi,on (in and out) + The full names (north, in, southwest, etc) will always be put as + main name for the exit, using the abbreviation as an alias (so an + exit will always be able to be used with both "north" as well as + "n" for example). Opposite directions will automatically be + created back from the new room unless the /oneway switch is given. + For more flexibility and power in creating rooms, use @dig. @typeclass ~~~~~~~~~~ @@ -502,7 +748,23 @@ module [= ] @type '' @parent '' Switch: reset - clean out *all* the attributes on the object - basically making this a new clean object. force - change to the typeclass also if the object already has a typeclass of the same name. Example: @type button = examples.red_button.RedButton Sets an object's typeclass. The typeclass must be identified by its location using python dot-notation pointing to the correct module and class. If no typeclass is given (or a wrong typeclass is given), the object will be set to the default typeclass. The location of the typeclass module is searched from the default typeclass directory, as defined in the server settings. + @typeclass - set object typeclass Usage: + @typclass[/switch] [= ] + @type '' + @parent '' Switch: + reset - clean out *all* the attributes on the object - + basically making this a new clean object. + force - change to the typeclass also if the object + already has a typeclass of the same name. + Example: + @type button = examples.red_button.RedButton + + Sets an object's typeclass. The typeclass must be identified + by its location using python dot-notation pointing to the correct + module and class. If no typeclass is given (or a wrong typeclass + is given), the object will be set to the default typeclass. + The location of the typeclass module is searched from + the default typeclass directory, as defined in the server settings. @unlink ~~~~~~~ @@ -516,7 +778,9 @@ module Unlinks an object, for example an exit, disconnecting it from whatever it was connected to. + @unlink - unconnect objects Usage: + @unlink Unlinks an object, for example an exit, disconnecting + it from whatever it was connected to. @wipe ~~~~~ @@ -530,7 +794,11 @@ module [/attribute[/attribute...]] Example: @wipe box @wipe box/colour Wipes all of an object's attributes, or optionally only those matching the given attribute-wildcard search string. + @wipe - clears attributes Usage: + @wipe [/attribute[/attribute...]] Example: + @wipe box + @wipe box/colour Wipes all of an object's attributes, or optionally only those + matching the given attribute-wildcard search string. Comms ----- @@ -550,7 +818,9 @@ module = [:reason] Switches: quiet - don't notify the channel Kicks a player or object from a channel you control. + @cboot Usage: + @cboot[/quiet] = [:reason] Switches: + quiet - don't notify the channel Kicks a player or object from a channel you control. @ccreate ~~~~~~~~ @@ -564,7 +834,10 @@ module [;alias;alias...] = description Creates a new channel owned by you. + @ccreate + channelcreate + Usage: + @ccreate [;alias;alias...] = description Creates a new channel owned by you. @cdesc ~~~~~~ @@ -578,7 +851,9 @@ module = Changes the description of the channel as shown in channel lists. + @cdesc - set channel description Usage: + @cdesc = Changes the description of the channel as shown in + channel lists. @cdestroy ~~~~~~~~~ @@ -592,7 +867,8 @@ module Destroys a channel that you control. + @cdestroy Usage: + @cdestroy Destroys a channel that you control. @cemit ~~~~~~ @@ -606,7 +882,13 @@ module = Switches: noheader - don't show the [channel] header before the message sendername - attach the sender's name before the message quiet - don't echo the message back to sender Allows the user to broadcast a message over a channel as long as they control it. It does not show the user's name unless they provide the /sendername switch. + @cemit - send a message to channel Usage: + @cemit[/switches] = Switches: + noheader - don't show the [channel] header before the message + sendername - attach the sender's name before the message + quiet - don't echo the message back to sender Allows the user to broadcast a message over a channel as long as + they control it. It does not show the user's name unless they + provide the /sendername switch. @channels ~~~~~~~~~ @@ -621,7 +903,11 @@ module [= ] Changes the lock access restrictions of a channel. If no lockstring was given, view the current lock definitions. + @cset - changes channel access restrictions + + Usage: + @cset [= ] Changes the lock access restrictions of a channel. If no + lockstring was given, view the current lock definitions. @cwho ~~~~~ @@ -649,7 +939,10 @@ module List who is connected to a given channel you have access to. + @cwho + + Usage: + @cwho List who is connected to a given channel you have access to. @imc2chan ~~~~~~~~~ @@ -664,7 +957,17 @@ module = Switches: /disconnect - this clear the imc2 connection to the channel. /remove - " /list - show all imc2<->evennia mappings Example: @imc2chan myimcchan = ievennia Connect an existing evennia channel to a channel on an IMC2 network. The network contact information is defined in settings and should already be accessed at this point. Use @imcchanlist to see available IMC channels. + imc2chan - link an evennia channel to imc2 Usage: + @imc2chan[/switches] = Switches: + /disconnect - this clear the imc2 connection to the channel. + /remove - " + /list - show all imc2<->evennia mappings Example: + @imc2chan myimcchan = ievennia + + Connect an existing evennia channel to a channel on an IMC2 + network. The network contact information is defined in settings and + should already be accessed at this point. Use @imcchanlist to see + available IMC channels. @imcinfo ~~~~~~~~ @@ -679,7 +982,17 @@ module - whois info about a remote player Switches for @imcinfo: channels - as @imcchanlist (default) games or muds - as @imclist whois - as @imcwhois (requires an additional argument) update - force an update of all lists Shows lists of games or channels on the IMC2 network. + imcinfo - package of imc info commands Usage: + @imcinfo[/switches] + @imcchanlist - list imc2 channels + @imclist - list connected muds + @imcwhois - whois info about a remote player Switches for @imcinfo: + channels - as @imcchanlist (default) + games or muds - as @imclist + whois - as @imcwhois (requires an additional argument) + update - force an update of all lists + + Shows lists of games or channels on the IMC2 network. @irc2chan ~~~~~~~~~ @@ -694,7 +1007,16 @@ module = <#irchannel> Switches: /disconnect - this will delete the bot and remove the irc connection to the channel. /remove - " /list - show all irc<->evennia mappings Example: @irc2chan myircchan = irc.dalnet.net 6667 myevennia-channel evennia-bot This creates an IRC bot that connects to a given IRC network and channel. It will relay everything said in the evennia channel to the IRC channel and vice versa. The bot will automatically connect at server start, so this comman need only be given once. The /disconnect switch will permanently delete the bot. To only temporarily deactivate it, use the @services command instead. + @irc2chan - link evennia channel to an IRC channel Usage: + @irc2chan[/switches] = <#irchannel> Switches: + /disconnect - this will delete the bot and remove the irc connection to the channel. + /remove - " + /list - show all irc<->evennia mappings Example: + @irc2chan myircchan = irc.dalnet.net 6667 myevennia-channel evennia-bot This creates an IRC bot that connects to a given IRC network and channel. It will + relay everything said in the evennia channel to the IRC channel and vice versa. The + bot will automatically connect at server start, so this comman need only be given once. + The /disconnect switch will permanently delete the bot. To only temporarily deactivate it, + use the @services command instead. addcom ~~~~~~ @@ -708,7 +1030,13 @@ addcom :: - addcom - subscribe to a channel with optional alias Usage: addcom [alias=] Joins a given channel. If alias is given, this will allow you to refer to the channel by this alias rather than the full channel name. Subsequent calls of this command can be used to add multiple aliases to an already joined channel. + addcom - subscribe to a channel with optional alias Usage: + addcom [alias=] + + Joins a given channel. If alias is given, this will allow you to + refer to the channel by this alias rather than the full channel + name. Subsequent calls of this command can be used to add multiple + aliases to an already joined channel. allcom ~~~~~~ @@ -722,7 +1050,10 @@ allcom :: - allcom - operate on all channels Usage: allcom [on | off | who | destroy] Allows the user to universally turn off or on all channels they are on, as well as perform a 'who' for all channels they are on. Destroy deletes all channels that you control. Without argument, works like comlist. + allcom - operate on all channels Usage: + allcom [on | off | who | destroy] Allows the user to universally turn off or on all channels they are on, + as well as perform a 'who' for all channels they are on. Destroy deletes + all channels that you control. Without argument, works like comlist. delcom ~~~~~~ @@ -736,7 +1067,10 @@ delcom :: - delcom - unsubscribe from channel or remove channel alias Usage: delcom If the full channel name is given, unsubscribe from the channel. If an alias is given, remove the alias but don't unsubscribe. + delcom - unsubscribe from channel or remove channel alias Usage: + delcom If the full channel name is given, unsubscribe from the + channel. If an alias is given, remove the alias but don't + unsubscribe. imctell ~~~~~~~ @@ -750,7 +1084,10 @@ imctell :: - imctell - send a page to a remote IMC player Usage: imctell User@MUD = imcpage " Sends a page to a user on a remote MUD, connected over IMC2. + imctell - send a page to a remote IMC player Usage: + imctell User@MUD = + imcpage " Sends a page to a user on a remote MUD, connected + over IMC2. page ~~~~ @@ -764,7 +1101,15 @@ page :: - page - send private message Usage: page[/switches] [,,... = ] tell '' page Switch: last - shows who you last messaged list - show your last of tells/pages (default) Send a message to target user (if online). If no argument is given, you will get a list of your latest messages. + page - send private message Usage: + page[/switches] [,,... = ] + tell '' + page Switch: + last - shows who you last messaged + list - show your last of tells/pages (default) + + Send a message to target user (if online). If no + argument is given, you will get a list of your latest messages. General ------- @@ -784,7 +1129,17 @@ module ] Switches: clear - clear your custom encoding This sets the text encoding for communicating with Evennia. This is mostly an issue only if you want to use non-ASCII characters (i.e. letters/symbols not found in English). If you see that your characters look strange (or you get encoding errors), you should use this command to set the server encoding to be the same used in your client program. Common encodings are utf-8 (default), latin-1, ISO-8859-1 etc. If you don't submit an encoding, the current encoding will be displayed instead. + encoding - set a custom text encoding Usage: + @encoding/switches [] Switches: + clear - clear your custom encoding + This sets the text encoding for communicating with Evennia. This is mostly an issue only if + you want to use non-ASCII characters (i.e. letters/symbols not found in English). If you see + that your characters look strange (or you get encoding errors), you should use this command + to set the server encoding to be the same used in your client program. + + Common encodings are utf-8 (default), latin-1, ISO-8859-1 etc. + + If you don't submit an encoding, the current encoding will be displayed instead. @ic ~~~ @@ -798,7 +1153,15 @@ module Go in-character (IC) as a given Character. This will attempt to "become" a different object assuming you have the right to do so. You cannot become an object that is already controlled by another player. In principle can be any in-game object as long as you have access right to puppet it. + Switch control to an object + + Usage: + @ic + + Go in-character (IC) as a given Character. This will attempt to "become" a different object assuming you have + the right to do so. You cannot become an object that is already + controlled by another player. In principle can be + any in-game object as long as you have access right to puppet it. @ooc ~~~~ @@ -812,7 +1175,12 @@ module = Changes your password. Make sure to pick a safe one. + @password - set your password Usage: + @password = Changes your password. Make sure to pick a safe one. @quit ~~~~~ @@ -840,7 +1209,8 @@ module Lets you drop an object from your inventory into the location you are currently in. + drop Usage: + drop + + Lets you drop an object from your inventory into the + location you are currently in. get ~~~ @@ -882,7 +1258,11 @@ get :: - get Usage: get Picks up an object from your location and puts it in your inventory. + get Usage: + get + + Picks up an object from your location and puts it in + your inventory. help ~~~~ @@ -896,7 +1276,11 @@ help :: - The main help command Usage: help help list help all This will search for help on commands and other topics related to the game. + The main help command Usage: + help + help list + help all This will search for help on commands and other + topics related to the game. help ~~~~ @@ -910,7 +1294,11 @@ help :: - The main help command Usage: help help list help all This will search for help on commands and other topics related to the game. + The main help command Usage: + help + help list + help all This will search for help on commands and other + topics related to the game. home ~~~~ @@ -924,7 +1312,8 @@ home :: - home Usage: home Teleports the player to their home. + home Usage: + home Teleports the player to their home. inventory ~~~~~~~~~ @@ -938,7 +1327,11 @@ inventory :: - inventory Usage: inventory inv Shows a player's inventory. + inventory Usage: + inventory + inv + + Shows a player's inventory. look ~~~~ @@ -952,7 +1345,10 @@ look :: - look Usage: look look look * Observes your location or objects in your vicinity. + look Usage: + look + look + look * Observes your location or objects in your vicinity. look ~~~~ @@ -966,7 +1362,11 @@ look :: - ooc look Usage: look This is an OOC version of the look command. Since a Player doesn't have an in-game existence, there is no concept of location or "self". If we are controlling a character, pass control over to normal look. + ooc look Usage: + look This is an OOC version of the look command. Since a + Player doesn't have an in-game existence, there is no + concept of location or "self". If we are controlling + a character, pass control over to normal look. nick ~~~~ @@ -980,7 +1380,26 @@ nick :: - Define a personal alias/nick Usage: nick[/switches] = [] alias '' Switches: object - alias an object player - alias a player clearall - clear all your aliases list - show all defined aliases If no switch is given, a command alias is created, used to replace strings before sending the command. Give an empty right-hand side to clear the nick Creates a personal nick for some in-game object or string. When you enter that string, it will be replaced with the alternate string. The switches dictate in what situations the nick is checked and substituted. If string is None, the alias (if it exists) will be cleared. Obs - no objects are actually changed with this command, if you want to change the inherent aliases of an object, use the @alias command instead. + Define a personal alias/nick Usage: + nick[/switches] = [] + alias '' Switches: + object - alias an object + player - alias a player + clearall - clear all your aliases + list - show all defined aliases + + If no switch is given, a command alias is created, used + to replace strings before sending the command. Give an empty + right-hand side to clear the nick + + Creates a personal nick for some in-game object or + string. When you enter that string, it will be replaced + with the alternate string. The switches dictate in what + situations the nick is checked and substituted. If string + is None, the alias (if it exists) will be cleared. + Obs - no objects are actually changed with this command, + if you want to change the inherent aliases of an object, + use the @alias command instead. pose ~~~~ @@ -994,7 +1413,13 @@ pose :: - pose - strike a pose Usage: pose pose's Example: pose is standing by the wall, smiling. -> others will see: Tom is standing by the wall, smiling. Describe an script being taken. The pose text will automatically begin with your name. + pose - strike a pose Usage: + pose + pose's Example: + pose is standing by the wall, smiling. + -> others will see: + Tom is standing by the wall, smiling. Describe an script being taken. The pose text will + automatically begin with your name. say ~~~ @@ -1008,7 +1433,10 @@ say :: - say Usage: say Talk to those in your current location. + say Usage: + say + + Talk to those in your current location. who ~~~ @@ -1022,7 +1450,10 @@ who :: - who Usage: who doing Shows who is currently online. Doing is an alias that limits info also for those with all permissions. + who Usage: + who + doing Shows who is currently online. Doing is an alias that limits info + also for those with all permissions. System ------ @@ -1042,7 +1473,10 @@ module ] Gives statictics on objects in database as well as a list of latest objects in database. If not given, defaults to 10. + Give a summary of object types in database Usage: + @objects [] Gives statictics on objects in database as well as + a list of latest objects in database. If not + given, defaults to 10. @ps ~~~ @@ -1056,7 +1490,10 @@ module In this limited python environment, there are a few variables made available to give access to the system. available_vars: 'self','me' : caller 'here' : caller.location 'obj' : dummy obj instance 'script': dummy script instance 'config': dummy conf instance 'ObjectDB' : ObjectDB class 'ScriptDB' : ScriptDB class 'ServerConfig' ServerConfig class only two variables are defined: 'self'/'me' which refers to one's own object, and 'here' which refers to self's current location. + Execute a snippet of python code Usage: + @py In this limited python environment, there are a + few variables made available to give access to + the system. available_vars: 'self','me' : caller + 'here' : caller.location + 'obj' : dummy obj instance + 'script': dummy script instance + 'config': dummy conf instance + 'ObjectDB' : ObjectDB class + 'ScriptDB' : ScriptDB class + 'ServerConfig' ServerConfig class + only two + variables are defined: 'self'/'me' which refers to one's + own object, and 'here' which refers to self's current + location. @reload ~~~~~~~ @@ -1084,7 +1535,10 @@ module ] Switches: stop - stops an existing script kill - kills a script - without running its cleanup hooks validate - run a validation on the script(s) If no switches are given, this command just views all active scripts. The argument can be either an object, at which point it will be searched for all scripts defined on it, or an script name or dbref. For using the /stop switch, a unique script dbref is required since whole classes of scripts often have the same name. + Operate on scripts. Usage: + @scripts[/switches] [] + + Switches: + stop - stops an existing script + kill - kills a script - without running its cleanup hooks + validate - run a validation on the script(s) If no switches are given, this command just views all active + scripts. The argument can be either an object, at which point it + will be searched for all scripts defined on it, or an script name + or dbref. For using the /stop switch, a unique script dbref is + required since whole classes of scripts often have the same name. @serverload ~~~~~~~~~~~ @@ -1126,7 +1594,8 @@ module Switches: list - shows all available services (default) start - activates a service stop - stops a service Service management system. Allows for the listing, starting, and stopping of services. If no switches are given, services will be listed. + @service - manage services Usage: + @service[/switch] Switches: + list - shows all available services (default) + start - activates a service + stop - stops a service + + Service management system. Allows for the listing, + starting, and stopping of services. If no switches + are given, services will be listed. @shutdown ~~~~~~~~~ @@ -1154,7 +1631,8 @@ module Use the create command to first create an account before logging in. + Connect to the game. Usage (at login screen): + connect + + Use the create command to first create an account before logging in. create ~~~~~~ @@ -1216,7 +1701,8 @@ create :: - Create a new account. Usage (at login screen): create "playername" This creates a new player account. + Create a new account. Usage (at login screen): + create "playername" This creates a new player account. help ~~~~ @@ -1230,7 +1716,8 @@ help :: - This is an unconnected version of the help command, for simplicity. It shows a pane or info. + This is an unconnected version of the help command, + for simplicity. It shows a pane or info. look ~~~~ @@ -1244,7 +1731,8 @@ look :: - This is an unconnected version of the look command for simplicity. All it does is re-show the connect screen. + This is an unconnected version of the look command for simplicity. + All it does is re-show the connect screen. quit ~~~~ @@ -1258,5 +1746,7 @@ quit :: - We maintain a different version of the quit command here for unconnected players for the sake of simplicity. The logged in version is a bit more complicated. + We maintain a different version of the quit command + here for unconnected players for the sake of simplicity. The logged in + version is a bit more complicated. diff --git a/docs/sphinx/source/wiki/DirectoryOverview.rst b/docs/sphinx/source/wiki/DirectoryOverview.rst index d9ff313bdc..20536cc309 100644 --- a/docs/sphinx/source/wiki/DirectoryOverview.rst +++ b/docs/sphinx/source/wiki/DirectoryOverview.rst @@ -61,7 +61,24 @@ the server. game/ evennia.py - manage.py gamesrc/ commands/ basecommand.py basecmdset.py examples/ cmdset_red_button.py scripts/ basescript.py examples/ red_button_sripts.py objects/ baseobjects.py examples/ red_button.py world/ examples/ batch_cmds.ev batch_code.py + manage.py gamesrc/ + commands/ + basecommand.py + basecmdset.py + examples/ + cmdset_red_button.py + scripts/ + basescript.py + examples/ + red_button_sripts.py + objects/ + baseobjects.py + examples/ + red_button.py + world/ + examples/ + batch_cmds.ev + batch_code.py ``game/gamesrc/`` ~~~~~~~~~~~~~~~~~ @@ -137,7 +154,17 @@ bugs or features missing, file a bug report or send us a message. :: src/ - settings_defaults.py commands/ comms/ help/ objects/ locks/ players/ scripts/ server/ typeclasses/ utils/ web/ + settings_defaults.py commands/ + comms/ + help/ + objects/ + locks/ + players/ + scripts/ + server/ + typeclasses/ + utils/ + web/ Most of the folders in ``src/`` are technically "Django apps", identified by containing a file ``models.py`` and usually diff --git a/docs/sphinx/source/wiki/EvenniaDevel.rst b/docs/sphinx/source/wiki/EvenniaDevel.rst index 5c26a3ea8c..aa0510a95c 100644 --- a/docs/sphinx/source/wiki/EvenniaDevel.rst +++ b/docs/sphinx/source/wiki/EvenniaDevel.rst @@ -116,7 +116,9 @@ Example of new command definition: :: - class CmdTest(Command): def func(self): self.caller.msg("This is the test!") + class CmdTest(Command): + def func(self): + self.caller.msg("This is the test!") Events + States -> Scripts -------------------------- @@ -262,14 +264,16 @@ just do: :: - obj.db.attr = value value = obj.db.attr + obj.db.attr = value + value = obj.db.attr And for storing something non-persistently (stored only until the server reboots) you can just do :: - obj.attr = value value = obj.attr + obj.attr = value + value = obj.attr The last example may sound trivial, but it's actually impossible to do in trunk since django objects are not guaranteed to remain the same diff --git a/docs/sphinx/source/wiki/ExecutePythonCode.rst b/docs/sphinx/source/wiki/ExecutePythonCode.rst index 6ecd3a5377..a16414d974 100644 --- a/docs/sphinx/source/wiki/ExecutePythonCode.rst +++ b/docs/sphinx/source/wiki/ExecutePythonCode.rst @@ -10,7 +10,8 @@ entrust to just anybody. :: - @py 1+2 <<< 3 + @py 1+2 + <<< 3 Available variables ------------------- @@ -36,7 +37,8 @@ found in ``src/utils/utils.py``: :: - @py from src.utils import utils; utils.time_format(33333) <<< Done. + @py from src.utils import utils; utils.time_format(33333) + <<< Done. Note that we didn't get any return value, all we where told is that the code finished executing without error. This is often the case in more @@ -46,7 +48,9 @@ system to echo it to us explicitly with ``self.msg()``. :: - @py from src.utils import utils; self.msg(utils.time_format(33333)) 09:15 <<< Done. + @py from src.utils import utils; self.msg(utils.time_format(33333)) + 09:15 + <<< Done. If you were to use Python's standard ``print``, you will see the result in your current ``stdout`` (your terminal by default), *if* you are @@ -63,7 +67,10 @@ Locating an object is best done using ``self.search()``: :: - @py self.search("red_ball") <<< Ball @py self.search("red_ball").db.color = "red" <<< Done. @py self.search("red_ball").db.color <<< red + @py self.search("red_ball") + <<< Ball @py self.search("red_ball").db.color = "red" + <<< Done. @py self.search("red_ball").db.color + <<< red ``self.search()`` is by far the most used case, but you can also search other database tables for other Evennia entities like scripts or @@ -72,7 +79,8 @@ entries found in ``src.utils.search``. :: - @py from src.utils import search; self.msg(search.scripts("sys_game_time")) <<< [] + @py from src.utils import search; self.msg(search.scripts("sys_game_time")) + <<< [] You can also use the database model managers directly (accessible through the ``objects`` properties of database models). This is a bit @@ -81,7 +89,8 @@ search methods defined in each manager. :: - @py ScriptDB.objects.script_search("sys_game_time") <<< [] + @py ScriptDB.objects.script_search("sys_game_time") + <<< [] (Note that since this second example becomes a simple statement, we don't have to wrap it in ``self.msg()`` to get the output). If you want @@ -92,7 +101,8 @@ contents of the database using normal Django query operations: :: - @py ConfigValue.objects.all() <<< [, , ...] + @py ConfigValue.objects.all() + <<< [, , ...] In doing so however, keep in mind the difference between `Typeclasses and Database Objects `_: Using the search commands in @@ -104,7 +114,13 @@ most situations. :: - # this uses Evennia's manager method get_id(). # It returns a Character typeclass instance @py ObjectDB.objects.get_id(1).__class__ <<< Character# this uses the standard Django get() query. # It returns a django database model instance. @py ObjectDB.objects.get(id=1).__class__ <<< + # this uses Evennia's manager method get_id(). + # It returns a Character typeclass instance + @py ObjectDB.objects.get_id(1).__class__ + <<< Character# this uses the standard Django get() query. + # It returns a django database model instance. + @py ObjectDB.objects.get(id=1).__class__ + <<< Running a Python Parser outside the game ======================================== @@ -129,5 +145,8 @@ tab-completion and ``__doc__``-string reading. :: - $ python manage.py shellIPython 0.10 -- An enhanced Interactive Python ...In [1]: from src.objects.models import ObjectDB In [2]: ObjectDB.objects.all() Out[3]: [, , ...] + $ python manage.py shellIPython 0.10 -- An enhanced Interactive Python + ...In [1]: from src.objects.models import ObjectDB + In [2]: ObjectDB.objects.all() + Out[3]: [, , ...] diff --git a/docs/sphinx/source/wiki/GettingStarted.rst b/docs/sphinx/source/wiki/GettingStarted.rst index 094a1f82de..9559b831af 100644 --- a/docs/sphinx/source/wiki/GettingStarted.rst +++ b/docs/sphinx/source/wiki/GettingStarted.rst @@ -288,14 +288,18 @@ isolated new folder *mudenv*: :: - python virtualenv mudenv --no-site-packages cd mudenv + python virtualenv mudenv --no-site-packages + cd mudenv Now we should be in our new directory *mudenv*. Next we activate the virtual environment in here. :: - # for Linux: source bin/activate # for Windows: \bin\activate.bat + # for Linux: + source bin/activate + # for Windows: + \bin\activate.bat In here you can play around and install python packages of any version without affecting your normal system installation at all. Next we get diff --git a/docs/sphinx/source/wiki/HelpSystem.rst b/docs/sphinx/source/wiki/HelpSystem.rst index 9cc589d651..8802a70425 100644 --- a/docs/sphinx/source/wiki/HelpSystem.rst +++ b/docs/sphinx/source/wiki/HelpSystem.rst @@ -48,7 +48,16 @@ Example (from a module with command definitions): :: - class CmdMyCmd(Command): """ mycmd - my very own command Usage: mycmd[/switches] Switches: test - test the command run - do something else This is my own command that does things to you when you supply it with arguments. """ ... help_category = "Building" ... + class CmdMyCmd(Command): + """ + mycmd - my very own command Usage: + mycmd[/switches] Switches: + test - test the command + run - do something else This is my own command that does things to you when you + supply it with arguments. """ + ... + help_category = "Building" + ... So the text at the very top of the command class definition is the class' ``__doc__``-string and what will be shown to users looking for @@ -87,7 +96,10 @@ You can create new help entries in code by using :: - from src.utils import create entry = create.create_help_entry("emote", "Emoting is important because ...", category="Roleplaying", locks="view:all()"): + from src.utils import create + entry = create.create_help_entry("emote", + "Emoting is important because ...", + category="Roleplaying", locks="view:all()"): From inside the game those with the right permissions can use the ``@sethelp`` command to add and modify help entries. diff --git a/docs/sphinx/source/wiki/IRC.rst b/docs/sphinx/source/wiki/IRC.rst index 0cd7c7ea23..33cbc92e31 100644 --- a/docs/sphinx/source/wiki/IRC.rst +++ b/docs/sphinx/source/wiki/IRC.rst @@ -85,7 +85,8 @@ Write something in the Evennia channel *irc*. :: - irc Hello, World! [irc] Anna: Hello, World! + irc Hello, World! + [irc] Anna: Hello, World! If you are viewing your IRC channel with a separate IRC client you should see your text appearing there, spoken by the bot: diff --git a/docs/sphinx/source/wiki/Internationalization.rst b/docs/sphinx/source/wiki/Internationalization.rst index a4f7f17a91..904b74680d 100644 --- a/docs/sphinx/source/wiki/Internationalization.rst +++ b/docs/sphinx/source/wiki/Internationalization.rst @@ -22,7 +22,8 @@ your ``game/settings.py`` file: :: - USE_I18N = True LANGUAGE_CODE = 'en' + USE_I18N = True + LANGUAGE_CODE = 'en' Here ``'en'`` should be changed to the abbreviation for one of the supported languages found in ``locale/``. Restart the server to activate diff --git a/docs/sphinx/source/wiki/Locks.rst b/docs/sphinx/source/wiki/Locks.rst index 357ebd40d4..c9b2b1c875 100644 --- a/docs/sphinx/source/wiki/Locks.rst +++ b/docs/sphinx/source/wiki/Locks.rst @@ -54,7 +54,9 @@ how it would (and do) look from inside the ``@delete`` command: :: - if not obj.access(accessing_obj, 'delete'): accessing_obj.msg("Sorry, you may not delete that.") return + if not obj.access(accessing_obj, 'delete'): + accessing_obj.msg("Sorry, you may not delete that.") + return Defining locks -------------- @@ -77,7 +79,9 @@ some much nicer examples: :: - delete:id(34) # only allow obj #34 to delete edit:all() # let everyone edit get: not attr(very_weak) or perm(Wizard) # only those who are not "very_weak" or are Wizards may pick this up + delete:id(34) # only allow obj #34 to delete + edit:all() # let everyone edit + get: not attr(very_weak) or perm(Wizard) # only those who are not "very_weak" or are Wizards may pick this up So, a lockstring consists of the type of restriction (the ``access_type``), a colon (``:``) and then a list of function calls that @@ -174,7 +178,11 @@ appear as extra arguments. :: - # A simple example lock function. Called with e.g. id(34)def id(accessing_obj, accessed_obj, *args, **kwargs): if args: wanted_id = args[0] return accessing_obj.id == wanted_id return False + # A simple example lock function. Called with e.g. id(34)def id(accessing_obj, accessed_obj, *args, **kwargs): + if args: + wanted_id = args[0] + return accessing_obj.id == wanted_id + return False (Using the ``*`` and ``**`` syntax causes Python to magically put all extra arguments into a list ``args``and all keyword arguments into a @@ -197,14 +205,9 @@ Some useful default lockfuncs (see lockfuncs.py for a full list): - ``attr(attrname, value)`` - checks so an attribute exists on accessing*object*and has the given value. - ``attr_gt(attrname, value)`` - checks so accessingobject has a value - larger (>) than the given value. -- ``attr_ge, attr_lt, attr_le, attr_ne`` - corresponding for > - - , <, < - ====== - - and !=. - + larger (``>``) than the given value. +- ``attr_ge, attr_lt, attr_le, attr_ne`` - corresponding for ``>=``, + ``<``, ``<=`` and ``!=``. - ``holds(objid)`` - checks so the accessing objects contains an object of given name or dbref. - ``pperm(perm)``, ``pid(num)/pdbref(num)`` - same as ``perm``, @@ -247,7 +250,11 @@ default permission hierarchy is as follows: :: - Immortals Wizards Builders PlayerHelpers Players # this is what all new Players start with by default + Immortals + Wizards + Builders + PlayerHelpers + Players # this is what all new Players start with by default The main use of this is that if you use the lock function ``perm()`` mentioned above, a lock check for a particular permission in the @@ -260,7 +267,8 @@ looked for is not in the hierarchy, an exact match is required. :: - obj1.permissions = ["Builders", "cool_guy"] obj2.locks.add("enter:perm_above(Players) and perm(cool_guy)")obj2.access(obj1, "enter") # this returns True! + obj1.permissions = ["Builders", "cool_guy"] + obj2.locks.add("enter:perm_above(Players) and perm(cool_guy)")obj2.access(obj1, "enter") # this returns True! Superusers ---------- @@ -330,7 +338,8 @@ other is an `Object `_ called ``box``. :: - > @create/drop box > @desc box = "This is a very big and heavy box." + > @create/drop box + > @desc box = "This is a very big and heavy box." We want to limit which objects can pick up this heavy box. Let's say that to do that we require the would-be lifter to to have an attribute @@ -349,7 +358,12 @@ this snippet: :: - if not obj.access(caller, 'get'): if obj.db.get_err_msg: caller.msg(obj.db.get_err_msg) else: caller.msg("You can't get that.") return + if not obj.access(caller, 'get'): + if obj.db.get_err_msg: + caller.msg(obj.db.get_err_msg) + else: + caller.msg("You can't get that.") + return So the ``get`` command looks for a lock with the type *get* (not so surprising). It also looks for an `Attribute `_ on the @@ -367,7 +381,7 @@ checks if attributes have a value greater than a given value. Luckily there is already such a one included in evennia (see ``src/permissions/lockfuncs.py``), called``attr_gt``. -So the lock string will look like this: "``get:attr_gt(strength, 50)``". +So the lock string will look like this: ``get:attr_gt(strength, 50)``. We put this on the box now: :: @@ -383,7 +397,9 @@ like this: :: - from src.utils import create box = create.create_object(None, key="box", locks="get:attr_gt(strength, 50)")# or, if we don't set the locks right awaybox.locks.add("get:attr_gt(strength, 50)")# set the attributesbox.db.desc = "This is a very big and heavy box." box.db.get_err_msg = "You are not strong enough to lift this box."# one heavy box, ready to withstand all but the strongest... + from src.utils import create + box = create.create_object(None, key="box", locks="get:attr_gt(strength, 50)")# or, if we don't set the locks right awaybox.locks.add("get:attr_gt(strength, 50)")# set the attributesbox.db.desc = "This is a very big and heavy box." + box.db.get_err_msg = "You are not strong enough to lift this box."# one heavy box, ready to withstand all but the strongest... On Django's permission system ============================= diff --git a/docs/sphinx/source/wiki/Nicks.rst b/docs/sphinx/source/wiki/Nicks.rst index 08f62cebe9..f89e2a42fd 100644 --- a/docs/sphinx/source/wiki/Nicks.rst +++ b/docs/sphinx/source/wiki/Nicks.rst @@ -83,7 +83,13 @@ checking, searches and conversion. :: - # A command/channel nick: object.nicks.add("greetjack", "tell Jack = Hello pal!")# An object nick: object.nicks.add("rose", "The red flower", nick_type="object")# An player nick: object.nicks("tom", "Tommy Hill", nick_type="player")# My own custom nick type (handled by my own game code somehow): object.nicks.add("hood", "The hooded man", nick_type="my_identsystem")# get back the translated nick: full_name = object.nicks.get("rose", nick_type="object")# delete a previous set nick object.nicks.del("rose", nick_type="object") + # A command/channel nick: + object.nicks.add("greetjack", "tell Jack = Hello pal!")# An object nick: + object.nicks.add("rose", "The red flower", nick_type="object")# An player nick: + object.nicks("tom", "Tommy Hill", nick_type="player")# My own custom nick type (handled by my own game code somehow): + object.nicks.add("hood", "The hooded man", nick_type="my_identsystem")# get back the translated nick: + full_name = object.nicks.get("rose", nick_type="object")# delete a previous set nick + object.nicks.del("rose", nick_type="object") In a command definition you can reach the nick handler through ``self.caller.nicks``. See the ``nick`` command in diff --git a/docs/sphinx/source/wiki/Objects.rst b/docs/sphinx/source/wiki/Objects.rst index 959d1930b7..58d9d3aa1f 100644 --- a/docs/sphinx/source/wiki/Objects.rst +++ b/docs/sphinx/source/wiki/Objects.rst @@ -19,7 +19,14 @@ Here's how to define a new Object typeclass in code: :: - from game.gamesrc.objects.baseobjects import Objectclass Rose(Object): """ This creates a simple rose object """ at_object_creation(self): "this is called only once, when object is first created" # add a persistent attribute 'desc' to object. self.db.desc = "This is a pretty rose with thorns." + from game.gamesrc.objects.baseobjects import Objectclass Rose(Object): + """ + This creates a simple rose object + """ + at_object_creation(self): + "this is called only once, when object is first created" + # add a persistent attribute 'desc' to object. + self.db.desc = "This is a pretty rose with thorns." Save your class to a module under ``game/gamesrc/objects``, say ``flowers.py``. Now you just need to point to the class *Rose* with the @@ -34,7 +41,8 @@ To create a new object in code, use the method :: - from src.utils import create new_rose = create.create_object("game.gamesrc.objects.flowers.Rose", key="MyRose") + from src.utils import create + new_rose = create.create_object("game.gamesrc.objects.flowers.Rose", key="MyRose") (You have to give the full path to the class in this case. ``create.create_object`` is a powerful function that should be used for diff --git a/docs/sphinx/source/wiki/Players.rst b/docs/sphinx/source/wiki/Players.rst index a47a50ae6b..4639e3b5f8 100644 --- a/docs/sphinx/source/wiki/Players.rst +++ b/docs/sphinx/source/wiki/Players.rst @@ -41,7 +41,15 @@ Here's how to define a new Player typeclass in code: :: - from src.players.player import Playerclass ConfigPlayer(Player): """ This creates a Player with some configuration options """ at_player_creation(self): "this is called only once, when player is first created" self.db.real_name = None # this is set later self.db.real_address = None # '' self.db.config_1 = True # default config self.db.config_2 = False # " self.db.config_3 = 1 # " # ... whatever our game needs to know + from src.players.player import Playerclass ConfigPlayer(Player): + """ + This creates a Player with some configuration options + """ + at_player_creation(self): + "this is called only once, when player is first created" self.db.real_name = None # this is set later + self.db.real_address = None # '' self.db.config_1 = True # default config + self.db.config_2 = False # " + self.db.config_3 = 1 # " # ... whatever our game needs to know There is no pre-made folder in ``game/gamesrc`` to store custom player typeclasses. Either make your own folder or store it in diff --git a/docs/sphinx/source/wiki/RemovingColour.rst b/docs/sphinx/source/wiki/RemovingColour.rst index 8612cfbaec..01884be95c 100644 --- a/docs/sphinx/source/wiki/RemovingColour.rst +++ b/docs/sphinx/source/wiki/RemovingColour.rst @@ -34,7 +34,10 @@ inheriting from ``game.gamesrc.objects.baseobjecs.Character``. :: - from game.gamesrc.objects.baseobjects import Characterclass ColourableCharacter(Character): at_object_creation(self): # set a colour config value self.db.config_colour = True + from game.gamesrc.objects.baseobjects import Characterclass ColourableCharacter(Character): + at_object_creation(self): + # set a colour config value + self.db.config_colour = True Above we set a simple config value as an `attribute `_. @@ -74,7 +77,11 @@ original. Here's how it could look: :: - from src.utils import ansimsg(self, message, from_obj=None, data=None): "our custom msg()" if not self.db.config_colour: message = ansi.parse_ansi(message, strip_ansi=True) self.dbobj.msg(message, from_obj, data) + from src.utils import ansimsg(self, message, from_obj=None, data=None): + "our custom msg()" + if not self.db.config_colour: + message = ansi.parse_ansi(message, strip_ansi=True) + self.dbobj.msg(message, from_obj, data) Above we create a custom version of the ``msg()`` method that cleans all ansi characters if the config value is not set to True. Once that's @@ -100,7 +107,22 @@ for configuration down the line). :: - from game.gamesrc.commands.basecommand import MuxCommandclass ConfigColourCmd(MuxCommand): """ Configures your colour Usage: @setcolour on|off This turns ansii-colours on/off. Default is on. """ key = "@setcolour" aliases = ["@setcolor"] def func(self): "Implements the command" if not self.args or not self.args in ("on", "off"): self.caller.msg("Usage: @setcolour on|off") return if self.args == "on": self.caller.db.config_colour = True else: self.caller.db.config_colour = False self.caller.msg("Colour was turned %s." % self.args) + from game.gamesrc.commands.basecommand import MuxCommandclass ConfigColourCmd(MuxCommand): + """ + Configures your colour Usage: + @setcolour on|off This turns ansii-colours on/off. + Default is on. + """ key = "@setcolour" + aliases = ["@setcolor"] def func(self): + "Implements the command" + if not self.args or not self.args in ("on", "off"): + self.caller.msg("Usage: @setcolour on|off") + return + if self.args == "on": + self.caller.db.config_colour = True + else: + self.caller.db.config_colour = False + self.caller.msg("Colour was turned %s." % self.args) Lastly, we make this command available to the user by adding it to the default command set. Easiest is to add it to the end of @@ -108,7 +130,14 @@ default command set. Easiest is to add it to the end of :: - from game.gamesrc.commands import configcmds class DefaultCmdSet(cmdset_default.DefaultCmdSet): key = "DefaultMUX" def at_cmdset_creation(self): super(DefaultCmdSet, self).at_cmdset_creation() self.add(configcmds.ConfigColourCmd()) + from game.gamesrc.commands import configcmds + class DefaultCmdSet(cmdset_default.DefaultCmdSet): + + key = "DefaultMUX" + + def at_cmdset_creation(self): + super(DefaultCmdSet, self).at_cmdset_creation() + self.add(configcmds.ConfigColourCmd()) When adding a new command to a cmdset like this you need to run the ``@reload`` command (or reboot the server). From here on out, your users diff --git a/docs/sphinx/source/wiki/Scripts.rst b/docs/sphinx/source/wiki/Scripts.rst index ed2fa6ca05..177d0e12f1 100644 --- a/docs/sphinx/source/wiki/Scripts.rst +++ b/docs/sphinx/source/wiki/Scripts.rst @@ -132,7 +132,24 @@ find longer descriptions of these in ``gamesrc/scripts/basescript.py``. :: import random - from game.gamesrc.scripts.basescript import Scriptclass Weather(Script): "Displays weather info. Meant to be attached to a room." def at_script_creation(self): "Called once, during initial creation" self.key = "weather_script" self.desc = "Gives random weather messages." self.interval = 60 * 5 # every 5 minutes self.persistent = True self.at_repeat(self): "called every self.interval seconds." rand = random.random() if rand < 0.5: weather = "A faint breeze is felt." elif rand < 0.7: weather = "Clouds sweep across the sky." else: weather = "There is a light drizzle of rain." # send this message to everyone inside the object this # script is attached to (likely a room) self.obj.msg_contents(weather) + from game.gamesrc.scripts.basescript import Scriptclass Weather(Script): + "Displays weather info. Meant to be attached to a room." def at_script_creation(self): + "Called once, during initial creation" + self.key = "weather_script" + self.desc = "Gives random weather messages." + self.interval = 60 * 5 # every 5 minutes + self.persistent = True self.at_repeat(self): + "called every self.interval seconds." + rand = random.random() + if rand < 0.5: + weather = "A faint breeze is felt." + elif rand < 0.7: + weather = "Clouds sweep across the sky." + else: + weather = "There is a light drizzle of rain." + # send this message to everyone inside the object this + # script is attached to (likely a room) + self.obj.msg_contents(weather) This is a simple weather script that we can put on an object. Every 5 minutes it will tell everyone inside that object how the weather is. diff --git a/docs/sphinx/source/wiki/SoftCode.rst b/docs/sphinx/source/wiki/SoftCode.rst index dae46f20ab..752bc7a80d 100644 --- a/docs/sphinx/source/wiki/SoftCode.rst +++ b/docs/sphinx/source/wiki/SoftCode.rst @@ -51,7 +51,8 @@ retrieved when emitting: :: - &HELLO_VALUE.D me=Hello World &HELLO_WORLD.C me=$hello:@pemit %#=[v(HELLO_VALUE.D)] + &HELLO_VALUE.D me=Hello World + &HELLO_WORLD.C me=$hello:@pemit %#=[v(HELLO_VALUE.D)] The v() function returns the HELLO\_VALUE.D attribute on the object that the command resides (``me``, which is yourself in this case). This diff --git a/docs/sphinx/source/wiki/StartStopReload.rst b/docs/sphinx/source/wiki/StartStopReload.rst index 4a20641a3e..cf3011369a 100644 --- a/docs/sphinx/source/wiki/StartStopReload.rst +++ b/docs/sphinx/source/wiki/StartStopReload.rst @@ -43,7 +43,8 @@ You can also start the two components one at a time. :: - python evennia.py start server python evennia.py start portal + python evennia.py start server + python evennia.py start portal Adding -i to either of these explicit commands will start that component in interactive mode so it logs to the terminal rather than to log file. @@ -84,7 +85,8 @@ A reset is equivalent to :: - python evennia.py stop server python evennia.py start server + python evennia.py stop server + python evennia.py start server Shutting down ------------- diff --git a/docs/sphinx/source/wiki/Typeclasses.rst b/docs/sphinx/source/wiki/Typeclasses.rst index 3616bd25a6..a6dcf99622 100644 --- a/docs/sphinx/source/wiki/Typeclasses.rst +++ b/docs/sphinx/source/wiki/Typeclasses.rst @@ -238,7 +238,8 @@ query). You can easily convert between them with ``dbobj.typeclass`` and :: - obj = ObjectDB.objects.get_id(1) # custom evennia manager method. This returns the typeclass. obj = ObjectDB.objects.get(1) # standard Django. Returns a Django model object. + obj = ObjectDB.objects.get_id(1) # custom evennia manager method. This returns the typeclass. + obj = ObjectDB.objects.get(1) # standard Django. Returns a Django model object. Even more important to know for Django affectionados: Evennia's custom methods return *lists* where you with normal Django methods would expect diff --git a/docs/sphinx/source/wiki/UnitTesting.rst b/docs/sphinx/source/wiki/UnitTesting.rst index 4e37f1fba0..b64a762a3c 100644 --- a/docs/sphinx/source/wiki/UnitTesting.rst +++ b/docs/sphinx/source/wiki/UnitTesting.rst @@ -57,7 +57,25 @@ Example of a ``TestCase`` class (inside a file ``tests.py``): :: - # testing a simple funciontry: # this is an optimized version only available in later Django versions from django.utils.unittest import TestCase except ImportError: # if the first fail, we use the old version from django.test import TestCase# the function we want to test from mypath import myfuncTestObj(unittest.TestCase): "This tests a function myfunc." def test_return_value(self): "test method. Makes sure return value is as expected." expected_return = "This is me being nice." actual_return = myfunc() # test self.assertEqual(expected_return, actual_return) def test_alternative_call(self): "test method. Calls with a keyword argument." expected_return = "This is me being baaaad." actual_return = myfunc(bad=True) # test self.assertEqual(expected_return, actual_return) + # testing a simple funciontry: + # this is an optimized version only available in later Django versions + from django.utils.unittest import TestCase + except ImportError: + # if the first fail, we use the old version + from django.test import TestCase# the function we want to test + from mypath import myfuncTestObj(unittest.TestCase): + "This tests a function myfunc." def test_return_value(self): + "test method. Makes sure return value is as expected." + expected_return = "This is me being nice." + actual_return = myfunc() + # test + self.assertEqual(expected_return, actual_return) + def test_alternative_call(self): + "test method. Calls with a keyword argument." + expected_return = "This is me being baaaad." + actual_return = myfunc(bad=True) + # test + self.assertEqual(expected_return, actual_return) The above example is very simplistic, but you should get the idea. Look at ``src/objects/tests.py`` for more realistic examples of tests. You diff --git a/docs/sphinx/wiki2rest/wiki2html.patch b/docs/sphinx/wiki2rest/wiki2html.patch new file mode 100644 index 0000000000..610de85c02 --- /dev/null +++ b/docs/sphinx/wiki2rest/wiki2html.patch @@ -0,0 +1,14 @@ +Index: wiki2html/lib/wiki_syntax.rb +=================================================================== +--- wiki2html/lib/wiki_syntax.rb (revision 1961) ++++ wiki2html/lib/wiki_syntax.rb (working copy) +@@ -227,7 +227,8 @@ + block + else + # remove newlines within normal (non-code) blocks of text +- "

" + block.gsub(/\n/, ' ') + "

" ++ #"

" + block.gsub(/\n/, ' ') + "

" ++ "

" + block + "

" + end + end.join + end diff --git a/docs/sphinx/wiki2rest/wiki2rest.py b/docs/sphinx/wiki2rest/wiki2rest.py index 7547c3819a..13b61c4cc9 100755 --- a/docs/sphinx/wiki2rest/wiki2rest.py +++ b/docs/sphinx/wiki2rest/wiki2rest.py @@ -11,6 +11,11 @@ # # This is a ruby program! Sorry, it was the best match I could find to do this. # So if you don't have ruby, you need that too. +# +# You also need to patch a bug in above program to make code snippets work. From the wiki2rest folder, +# apply the patch like this: +# +# patch -p0 -i wiki2html.patch # # 2) Install pandoc: #