Merge, with input and tweaks from discussion with lagos and Kelketek in irc.

This commit is contained in:
Griatch 2012-06-13 01:36:59 +02:00
commit 80da420ee7
3 changed files with 19 additions and 9 deletions

View file

@ -43,4 +43,8 @@ things you want from here into game/gamesrc and change them there.
* CharGen (Griatch 2011) - A simple Character creator and selector for * CharGen (Griatch 2011) - A simple Character creator and selector for
Evennia's ooc mode. Works well with the menu login contrib and Evennia's ooc mode. Works well with the menu login contrib and
is intended as a starting point for building a more full-featured is intended as a starting point for building a more full-featured
character creation system. character creation system.
* Evlang (Griatch 2012) - A heavily restricted version of Python for use
as a "softcode" language by Players in-game. Contains a complete
system with examples of objects and commands for coding.

View file

@ -48,9 +48,10 @@ Quick Example Install
This is a quick test-setup using the example objects and commands. This is a quick test-setup using the example objects and commands.
1) If you haven't already, make sure you are able to overload the 1) If you haven't already, make sure you are able to overload the
default cmdset: Copy game/gamesrc/commands/examples/cmdset.py up one level, default cmdset: Copy game/gamesrc/commands/examples/cmdset.py up
then change settings.CMDSET_DEFAULT to point to DefaultCmdSet in your newly copied module. one level, then change settings.CMDSET_DEFAULT to point to
Restart the server and check so the default commands still work. DefaultCmdSet in your newly copied module. Restart the server and
check so the default commands still work.
2) Import and add 2) Import and add
contrib.evlang.command.CmdCode contrib.evlang.command.CmdCode
and and
@ -86,9 +87,11 @@ There are a few "safe" objects made available out of the box.
caller - reference back to the one triggering the script caller - reference back to the one triggering the script
scripter - reference to the one creating the script (set by @code) scripter - reference to the one creating the script (set by @code)
There is also the 'evl' object that defines "safe" methods to use. There is also the 'evl' object that defines "safe" methods to use:
evl.msg(string, obj=None) # default is the send to caller evl.msg(string, obj=None) # default is the send to caller
evl.msg_contents(string, obj=None) # default is to send to all except caller evl.msg_contents(string, obj=None) # default is to send to all except caller
evl.msg_home(string, obj=None) # default is to send to self.location
delay(delay, function, *args, **kwargs) delay(delay, function, *args, **kwargs)
attr(obj, attrname=None, attrvalue=None, delete=False) # lock-checking attribute accesser attr(obj, attrname=None, attrvalue=None, delete=False) # lock-checking attribute accesser
list() # display all available methods on evl, with docstrings (including your custom additions) list() # display all available methods on evl, with docstrings (including your custom additions)
@ -101,9 +104,11 @@ try it.
Now look at the crate. :) Now look at the crate. :)
You can (in evlang) use evl.list() to get a list of all methods currently stored on the evl object. For testing, let's You can (in evlang) use evl.list() to get a list of all methods
use the same look slot on the crate again. But this time we'll use the /debug mode of @code, which means the script currently stored on the evl object. For testing, let's use the same
will be auto-run immediately and we don't have to look at the create to get a result when developing. look slot on the crate again. But this time we'll use the /debug mode
of @code, which means the script will be auto-run immediately and we
don't have to look at the create to get a result when developing.
@code/debug crate/look = evl.msg(evl.list()) @code/debug crate/look = evl.msg(evl.list())

View file

@ -108,7 +108,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
def _write(self, data): def _write(self, data):
"hook overloading the one used in plain telnet" "hook overloading the one used in plain telnet"
#print "_write (%s): %s" % (self.state, " ".join(str(ord(c)) for c in data)) #print "_write (%s): %s" % (self.state, " ".join(str(ord(c)) for c in data))
data = data.rstrip('\r\n') + '\r\n' data = data.replace('\n', '\r\n').replace('\r\r\n', '\r\n')
#data = data.replace('\n', '\r\n')
super(TelnetProtocol, self)._write(mccp_compress(self, data)) super(TelnetProtocol, self)._write(mccp_compress(self, data))
def sendLine(self, line): def sendLine(self, line):