Python return values

For questions about using Classic.

Post » Sat Aug 14, 2010 11:47 am

I could really need some hints here. I don't know how to recieve a return value from a function/method.

Simple example: I have a Textbox named Text an a script with the following code
[code:3u6blokr]def somemath(x):
n = x * x - x
Text.SetText(str(n))[/code:3u6blokr]

If I call the function with System: Run Script("somemath(3)"), the result 6 is correctly shown in the Textbox.

[code:3u6blokr]def somemath(x):
n = x * x - x
return n[/code:3u6blokr]

But what to do now? How do I receive the return value? (The same is with calling a class that might return something)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Aug 14, 2010 11:51 am

Action - set text to
python("somemath(x)")
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Aug 14, 2010 11:53 am

Aaah, thank you very much. lucid, you saved my day :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests