Hi All,
I've got Aquillanto up on Steam (just internal now) and set up an achievement. I can set and clear the achievement via the game but I'm struggling to properly understand how it really works and therefor how to add error checking code and deal with any issues gracefully... I'm really not that techie so all help appreciated and extra appreciated if given at "Dummies Guide" level! The whole asynchronous part baffles me (I understand the concept but not really how Adam's plugin deals with it). Here's where I'm at and some questions...
I am currently setting the achievement like this... but not sure what I would do if I got an error result from steam...
CheckSet = Steam.SetAchievement("ACHIEVEMENT_NAME") // Sets the achievement but only in local memory
If CheckSet = 1
// Great - we've set the achievement - done!
Else
// Now what?
Endif
I'm uploading the achievement to steam like this but again, not sure what to do if it fails - see my next code below...
Also not sure if I need to run Syn() and Steam.RunCallbacks() commands here? Not entirely sure what they do!
CheckStore = Steam.StoreStats() // Now actually send them to the steam server
If CheckStore = 1
// Great - done!
Else
// Now what?
Endif
Sync()
Steam.RunCallbacks()
One idea I had for checking that achievements are recorded and uploaded is as follows (using the StoreStats() as an example)... so it tries until it succeeds or it's tried 50 times but not sure if this is spamming the server or just bad practice in general!
Again... do I need to run the Sync() and Steam.RunCallbacks() commands here?
PermittedLoops = 50 // Set the number of attempts we will allow before failure state
Repeat
CheckStore = Steam.StoreStats() // Send achievement/stats to the steam server
Dec PermittedLoops
Sync()
Steam.RunCallbacks()
Until (CheckStore = 1) or (PermittedLoops = 0)
I can see in the basic example on the Wiki that you can listen for errors but can't find the documentation to GetErrorOccurred() or GetLastError() Do all commands, for example Steam.StoreStats() and Steam.SetAchievement(), also set errors that can be called like this?
// GetStatInt will set the error flag if there's a problem.
If GetErrorOccurred()
Message("ERROR: " + GetLastError())
Endif
AQUILLANTO - A side-scrolling platformer with super tight controls, 3 worlds to explore, hordes of monsters and a quest... Inspired by games on the Amiga computer
FOLLOW ON TWITTER
SEE THE YOUTUBE CHANNEL