get python picking plugin for 99.5/99.6/99.72 here

This forum is currently in read-only mode.
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • download the fix and example cap here:

    http://dl.dropbox.com/u/1013446/pyfix/pyfix.rar

    I haven't tested this with earlier versions of construct (before 99.5)

    if you've never used python before, before you begin, you'll need to install python on your pc:

    http://python.org/ftp/python/2.6.4/python-2.6.4.msi

    Use picking in python by following these 3 simple steps: (SOL stands for Selected Object List, btw)

    • first call py.GetSOL("object name here")[/code:b3er7w1s]
    • next open a while loop while py.SOL:[/code:b3er7w1s]
    • finally, within this while loop, when you want to refer to the picked set of objects call the object like this: objectname[py.SOLi][/code:b3er7w1s]of course replacing objectname with the actual name of the object

    that's it.

  • Thanks, that is so cool.

    I am looking forward to try it out.

    Is there a way I can use python in conditions to pick objects?

    So that they are picked in the actions and events following after.

    Do you need Visual Studio Pro++ dx to write plugins or is there a way to build plugins with Visual studio express?

    Cheers

  • Is it possible to import python libraries?

    'cause that'd rock. Like, hard.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First: thanks Lucid, Now I know how to access different instances of objects in python.

    Second: Madster, yes you can import python libraries just add an action like this:

    System: Run Script("import math")[/code:3c7p8psq]
    Then retrieve some function later like:
    [code:3c7p8psq]Text: Set text to Python("math.pi")[/code:3c7p8psq]
    
    In 99.7 python is functioning for me except i cannot use "insert script" because construct will go down in flames if i try to preview a cap with even a single line.  But i can use python all i want with the "Run Script()" action and the "Python()" expression in the System object.
    
    

    The second problem with python, is that the construct 'system' object is not accessible. adding all the system actions to this plugin would be tedious, and you can still use regular system actions in conjunction with python and this plugin, so you're not missing any functionality.

    I seem to be able to access the System object just fine in python. The only quirk is the create object functions don't work but this does:

    System.Create("Sprite",1,100,100)[/code:3c7p8psq]
    
    Edit:  Here's a cap that shows names of all the functions of 'System'.
    [url]http://www.filedropper.com/pythonexample[/url]
  • when running pyexample2.cap and "mousing" over one of the boxes, 995 says:

    [quote:2q7vqoxt]An error ocurred in python, but construct is unable to obtain any error information without StringIO.pyc

    So... what now?

  • I really really want to use python during January

    Here's hoping someone can get this stuff sorted out

  • so you installed 2.6.4:

    http://python.org/ftp/python/2.6.4/python-2.6.4.msi

    I just reinstalled this latest version of 2.6, and it works

    the python file you need is in the python directory, so it's probably a problem with your python installation

    if it still doesn't work, try reinstalling construct

    also, did pybroke.cap work?

  • okay so that's embarrasing.

    I didn't have python installed at all. Thought I had it. I was wrong

    Installed 2.6.4 and it works now!

    One question: will users have to install python to play a game? I recall the export dialog asking if a dll should be copied... that one provides python support at the target machine, right?

    And for the devs: please unbreak python I'll have to test with older releases in the meantime.

    this is great news!

  • I think end users will have to install python

    I could be wrong

    also, btw, I editted this post at the top

    I know it's nicer to have it fixed natively in construct

    but this plugin addresses all the python problems I'm aware of

    I was wrong about system actions

    so you should have fully functional python now

  • First: thanks Lucid, Now I know how to access different instances of objects in python.

    Second: Madster, yes you can import python libraries just add an action like this:

    System: Run Script("import math")[/code:3chu1h2w]
    Then retrieve some function later like:
    [code:3chu1h2w]Text: Set text to Python("math.pi")[/code:3chu1h2w]
    
    
    

    Has anyone gotten external libraries to work with Construct? I have tried a couple times before with no luck. I'm talking about libraries that are not part of the built-in Python 2.6 libraries.

    Thanks Lucid for the fix... this is really nice work.

  • diaz You are awesome!! That gave me enough motivation to try again to figure out why my example wasn't working. For whatever reason when I was instantiating a PyAiml object using k=aiml.kernel (), I was not getting any return value when printing it out. I normally get a return value when printing from a regular python program. So I went back and looked at my example and tried casting the output k as a string str(k). Sure enough that did the trick and now it is working.

    I kinda feel like an idiot thinking all along it was not working... but this just made my day!

    Edit: Just tried to build an .exe and I get an error message popup from your example and my code. Do you have the same problem?

  • Hey.. Can't

    py.GetSOL("object name here")[/code:wh3tx9c3]
    instead of a object name, use:
    [code:wh3tx9c3]
    
    name=Sprite
    py.GetSOL(name)[/code:wh3tx9c3]
    
    When I do this, The game crashes.. any solution?
  • This method is obsolete.

    instead of

    py.GetSOL("Sprite")

    use

    SOL.Sprite

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