Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Read and Write Web Storage in HTML5?

Author
Message
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 14th Apr 2018 14:39 Edited at: 14th Apr 2018 14:42
Hi all!

I have exported my project to HTML5 and I have noticed the Read and Write file commands works only as long the game is running. After reloading the page the project is unable to find the previously saved content which is indicates anything the Read and Write file commands is doing, is only temporary in HTML5 and it did not actually read and write the web storage which is a common way to save and store information locally in HTML5.

I'm wondering if is there anything I'm missing or AppGameKit can not read and write web storage in HTML5?
I would appreciate any help.

Thank you.

//Edit I noticed the typo in the title, I would appreciate if someone could fix it
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Apr 2018 16:55 Edited at: 16th Apr 2018 16:55
Currently it is not supported, we would need to hook into the HTML5 web storage API to get persistent data storage. Something for us to look at in future.
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 16th Apr 2018 22:24
Thanks Paul. It is very unfortunate.

I imagine HTML5 is not the priority but I think it would be important to be able to store data on all supported platforms at least. I hope to see this feature coming soon
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 17th Apr 2018 07:49
I wrote a fairly in-depth guide some time ago about how to call native Javascript functions from within AppGameKit (Tier 1) by hijacking the "Message" command. This allows you to pass data from the AppGameKit interface to standard HTML/Javascript for any outside processing, which can include using local storage to save the data. It's not an elegant solution but gets the job done until native support may be added.

Working Example: http://mjpsites.com/agk/CallJavascript/ (You can change your name and click in the AppGameKit view to update the HTML header and title bar of the tab).

Guide: https://forum.thegamecreators.com/thread/221260

The guide is only focused on AppGameKit to JavaScript, not vice-versa. There are some options to get the data back into AppGameKit but I haven't worked out any guide for that yet (HTTP requests are always still an option for retrieving data).
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 17th Apr 2018 21:51
Thanks a lot xCept it is looks very promising. I'm definitely going to look in to this.

Login to post a reply

Server time is: 2024-04-19 14:53:51
Your offset time is: 2024-04-19 14:53:51