How do I execute Javascript?

Get help using Construct 2

Post » Mon Jan 16, 2017 6:35 pm

Hi,

I want to execute a Javascript (it's from a web widget, and I want to implement this widget into my game) and I've tried many things, and nothing has worked.

1.- I tried to load the widget with the AJAX Plugin (didn't work)
2.- I tried with the JSON Plugin (didn't work)
3.- I tried loading the code with the AJAX and, once it was completely loaded, executing Javascript (AJAX.LastData) with the Browser (nothing happened)

I'm sure there is a possible way to load web widgets into the capx. Could anyone help me to execute Javascript?

Thank you
B
18
S
5
Posts: 126
Reputation: 1,480

Post » Tue Jan 17, 2017 10:56 pm

You can use the action of the Browser plugin.
Else you can create your own plugin
B
17
S
10
G
19
Posts: 140
Reputation: 11,457

Post » Wed Jan 18, 2017 3:09 pm

Saad Swad wrote:You can use the action of the Browser plugin.
Else you can create your own plugin


I already tried to run this code with the Browser action (as I described in point 3), but it did not work.

I don't know how to create a Plugin that is able to run the code I attached above.
B
18
S
5
Posts: 126
Reputation: 1,480

Post » Wed Jan 18, 2017 7:03 pm

B
17
S
10
G
19
Posts: 140
Reputation: 11,457

Post » Thu Jan 19, 2017 12:30 pm

Thank you.

I already tried this Plugin some time ago, but, as you can see, the result doesn't look the same (in your capx) as when you run the script. There are no CSS Settings and, over the widget, there is a lot of code.

This is the reason why I was looking for a way to run Javascript, I would like to get exactly the same result as in the link.
B
18
S
5
Posts: 126
Reputation: 1,480

Post » Fri Feb 24, 2017 6:12 pm

I'm also having trouble understanding this. I have a script called NoSleep.js which I have imported into my project - trying to use the Browser execute javascript action but I can't figure out what exactly I'm supposed to put in that field. The name of the script? The script itself? Or what?
B
9
S
2
Posts: 14
Reputation: 553

Post » Mon Feb 27, 2017 5:19 pm

Try with "NoSleep();" @huntjn
B
18
S
5
Posts: 126
Reputation: 1,480


Return to How do I....?

Who is online

Users browsing this forum: mrkaio, Zav and 2 guests