[DIFF] adds ansi formatting to showme

Eliezer Flores <[email protected]> Sat, 14 Jan 2006 15:54:46 -0500
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
This adds an additional format parameter that allows one to specify the 
ansi attributes of the showme message. i.e

#showme {test} {reverse, bold, blue}
will show test (not the '# ' prefix though) in reverse, bold, blue style

it also include the posix path support for user folders that I submitted 
earlier.

Also, should it interest one, I added probability for support for 
uberactions (i.e. if the line match, you can assign a probability to 
script actually being sent) ... i.e.

#uberaction {jump} {#showme jumped} prob={50}
will send '#showme jumped' 50% of the time.

Index: lyntin40/lyntin/modules/tintincmds.py
===================================================================
RCS file: /cvsroot/lyntin/lyntin40/lyntin/modules/tintincmds.py,v
retrieving revision 1.25
diff -r1.25 tintincmds.py
10c10
< from lyntin import net, utils, engine, constants, config, exported, event
---
 > from lyntin import ansi, net, utils, engine, constants, config, 
exported, event
527a528,536
 >  
 >   There is an optional format for parameter which is comma-delimited 
list of
 >   ansi attributes. Valid ansi attributes (drawn from ansi.py) are:
 >    
 >     bold, underline, blink, reverse, black, red, green, yellow, blue, 
magenta,
 >     cyan, white, grey, light red, light green, light yellow, light blue,
 >     light magenta, light cyan, light white, b black, b red, b green, 
b yellow,
 >     b blue, b magenta, b cyan, b white or default
 >    
534a544,549
 >   txtformat = args["format"]
 >   if len(txtformat) > 0:
 >       input = "%s%s%s" % (ansi.get_color(txtformat),
 >                           input,
 >                           ansi.get_color("default"))
 >      
538c553
<
---
 >    
545c560,561
< commands_dict["showme"] = (showme_cmd, "input=", "limitparsing=0")
---
 > commands_dict["showme"] = (showme_cmd, "input= format=")
 > # commands_dict["showme"] = (showme_cmd, "input= format=", 
"limitparsing=0")
624a641,644
 >  
 >   Note: OS X and Unix users the user paths (~user or~/file) are now 
supported.
 >   It also defaults to the current user's folder if no path 
information is
 >   passed.
641a662,665
 >       # add support for ~ format for posix paths
 >       if os.name=="posix" and filename.startswith("~"):
 >         filename = os.path.expanduser(filename)
 >              


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click