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 / [SOLVED] Saving Highscore!

Author
Message
Nationalcrafter67
6
Years of Service
User Offline
Joined: 6th Oct 2018
Location:
Posted: 1st Mar 2019 04:40
This post has been marked by the post author as the answer.
Hey guys, working on an app that needs a save function. I've learned a bit about writing to a file, OpenToWrite, OpenToRead, but cannot for the life of me figure out the functionality of it. Any assistance is greatly appreciated! Essentially all I'm doing is saving a highscore so that it ultimately isn't "reset" automatically whenever the app is closed. Again, thanks for the help guys.

~JayOakenTreeStudios

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 1st Mar 2019 04:46



works for me.

Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 1st Mar 2019 10:06 Edited at: 1st Mar 2019 10:06
I'd also recommend looking at the json array load and save feature in AppGameKit too: https://www.appgamekit.com/documentation/guides/12_array_changes.htm

It only takes a couple of lines to save and load a single variable from a .json file. It'll be easy to save a top 10 list that way too.

I used ReadInteger and WriteInteger alot before json was available and slowly moving parts of my app over to json.
OryUI - A WIP AGK2 UI Framework
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 1st Mar 2019 18:19
+1 for json it's a universal format that most languages can easily encode/ decode with internal data structures, and it's easily transportable for example by sending via web request to an online score table. I json all the things
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Nationalcrafter67
6
Years of Service
User Offline
Joined: 6th Oct 2018
Location:
Posted: 2nd Mar 2019 07:54
Alright so far haven't had much luck, I'm probably overlooking something. Here's essentially how it's written out here.

if GetSpriteCollision(1,2)
"random code placed here"
scr = scr + 1
endif

scr in this instance being the variable for the scoring system

When you "lose"

if scr < hscr
hscr = hscr
elseif scr > hscr
hscr = scr
endif

This ultimately saves in one time, once the game is closed, hscr is of course reset to 0. Json seems to be the right way to go about it. How would you guys go about this?

Login to post a reply

Server time is: 2024-11-23 05:20:07
Your offset time is: 2024-11-23 05:20:07