+jetwitaussi Posted December 20, 2023 Share Posted December 20, 2023 Hi, I made my first Wherigo with success, it was easy and worked without any issue. Now I'm trying to do some more complex system and I have several questions I couldn't find any answer despite crawling ... the whole internet :p I would like to save a data (a boolean, a number, whatever but a simple data) when the user succeed to reach a certain point in the game. easy task. but what I want is to be able to test this data at start of a session and get the value, so once the value is set to true I want to know it on every other session so I know at start the user, on this device, has already done a part of the game in another session. Is that possible in any way? For media, in Urwigo we have type "text", I didn't succeed to do anything with it, but as lua io library is not available, I hope to be able to read a text media and even modify it, is it possible? As the cartridge is able to write logs in a well known named log file, is there a way to read this file by the lua code? On the cartridge object there is variable LastPlayedDate, is this variable updated? if yes, when? and saved accross all session? Is there a complete doc of the Env variable? Is there a way to build including a lua module, like curl or socket? Thanks for your help ! Quote Link to comment
Ranger Fox Posted December 21, 2023 Share Posted December 21, 2023 When you define a variable in, say, Urwigo, that variable's value is retained if the user exits and restarts the cartridge, so long as either you manually trigger the save event or the user selects to save the cartridge when exiting. Either way, the user has to consent to restoring the game upon restarting the cartridge. There's a cartridge event that happens upon restore. You can test for a variable's value there. All zones will be restored to the state they were in when the cartridge was saved. (Manipulations and state in author script are another matter.) To my knowledge, you can't modify text media. Or, at least, I haven't heard of anyone doing this. I have not heard of anyone using the LastPlayedDate variable, and I cannot guarantee all player apps set this variable. They might, but I don't know. If you do an experiment, let everyone know your findings. For documentation on the Env variable: Quote Env I created a small play-anywhere cartridge which displays the keyword/value pairs of the Env table. Keyword Emulator Colorado / Oregon Pocket PC OpenWIG Platform Win32 Vendor 1 ARM9 PocketPC 2003 MIDP-2.0/CLDC-1.1 CartFolder <current GWC directory> <0/1>:/Wherigo <current GWC directory> c:/what/is/it/to/you SyncFolder <current GWC directory> <0/1>:/Wherigo/Saves <current GWC directory> c:/what/is/it/to/you PathSep \ / \ / DeviceID Desktop <device serial #> <very long serial #> <value of java microedition.platform property on the device> Version 2.11 2.11 2.11 2.11-compatible CartFilename <gwc-filename>.gwc <gwc-filename>.gwc <gwc-filename>.gwc <gwc-filename>.gwc LogFolder <windows directory> / nil value <0/1>:/Wherigo/Logs \My Documents\ c:/what/is/it/to/you Downloaded <secs since 1970-01-01> <secs since 1989-12-31> <secs since 1970-01-01> 0 Device <built-for device> <built-for device> <built-for device> <built-for device> There's some interesting stuff in there. For a start, there seem to be plenty of better ways to detect the emulator than checking is the player's altitude is zero. For example: if Env.Platform == "Win32" or if Env.DeviceID == "Desktop" or of course something more complicated that is harder to patch with a binary editor. (My own builder, currently in alpha testing, will allow you to specify that strings are obfuscated in the final cartridge and converted back to the real values at runtime, which will make all sorts of cheating harder.) If someone who has a Pocket PC would like to run this and either update the tables or send the results to me for interpretation (I'm particularly interested in the timestamp), please let me know (nick dot brown at free dot fr). Quote Link to comment
+jetwitaussi Posted December 21, 2023 Author Share Posted December 21, 2023 Hi, thanks for your answer but the question to store a data is not about saving/restoring the cartridge, the goal is to save a data globally for the cartridge that can be known when the user starts a new game and not only on restoring a previous attempt. Quote Link to comment
Ranger Fox Posted December 22, 2023 Share Posted December 22, 2023 Because the player decides whether or not to restore the cartridge's state upon launching the cartridge, there isn't a way to pass information from one playthrough to another. Even if you provide a way within your cartridge to start a new game (which would effectively pass information from one playthrough to another), the player still has to elect to restore state. Quote Link to comment
+jetwitaussi Posted December 23, 2023 Author Share Posted December 23, 2023 I don't want to avoid a reload of a saved game, I just tried to get a flag from global usage. But as variables are not available on my phone (despite being available on emulator) I can't find a way. Need to check the WIG object. Else I will do differently Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.