Re: using python

[email protected] Tue, 16 May 2006 18:25:06 +0200 (MEST)
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
> How do I get python statements to evaluate?  I use a lot of python vars
> but found I cant make a for or if statement because I am limited to 1
line. 
Iirc, I wrote a patch to the #@ command which allows multiple-line commands
just like in the python shell. I'll try to dig it up, but that might take
some time.

> #if {#@ 4 == 4} {#showme hi}
> But this is invalid even though by itself #@ 4 == 4 evalutates to true.
Sure - as far as i know, the lyntin commands don't have "return values", so
it would be pointless for any function to try to get something back from a
lyntin command it executed...

> Is it possible to use python variables in conditional statements?
Yes, with a slight patch. As you can see in the documentation for #if, all
it does is evaluating python expressions. It's somewhat like #@ with a "call
command if argument evaluates to true" clause, with the difference that it
evaluates in an empty namespace. If you change the eval() call in if_cmd(),
modules/tintincmds.py, to ,,eval(expr, globalsdict, localsdict)'' with the
two additional arguments being dictionaries of your choice (for example
advanced.execdictglobals, advanced.execdictlocals from module/advanced.py,
you would have to import that module first), it should work fine.

Best regards,
Tiger.

-- 
Mobile Internet - E-Mail und Internet immer und überall!
GMX zum Mitnehmen: http://www.gmx.net/de/go/pocketweb


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642