SaveState/LoadState Issues
Monkey Forums/Monkey Bug Reports/SaveState/LoadState Issues
| ||
Over in the Flash board, a few of us have been having some problems with SaveState() and LoadState(): http://www.monkeycoder.co.nz/Community/posts.php?topic=4432 Here is some code that reproduces the problem under certain circumstances (detailed below). Strict Import mojo Function Main:Int() New Game Return 0 End Class Game Extends App Method OnCreate:Int() SetUpdateRate(30) Local state:String = LoadState() If ( state = "" ) state = "0" state = String( Int(state) + 1 ) SaveState( state ) Return 0 End Method OnRender:Int() Cls(0,0,0) ; SetColor(255,255,255) DrawText("[state]" + LoadState() + "[/state]",0.5*DeviceWidth(),0.5*DeviceHeight(),0.5,0.5) Return 0 End End This works fine (displays a state number) when using any browser when compiled for the HTML5 target. BUT it fails for the Flash target (at least for me and a few others) when using either the Firefox or Internet Explorer browsers. Curiously, it still works fine for the Flash target with Google Chrome. It doesn't appear to be a Flash storage setting issue. At time of writing, my current Monkey version is v67f, but siread confirms it to still be a problem in v70b. I'm a Firefox user, and I'll admit that I've tweaked some settings here and there (although I doubt it would cause this), but both IE and GC were tested as clean installs. If someone with some more technical knowledge than me could check this out, we'd all be grateful! |
| ||
OK, the problem is the 'local' file name used by Monkey, to fix, change all ".monkeystate" strings in modules/brl/native/gametarget.as to "monkeystate". Will be fixed in next release too. Also: IE and Firefox appear to share Flash app state - bumping state in one affects the other. Chrome's embedded version of Flash doesn't, it's got it's own 'Chrome only' state. And: I just had to install Flash for the first time in ages and nearly got sucked into installing some crapware at the same time: *be careful* on the plugin download page - make sure to 'opt out' of stuff you don't want! |
| ||
Thanks Mark! |