mmuziek
Member
Hello
Im programming a App that allows me to show news and maps and such to my servers players.
The Http_Get works flawlessly on create event based objects.
However since i try to make dynamic news headers it gets them from my api using http_get.
sadly it loops and there is no way to stop it
The code i use is User event 0 (thats the only way to make the instance and give it variables directly to load up in the HTTP_GET
sadly that is causing the endless loop even when canrun is set to false it keeps going. i tried different methods of stopping it but it seems that it just keeps going.
my app definetly doesnt like it (phone is lagging hard when running) and my api page blocks the requests after like 500 in 10 seconds. so thats not what i intend to do.
Does anyone have any idea how to make it only run once.
the object is created like so :
the async http of the same object as the user event :
Im programming a App that allows me to show news and maps and such to my servers players.
The Http_Get works flawlessly on create event based objects.
However since i try to make dynamic news headers it gets them from my api using http_get.
sadly it loops and there is no way to stop it
GML:
28 00:12:38.838 28767 28819 I yoyo : HttpGet("MYAPIURL", 402)
03-28 00:12:38.870 28767 28819 I yoyo : HttpGet("MYAPIURL", 403)
03-28 00:12:38.871 28767 28819 I yoyo : HttpGet("MYAPIURL", 404)
03-28 00:12:38.904 28767 28819 I yoyo : HttpGet("MYAPIURL", 405)
03-28 00:12:38.904 28767 28819 I yoyo : HttpGet("MYAPIURL", 406)
03-28 00:12:38.940 28767 28819 I yoyo : HttpGet("MYAPIURL", 407)
03-28 00:12:38.941 28767 28819 I yoyo : HttpGet("MYAPIURL", 408)
It keeps going on unless i stop the app
GML:
if (canrun){
get_url = http_get("myapiurl/getnews.php?n=" +string(newsnumber) + "&action=gettitle&catid=" + string(catid));
canrun = false;
}
my app definetly doesnt like it (phone is lagging hard when running) and my api page blocks the requests after like 500 in 10 seconds. so thats not what i intend to do.
Does anyone have any idea how to make it only run once.
the object is created like so :
Code:
with (instance_create_layer(240,160 + additionylevel,"Instances",Obj_newsitemparent)){
newsnumber = Obj_GenerateNewsButtons.itemcounter;
catid = global.selcat;
event_user(0);
}
Code:
if ds_map_find_value(async_load, "id") == get_url
{
if ds_map_find_value(async_load, "status") == 0
{
return_result = ds_map_find_value(async_load, "result")
canrun = false; << extra set for certaincy but fails aswell
}
else
{
r_str = "null";
}
}