how do you use python conditions (solved)

This forum is currently in read-only mode.
  • let's say I want to have a MouseKeyboard.OnClick event within python

    it that possible?

    I know all the python commands are in place for conditions

    but I don't know/understand if/how they can be used.

    EDIT:solution down there somewhere

  • no, but seriously

    is it possible?

    are they just used as expressions that evaluate to boolean values?(not at home to test)

  • Time for a python object?

  • you know about this one, right?

    http://www.scirra.com/forum/viewtopic.php?f=2&t=5305

  • Well a full blown object might be interesting. I know users would still want the ability to use the editor, but inputting expressions like you can with an object would be cool.

  • not sure what you mean

    unless you mean:

    Script-Event communication

    Events can retrieve data from scripts via the Python system expression. For example, the expression:

    Python("x")

    will return the content of the variable x. Similarly:

    Python("myfunc()")

    will return the value returned from calling the function myfunc in script. Further, you can use the system condition Python Compare, to directly compare a python variable in an event, such as the variable "x" greater than 100.

    Scripts can trigger events by using the Function Object. The Call routine of the Function object takes two parameters: the function name, as a string, and the forget/remember picked objects option, which can be left as 0 (for Forget). For example:

    Function.Call("My function", 0)

    if not, what do you mean?

  • For example your py object, what if you could include all the python conditions, actions, and expressions in it, and use it like say the system object.

  • hmm...but python is mainly there to use the other stuff that the normal construct stuff makes tedious or messy, so it'd be like a super messy, tedious mess of tedium. plus python is a full scripting language, so I'd imagine it'd be hundreds of possible commands and expressions.

    anywho

    for those who are wondering, I figured out the answer

    yes you can use construct conditions in python as boolean expressions

    for instance:

    if MouseKeyboard.MouseButtonDown(0):
    	Sprite.Angle+=1;[/code:1gaz489e]
    
    will increment the sprite angle while the mouse button is down, 
    but I can't figure out how to make this work or if it works with triggered conditions
    I think not, just based on what I know about the SDK
    but who knows really.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you'd just want to have the triggered condition with the python script as a subevent?

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