get result javascript to global variable construct

Get help using Construct 2

Post » Mon Jul 27, 2015 12:22 am

Hello excuse my english,

How to do when i execute javascript of object browser in event sheet for get the result of javascript code to a global variable of construct ?

Thank you
B
12
S
3
Posts: 147
Reputation: 2,026

Post » Mon Jul 27, 2015 8:02 am

If it does return a value, you can just set the value in an action:

globalvariable = browser.execjs("your code")
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Mon Jul 27, 2015 8:52 am

On function your_function
- set your_str to function.param(0);
- set your_num to function.param(1);

On some event
- browser.execjs("
/* do some stuff maybe async then */
c2_callFunction('your_function', ['string', 1]);
");
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Mon Jul 27, 2015 9:54 pm

Thank you very much ! :)
B
12
S
3
Posts: 147
Reputation: 2,026


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 56 guests