HTML5 Ini Files

Dirusym

Member
Hello,

i have a really big Problem with my App, wrote in GMS 1:4.

So i decided to manage the Save File from a Webfilehoster. On my Phone and my PC it works fine.
BUT on HTML5 it doesnt work...
I know its because HTML5 have only the local Storage, but i need to update the Save File from time to time.
So i cannot update the HTLM5 application hole time, if i wanted to update the Save File.

Could anyone help me pls ?
 

chamaeleon

Member
Use the function that saves the ini file function to a string instead of file or local storage and upload the resulting string using http functions. Look up the required functions in the manual.
 

Dirusym

Member
First of all, thanks for replying me :)

i am not sure if i understand it right.
I only need to read the file and not to save it.
This is my code :

(Async Event: HTTP)

GML:
if(async_load[? "id"] == async_ini){
        switch(async_load[? "status"]){
            case 1: break;
            case 0:
                var result, evid;
                evid = ds_map_find_value(async_load, "id");

                switch (evid) {
                    case async_ini:
                        result = ds_map_find_value(async_load, "result");
                        file_delete("Data.ini");
                        file = file_text_open_write( "Data.ini" );
                        file_text_write_string(file,result);
                        file_text_close(file);
        
                        alarm[0] = 10;
                        break;
                }
            break;
            default:
                show_message("Cannot connect to server.");
            break;
        }
}
(Loading from the "Room Start" Event)

Code:
async_ini = http_get("http://diru.atwebpages.com/"+string(global.file)+".ini" );
Thanks for helping me :)
 

chamaeleon

Member
Is the url shown for your http get call the same location you are hosting your game? If not, you may have to figure out CORS settings to allow cross domain requests.
 
Top