0 Favourites

Scripting

This forum is currently in read-only mode.
  • 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,

  • 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:

    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.
  • 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:

    http://construct.cvs.sourceforge.net/viewvc/construct/Plugins/

    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:

    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
  • .... and

    All can be accomplished with events.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Thanks guys :]

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)