Page 1 of 1
How to start writing Python script for UrU
Posted: Sat Jun 28, 2008 1:20 pm
by Marcello
Hi all,
I am well voiced in PhP and can do a fair bit of Javascript and even know some Java syntax. I have an enormous book on Python here and don't think basic syntax, conditions, etc. should be a problem. But... I have no clue how to start working all of this into Uru. Is there a list of object, references, etc. that I can use? Sample script even maybe? For starters i would like to be able to start and stop texture animations, change the colors of light or objects in general, etc.
Any directions are helpful!
thnx
Marcello
Re: How to start writing Python script for UrU
Posted: Sat Jun 28, 2008 3:12 pm
by Grogyan
I'm learning by attempting to write a script for Blender, then i'll move onto Uru.
D'Lanor's journal template could be a start, or just decompile the .py files from the python.pak in your uru install
Re: How to start writing Python script for UrU
Posted: Sat Jun 28, 2008 6:34 pm
by Tsar Hoikas
Python in Uru is pretty simple, you can get a great grasp of it by reading some of Cyan's code. For starters, you might look at something like xAgeSDLBoolShowHide.py
However, I'll summarize some things here.
Python classes used in Plasma need to derive from ptModifier or ptResponders. ptModifiers are usually only reffed from the plSceneObject while ptResponders are usually called through complex logic interfaces.
In your class, you can override the following methods
OnServerInitComplete
This is called when (in multiplayer) you are done talking to the server and the script is loaded.
OnFirstUpdate
This seems to be called sometime after OnServerInitComplete yet before linkin occurs
OnSDLNotify
This is called when an SDL Variable that you have registered for notify is changed
OnBehaviorNotify
This is called when a ptAvatar who you have registered for behavior notify has done a behavior
OnNotify
This is called when a registered notify (ptAttribute i.e.) throws a message
OnTimer
This happens on a scheduled time from PtAtTimeCallback
Anyway, those are the basics. There are a few more methods that you could use, but they're likely not to be too useful right now (I don't see you needing to fetch the public age list)... Have fun!
Re: How to start writing Python script for UrU
Posted: Sun Jun 29, 2008 9:22 am
by MustardJeep
Thanks Hoikas that helps me a bit also.

Re: How to start writing Python script for UrU
Posted: Sun Jun 29, 2008 11:58 am
by Marcello
Thnx guys that should give me a start.