System.RunPythonScript question

For questions about using Classic.

Post » Tue Feb 16, 2010 12:30 pm

I have imported math in my cap
so math.atan2 works if it's in my cap's python scripts

at runtime if I use the Run Python Script action, I can use a script directly from math such as
Run Python Script: "x=math.atan2(1,2)";

but a function defined in the cap which can be called successfully within the cap itself:
[code:ggiv2n5i]def atantwo(first,second):
return math.atan2(first,second);

#x=atantwo(1,1); would work fine here[/code:ggiv2n5i]

but if I use the Run Python Script action at runtime and try:
Run Python Script: "x=atantwo(1,2);"
I get an error:
NameError: global name 'atan2' is not defined

is this a bug, or a limitation, or is there a special way to make it work?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Feb 17, 2010 11:42 am

It's working fine for me. Could you post a cap that shows the problem.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Thu Feb 18, 2010 6:45 pm

oh sorry, forgot i posted this, ill try to remember to post a cap when i get home
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests