> >> You are using a scripting language.. why not use python directly?
>
> > I just want to execute an small set of commands (PLAYSOUND, PLAYMUSIC,
> > WALKTO, PLAYERSAY, SLEEP and a couple more) ... do you think I can
> > write python code inside my object.exec (list attribute) loaded from a
> > f
En Tue, 12 Feb 2008 18:53:36 -0200, Santiago Romero <[EMAIL PROTECTED]>
escribió:
>> Dennis Kempin wrote:
>> You are using a scripting language.. why not use python directly?
>
> I just want to execute an small set of commands (PLAYSOUND, PLAYMUSIC,
> WALKTO, PLAYERSAY, SLEEP and a couple more) .
This is faster:
http://www.sromero.org/python/zx_parseexec.py
http://www.sromero.org/python/test.par
XD
--
http://mail.python.org/mailman/listinfo/python-list
And the rest of the code:
#
def ExecParser_Exec( exec_type, code, game, debug=0 ):
"""
Execute the previously "compiled" code:
"""
code_level = 0
#player = game.player
#world = game.world
# Take only opco
And the big functions:
I imagine that the following is HORRIBLE in the pythonic-vision and
surely can be rewriten with a single map+reduce+filter + 200 lambdas
functions X-D, but I come from C and any advice on how to implement my
"simple scripting language" without using lex or yacc is welcome
Before I reinvent the wheel, I'm going to post the code.
Feel free to give any advice, and think that I'm new to python, it's
only 1 month since I began programming in python "seriously" (up to
that moment, I wrote just a few log-text parsing system administration
scripts to speed up some old b
Santiago Romero wrote:
> Hi...
>
> I'm trying to guess how to access attributes of an existing object
> given the attribute name in a string. I mean:
>
> class Object:
> self.x = 12
> self.y = 20
> self.name = "blah"
>
> def ChangeAttribute( object, attribute, value ):
> # Insert
> > def ChangeAttribute( object, attribute, value ):
>help(setattr)
>
> Help on built-in function setattr in module __builtin__:
>
> setattr(...) setattr(object, name, value)
>
> Set a named attribute on an object; setattr(x, 'y', v) is
> equivalent to`x.y = v''.
and
> Gary Herron write:
> Yo
On 12 fév, 21:35, Dennis Kempin <[EMAIL PROTECTED]> wrote:
> Santiago Romero schrieb:
(snip - others already answered)
> > PS: I need it for a concrete case in a game scripting language I'm
> > writing, so that I can call functions like "CHANGE_PLAYER_VALUES( "x",
> > 100 )".
>
> You are using a sc
Santiago Romero schrieb:
> Hi...
>
> I'm trying to guess how to access attributes of an existing object
> given the attribute name in a string. I mean:
>
> class Object:
> self.x = 12
> self.y = 20
> self.name = "blah"
>
> def ChangeAttribute( object, attribute, value ):
> # Inse
Santiago Romero wrote:
> Hi...
>
> I'm trying to guess how to access attributes of an existing object
> given the attribute name in a string. I mean:
>
> class Object:
> self.x = 12
> self.y = 20
> self.name = "blah"
>
> def ChangeAttribute( object, attribute, value ):
> # Insert he
On Feb 12, 10:25 pm, Santiago Romero <[EMAIL PROTECTED]> wrote:
> Hi...
>
> I'm trying to guess how to access attributes of an existing object
> given the attribute name in a string. I mean:
>
> class Object:
> self.x = 12
> self.y = 20
> self.name = "blah"
>
> def ChangeAttribute( o
12 matches
Mail list logo