How to Save & Reload Values from a Project’s Previous Instance?
So I can change number variables through keyboard inputs, generating a score and high score through straightforward means. Now I would like help learning how I can get MicroScript to remember & reload the high score when next I open the project. @mrLman ‘s tutorial series mentioned a ‘storage.get’ command but it either didn’t work with the current version of Microscript or the tutorial didn’t explain this type of feature as well as it could have.
If reasonable, any additional advice on “save game“ code would be immensely appreciated
———
Here is the code if you need to look at it. ‘newHighScore’ and ‘oldHighScore’ are reserved if they end up being needed.
———
init = function()
score = 0
highScore = 0
newHighScore = 0
oldHighScore = 0
end
update = function()
//
if keyboard.press.Q then
score += 1
end
if keyboard.press.W then
score = 0
end
if keyboard.press.E then
highScore = 0
end
//
if score > highScore then
highScore = 0 + score
end
end
———