Documentation for python scripting

For questions about using Classic.

Post » Fri Oct 12, 2012 6:57 am

I am fairly new to construct classic, and one of the reasons I decided to play with it over construct 2 is that it included python scripting as part of the event sheet.

I am interested if there is a good source of documentation that would list the differing variables/methods associated with built-in object and behaviors so I can call them from script?

Failing that I have been desperate to figure out how to reference self on an instance that is triggering an event.

For example if a blue guy comes within sight of a red guy and triggers an appropriate event. How would I make it so the script I attach to that even refers only to that instance of blue guy, not any or all other ones?

Thanks in advance,

Knomez
B
2
Posts: 3
Reputation: 256

Post » Fri Oct 12, 2012 5:24 pm

All the variables/methods relate directly to Actions/Conditions/Expressions. You can get the list in the script editor by typing "Sprite." and the right hand side should show them all.

You can also find the names of the variables/methods by using the dir() function in this interactive python shell:
http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=6158&p=49059&hilit=Python#p49059

For accessing the picked objects use "SOL.Sprite".
ex:
"Sprite.X" is the x position of the first instance of Sprite
"Sprite[1].X" is the x of the second instance.
"SOL.Sprite.X" is the x of the first picked instance.
"SOL.Sprite[1].X" is the x of the second picked instance.

Some other links:
intro http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=5397&start
wiki http://sourceforge.net/apps/mediawiki/construct/index.php?title=Python_Scripting
B
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

Post » Fri Oct 12, 2012 9:03 pm

Thank you very much that is exactly what I am looking for. +1 to construct for having a helpful community.
B
2
Posts: 3
Reputation: 256


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests