• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

HTML5 HTTP_GET Failed

S

Sarabia154

Guest
Hi guys,

So, i have a question about this... Im making a online card game. Now i'm programing the card object. The idea of this objects is to make a dynamic load like this...
When i create the generic object of the card, I pass and ID (idCard) and then with these ID find a json in the server, and load the info.

I make it perfect following a tutorial, and its works... in "Window" export. But, when i use HTML5 export its response me a diferent status and result.

I post the code bellow

Event Create:
http_get("http://192.168.1.10/id" + string(idCard) + ".html");
Event Asynchronous HTTP:
var json = async_load[? "result"]; // I get the result of the http_get into var

var map = json_decode(json); // I make a ds_map from the json

if (map == -1)
{
show_message("Can't get the information");
exit;
}
else
{
// HERE I LOAD THE CARD VARS
}

How i need to do, to run this correctly in HTML5 export?

Thanks all!
 
S

Sarabia154

Guest
Hi!

So... I'm a constant person, and i try many times to solve this and... i probably solved it... i explain what i do to help other users that have the same problem.

If you run directly the game in HTML5 it goes to 127.0.0.1:(port)/index.html, and i get the "http_get" using the 192.168.1.10. Both ip adresses are attacking my PC... but... for one reason that i know, game maker didn't like... So... i change one of the ip adresses... like that:

Web Browser:
192.168.1.10:(port)/index.html
GML Code call:
http_get("http://192.168.1.10/id" + string(idCard) + ".html");


if any one have another answer to this... i read all.

Thanks
 
Top