get python picking plugin for 99.5/99.6/99.72 here

New releases and general discussions.

Post » Sun Dec 20, 2009 1:03 pm

download the fix and example cap here:
[url:b3er7w1s]http://dl.dropbox.com/u/1013446/pyfix/pyfix.rar[/url:b3er7w1s]

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:
[url:b3er7w1s]http://python.org/ftp/python/2.6.4/python-2.6.4.msi[/url:b3er7w1s]


Use picking in python by following these 3 simple steps: (SOL stands for Selected Object List, btw)
[list:b3er7w1s][*:b3er7w1s]first call[code:b3er7w1s] py.GetSOL("object name here")[/code:b3er7w1s]
[/*:m:b3er7w1s]
[*:b3er7w1s]next open a while loop [code:b3er7w1s]while py.SOL:[/code:b3er7w1s]
[/*:m:b3er7w1s]
[*:b3er7w1s]finally, within this while loop, when you want to refer to the picked set of objects call the object like this: [code:b3er7w1s]objectname[py.SOLi][/code:b3er7w1s]of course replacing objectname with the actual name of the object[/*:m:b3er7w1s][/list:u:b3er7w1s]

that's it.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Dec 21, 2009 2:44 pm

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
B
4
G
3
Posts: 46
Reputation: 992

Post » Mon Dec 21, 2009 2:49 pm

Is it possible to import python libraries?
'cause that'd rock. Like, hard.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Thu Dec 24, 2009 6:20 pm

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:
[code:3c7p8psq]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.

[quote="lucid":3c7p8psq]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.
[/quote:3c7p8psq]
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:
[code:3c7p8psq]System.Create("Sprite",1,100,100)[/code:3c7p8psq]

Edit: Here's a cap that shows names of all the functions of 'System'.
[url:3c7p8psq]http://www.filedropper.com/pythonexample[/url:3c7p8psq]
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Fri Dec 25, 2009 6:02 pm

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[/quote:2q7vqoxt]

So... what now?
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Dec 27, 2009 6:20 am

I really really want to use python during January :)

Here's hoping someone can get this stuff sorted out
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Dec 27, 2009 2:12 pm

so you installed 2.6.4:
[url:29yi0ggh]http://python.org/ftp/python/2.6.4/python-2.6.4.msi[/url:29yi0ggh]

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?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Dec 28, 2009 5:47 am

okay so that's embarrasing.

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

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 :P I'll have to test with older releases in the meantime.
this is great news!
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Mon Dec 28, 2009 8:49 am

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
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Jan 02, 2010 3:36 pm

[quote="R0J0hound":3chu1h2w]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:
[code:3chu1h2w]System: Run Script("import math")[/code:3chu1h2w]
Then retrieve some function later like:
[code:3chu1h2w]Text: Set text to Python("math.pi")[/code:3chu1h2w]

[/quote: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.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests