Get/Set event variables
Posted: Mon Jul 09, 2012 5:55 pm
Yesterday, I compiled a version of Source.Python to play arround with the direct access. That's a very cool thing, but I have suggestion.
At the moment we need to do the following to get/set an event variable:
So, my suggestion would be to change it so that we can use __getattr__() and/or __getitem__() and/or get() in order to get an event variable.
The same for setting an event variable. That would make it more easier, especially for beginners, because they don't differ between types.
At the moment we need to do the following to get/set an event variable:
Syntax: Select all
def player_disconnect(event):
# Get the player's steam ID
steamid = event.GetString('networkid')
# Set the reason to the steam ID
event.SetString('reason', steamid)
So, my suggestion would be to change it so that we can use __getattr__() and/or __getitem__() and/or get() in order to get an event variable.
The same for setting an event variable. That would make it more easier, especially for beginners, because they don't differ between types.