External communication

Get help using Construct 2

Post » Tue Nov 01, 2011 9:11 pm

I really don't have any real specific ideas, but i have had the thought for sometime...is it possible for C2 to make external calls from within the game to a JQuery or JavaScript and have it effect the game?

Just curious....
B
16
S
2
G
1
Posts: 43
Reputation: 1,473

Post » Tue Nov 01, 2011 11:51 pm

Do you mean AJAX calls ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Nov 03, 2011 1:40 pm

@kyatric

I suppose AJAX is what I am looking for...since u can effect C2 content from external files and scripts using AJAX would it be possible to call an external script that, for the sake of this hypothetical question, checks the orientation of a mobile device and returns the information back to C2?
B
16
S
2
G
1
Posts: 43
Reputation: 1,473

Post » Fri Nov 04, 2011 3:20 am

Hiya qwiktags,

I don't think you'd need AJAX to get the orientation, just javascript, as follows:
http://www.devinrolsen.com/javascript-mobile-orientation-detection/

Cheers,
DavidUgotsta2011-11-04 03:21:18
B
126
S
7
G
4
Posts: 185
Reputation: 7,233

Post » Fri Nov 04, 2011 3:45 am

I haven't looked at ugotsta's link, but I guess making a C2 plugin out of the script proposed would be the better solution and wouldn't require ajax calls.

Also, AJAX IS a call to some script (in the tutorial the script is PHP. You can script in another language, as long as it is hosted online and accessible from the C2 application I guess)
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Nov 04, 2011 1:42 pm

As far as I understand the Ajax-Plugin you need a Webserver to response => php - which is executed on the server.

For executing javascripts(which will be executed on the client) i've written a small plugin:
see it here: Plugin CallJS

if such local(on the client) script-execution is possible with the ajax-plugin let me know

greets, Joe7
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Fri Nov 04, 2011 7:35 pm

@Joe

The plugin sounds quite handy...I'll play around with it and see what I come up with

@kyatric
Thanx for the AJAX suggestion

@ugotsta
Thanx for the script and input
B
16
S
2
G
1
Posts: 43
Reputation: 1,473


Return to How do I....?

Who is online

Users browsing this forum: michaelverdi and 25 guests