Scripting

For questions about using Classic.

Post » Thu Aug 27, 2009 6:20 pm

Hi,

Where can I get tutorials about Construct scripting???
Is there are some Construct scripting commands list???
Can you tell me more about Construct scripting???


Thanks,
B
2
G
3
Posts: 28
Reputation: 906

Post » Thu Aug 27, 2009 8:26 pm

I assume you're talking about Python, in which case you could just google "Python tutorials" to learn the basics of Python in general.

To access Construct objects, the syntax is:

[code:2iynzz3o]ObjectName.DesiredValue[/code:2iynzz3o]
For example:

[code:2iynzz3o]Sprite.X = 10[/code:2iynzz3o]
This would set the X position of Sprite to 10. You can also set other values, such as the Y position and angle, like this.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Aug 27, 2009 9:15 pm

also, the python commands to do construct actions
are usually guessable like
to set the angle of a sprite with events
you normally double click "Set Angle"
and I believe the python command version of that is "SetAngle"
if you're having trouble guessing a certain command
ask someone, there is an equivalent python command for every action, condition, and expression,
including plugins that have been made by users, it's built into the event code to require a python equivalent command.

also, if you're particularly adventurous, you can look at the source code of an object to find the command:
[url:2h009qrx]http://construct.cvs.sourceforge.net/viewvc/construct/Plugins/[/url:2h009qrx]
go into a plugin directory,
some plugins have a duplicate that say "aced"
for instance, there is a 'mouse/keyboard', and a 'mouse/keyboard (aced)'
if it does NOT have a duplicate that says "aced"
you check the ACEtable.cpp file,
for the one's that do, you check the Main.cpp file
when you get into that file, you can see all of the actions, conditions, and expressions,
example:
[code:2h009qrx]ADDPARAM(PARAM_OBJECT, "Object name", "Name of the object");
ADDCND("*On collision with another object", "Collisions", "On collision between %n %o and %0", &ExtObject::cOnCollide, "OnCollide", SOL_MODIFIER);[/code:2h009qrx]
the only thing you're interested in is that last thing in quotes for each one
in this case "OnCollide", would be the python equivalent of the "On Collision with another object "condition of sprite

or in this example:
[code:2h009qrx]ADDPARAM(PARAM_OBJECT,"Object","Select the object to fire out.");
ADDPARAMDEF(PARAM_VALUE, "Layer", "Layer name or number, to create the object on.", "1");
ADDPARAM(PARAM_VALUE, "Image point name or number (optional)", "Leave 0 to use object's position, or enter an image point's name or number.");
ADDACT("Spawn another object", "Creation", "Spawn object %0 on layer %1 (image point %2)", &ExtObject::aShootObject, "SpawnObject", SOL_MODIFIER);[/code:2h009qrx]

"SpawnObject" would be the python equivalent to the "Spawn another object" action of sprite
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Aug 27, 2009 9:57 pm

.... and

All can be accomplished with events.
Image Image
B
161
S
48
G
90
Posts: 7,348
Reputation: 66,751

Post » Thu Aug 27, 2009 10:02 pm

B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Aug 27, 2009 11:37 pm

Thanks guys :]
B
2
G
3
Posts: 28
Reputation: 906


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests