Asset - Extension WebAPI

The-any-Key

Member
After some more checks it seem that this is actually a Game maker bug. Tested to get the data via browser and it works fine. But GM refuse to get the data.
 

dawidM

Member
There seem to be a standard limit on Apache for POST. You can increase it with a .htaccess file or check with the provider to increase the limit.
One idea is to test increase the limit with a .htaccess file. More info here: https://stackoverflow.com/questions/6135427/increasing-the-maximum-post-size

The upload and download system is not as secure as the database. As the files need to have public access. Sure you can encrypt the files before you upload them. And make strange filenames that are hard to guess.

Another way would be to compress the data before you send it: https://marketplace.yoyogames.com/assets/4742/string-compress
Thank you for your reply.The thing with .htaccess sounds good but it seems to be a bit complicated, but I will definitely try it soon. I am also going to buy this string compress asset, I hope it will help. For example, I noticed that my JSON string has unnecessary '0's , like : { "variable1: "1340.000000", "variable2: "1180.000000", "variable3: "2340.000000" } etc. It shouldn't generate additional zeros when it is an integer. I hope this asset wil help.

After some more checks it seems that this is actually a Game maker bug. Tested to get the data via browser and it works fine. But GM refuse to get the data.
Yes, this is some serious bug, it should be fixed in the next update, especially since more and more people create multiplayer games with GMS. @Nocturne , could you please address this bug to YoYo programmers? Thank you in advance and have a great day to both you guys.

Regards,
dawidM
 

FrostyCat

Member
Thank you for your reply.The thing with .htaccess sounds good but it seems to be a bit complicated, but I will definitely try it soon. I am also going to buy this string compress asset, I hope it will help. For example, I noticed that my JSON string has unnecessary '0's , like : { "variable1: "1340.000000", "variable2: "1180.000000", "variable3: "2340.000000" } etc. It shouldn't generate additional zeros when it is an integer. I hope this asset wil help.
It's generating extra zeros because it isn't a true integer. If you convert those values with int64() beforehand, those trailing zeroes disappear. Compression is just a matter of automatically shorthanding a piece of text, when it unpacks the zeros are all still there if you don't eliminate them at the source.
Yes, this is some serious bug, it should be fixed in the next update, especially since more and more people create multiplayer games with GMS. @Nocturne , could you please address this bug to YoYo programmers? Thank you in advance and have a great day to both you guys.
If you have a genuine bug, you file it on the helpdesk with a reproducible example. Nocturne isn't responsible for that.

Besides, it's also YOUR job to prove that it isn't the fault of something else, such as missing CORS headers or host-side hotlinking protection. I see both of these a lot with people who report so-called "bugs" on the HTML5 export.
 
G

Genuflex

Guest
Hello The-any-Key,

I would like to use highscore tables for daily score evaluation, so the tables should be cleared (truncate) or deleted (drop) and created again. I think the easiest way is modifying the
"setupDB_UsersHighscore" function. But I am not good in PHP and the Scripts have to many variables for PHP-Beginner.

For Dropping, it could be something like this: $query = "DROP TABLE `".$highscore_table."` ";
But it seems, that is not a complete solution. Could you help please?

EDIT: I solved it!
 
Last edited by a moderator:

The-any-Key

Member
Hello The-any-Key,

I would like to use highscore tables for daily score evaluation, so the tables should be cleared (truncate) or deleted (drop) and created again. I think the easiest way is modifying the
"setupDB_UsersHighscore" function. But I am not good in PHP and the Scripts have to many variables for PHP-Beginner.

For Dropping, it could be something like this: $query = "DROP TABLE `".$highscore_table."` ";
But it seems, that is not a complete solution. Could you help please?

EDIT: I solved it!
Note that you need to manually do this for everyday. Or make your computer call this clear function each day. As most hosts are passive and you can't make it do the call for you.

You could in theory make a check each time a user view or post a highscore. So any highscore that has another creation date than the current database time should be removed. But this calls for some PHP knowledge.
 
G

Genuflex

Guest
Note that you need to manually do this for everyday. Or make your computer call this clear function each day. As most hosts are passive and you can't make it do the call for you.

You could in theory make a check each time a user view or post a highscore. So any highscore that has another creation date than the current database time should be removed. But this calls for some PHP knowledge.
In GM are some time functions and you can set UTC for all players, so I solved it without PHP.

If you can see I use many functions of your Software. Now I want to use "Save Var" for some global values. In GM Text mod it works fine, like always. But in HTML5 it is a pain...
Google Chrome console is showing this error in your demo when I login and try to save global var in html5 module: Uncaught TypeError: Cannot read property 'slice' of undefined
The new value is saved, but the game crashes and you must reload the page

I'm not sure if I can fix this alone, but I can bypass it with a placeholder account for global variables like you mentioned on your website
 
Last edited by a moderator:

The-any-Key

Member
In GM are some time functions and you can set UTC for all players, so I solved it without PHP.

If you can see I use many functions of your Software. Now I want to use "Save Var" for some global values. In GM Text mod it works fine, like always. But in HTML5 it is a pain...
Google Chrome console is showing this error in your demo when I login and try to save global var in html5 module: Uncaught TypeError: Cannot read property 'slice' of undefined
The new value is saved, but the game crashes and you must reload the page

I'm not sure if I can fix this alone, but I can bypass it with a placeholder account for global variables like you mentioned on your website
Sounds like an internal error in the HTML5 export module. I think "slice" is used to split strings in JavaScript. And if there is a type error I guess it try slice a number or object that can not be sliced.
 

RyanC

Member
I was able to load 1.4 MB with the save/load functions. But anything over that created an empty response when loading, save worked however.
After I restarted Game maker I could load around 1.8 MB. But then it was back to 1.4 MB again. No PHP errors or Apache errors. My guess is that it is Game maker that has some kind of limit here or can't handle a big response.

Tips is to use the upload and download feature instead. As these seem to work fine with big files. You can use the user login ID number for identification for each file.

You could also try split up the data and upload it in separate save columns. You can save all parts at the same time doing:
Code:
scr_webapi_save(1,part_1,scr_webapi_Save_Done,scr_webapi_Save_Process);
scr_webapi_save(2,part_2,scr_webapi_Save_Done,scr_webapi_Save_Process);
Same for the load part:
Code:
scr_webapi_load(1,scr_webapi_Load_Done);
scr_webapi_load(2,scr_webapi_Load_Done);
You just need to put it together when all is done.

To get more than one save column you follow this tutorial:

Hi, Just purchased the asset and been taking a look.

This seems very well organised, however I couldn't find any documentation explaining what the functions are used for? The notes in the scripts seem vague.

I would like for my users to be able to store (string data for levels) and access each others to play them.

In the demo it can save a string in slot (column) 1 and 2 but perhaps I should be using the scoreboard to do this, otherwise how will the column increment when a user uploads a new string each time.

Just wondering if someone can steer me in the right direction with regards to the right functions to use, so I can get started?
 

The-any-Key

Member
Hi, Just purchased the asset and been taking a look.

This seems very well organised, however I couldn't find any documentation explaining what the functions are used for? The notes in the scripts seem vague.

I would like for my users to be able to store (string data for levels) and access each others to play them.

In the demo it can save a string in slot (column) 1 and 2 but perhaps I should be using the scoreboard to do this, otherwise how will the column increment when a user uploads a new string each time.

Just wondering if someone can steer me in the right direction with regards to the right functions to use, so I can get started?
Hi.
The asset can be used to store user information. They can also share data with others with the share column. You can also make users share number tables to ex save how many users played a specific game/level..

if you looking for a solution to share user generated levels you need a custom job as the asset is not designed to handle that.
 
Top