J
jaber
Guest
Hi;
I am creating my own leaderboard and for hat I have created an API in AWS and I have tested from Gamemaker and I see its working fine.
in create event
in Async-HTTP
in draw
I get this result
{"statusCode": 200, "body": {"Player_car": "Buggati", "Player_name": "Jaber", "Update_date": "2020-10-31--05:49:33", "Player_KM": "1000", "Player_level": "Beginner", "Player_ID": "jaber31", "Player_score": 309.0}}
Sofar so good.... now to the problem.. when I draw the value of r_car I still get null! I guess I am missing something here : /
the question is, how can I convert json to dsmap correctly?
by the way, I followed the video of Heartbeast here but it looks like the API was used returned json without the prefix {"statusCode": 200, "body":
any workaround?
thanks
J
I am creating my own leaderboard and for hat I have created an API in AWS and I have tested from Gamemaker and I see its working fine.
in create event
GML:
r_json = "null";
r_map = "null";
r_car = "null";
url = "https://xxxxx2.amazonaws.com/default/Query_lambda?playerid=jaber31";
get = http_get(url);
Code:
if ds_map_find_value(async_load, "id") == get
{
if ds_map_find_value(async_load, "status") == 0
{
r_json= ds_map_find_value(async_load, "result");
r_map = json_decode(r_json);
r_car = r_map [? "Player_car"]
}
else
{
r_json = "empty returned";
}
}
Code:
draw_text(10,100,r_json);
{"statusCode": 200, "body": {"Player_car": "Buggati", "Player_name": "Jaber", "Update_date": "2020-10-31--05:49:33", "Player_KM": "1000", "Player_level": "Beginner", "Player_ID": "jaber31", "Player_score": 309.0}}
Sofar so good.... now to the problem.. when I draw the value of r_car I still get null! I guess I am missing something here : /
the question is, how can I convert json to dsmap correctly?
by the way, I followed the video of Heartbeast here but it looks like the API was used returned json without the prefix {"statusCode": 200, "body":
any workaround?
thanks
J