Page 3 of 3

Re: Privateer GG talking heads

Posted: Sat Dec 22, 2012 10:25 pm
by log0
Updated more complete version. There are a few bits that could be enhanced, like the inheritance relations(comp, launcher and co derived from link).

Re: Privateer GG talking heads

Posted: Sun Dec 23, 2012 6:17 pm
by Herr_Koos
That will help quite a bit, thanks. Question: Does Base.Video work in the VS of 1.03 stable or was it only added later?

Re: Privateer GG talking heads

Posted: Sun Dec 23, 2012 6:19 pm
by Herr_Koos
And then another thing:

# Add a script object
# Script is executed until object is erased
# room: room id (int)
# index: script id (string)
# pythonfile: script string / filename (string)
# time: delay till/between script execution (float)
Base.RunScript(room, index, pythonfile, time)

What is the purpose of the index/script id argument?

Re: Privateer GG talking heads

Posted: Sun Dec 23, 2012 7:13 pm
by klauss
Herr_Koos wrote: # Add a script object
# Script is executed until object is erased
# room: room id (int)
# index: script id (string)
# pythonfile: script string / filename (string)
# time: delay till/between script execution (float)
Base.RunScript(room, index, pythonfile, time)

What is the purpose of the index/script id argument?
It's an identifier you have to use when erasing or modifying an element.
Herr_Koos wrote:That will help quite a bit, thanks. Question: Does Base.Video work in the VS of 1.03 stable or was it only added later?
I believe it should, though I could remember wrong.

Re: Privateer GG talking heads

Posted: Sun Dec 23, 2012 7:31 pm
by log0
Herr_Koos wrote:And then another thing:

# Add a script object
# Script is executed until object is erased
# room: room id (int)
# index: script id (string)
# pythonfile: script string / filename (string)
# time: delay till/between script execution (float)
Base.RunScript(room, index, pythonfile, time)

What is the purpose of the index/script id argument?
The id is a way to identify/reference an object after its creation.

Simple example:
# Add a texture. Change texture position.
roomid = Base.GetCurRoom()
Base.Texture(roomid, "mypic", "../somepic.texture", 0.0f, 0.0f)
Base.SetTexturePos(roomid, "mypic", 0.5f, 0.0f)

Other example:
# Add a script object that will execute a script every 2 seconds. Erase it after first run.
roomid = Base.GetCurRoom()
scriptid = "myscript"
script = "#\nimport Base\nprint 'bla'\nBase.EraseObj(%(rid)d, %(sid)s)" % {'rid' : roomid, 'sid' : scriptid}
time = 2.0f
Base.RunScript(roomid, scriptid, script, time)