Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: pakhpakh64 on February 28, 2013, 01:33:35 PM
-
hello everybody,
I have problem with saving procedure. I want to exclude a specific window from saving. here is what troubles me: ::slug
in some state of the game development I create a save slot, THEN change some properties in a window. but when I load the saved game, the old version of the window is loaded and it doesn't reflects the changes. :'(
the question is can I have such a window that works inside the game but is Not included in saving procedure?
I hope I've been able to describe my problem well.
thanks in advance
PakhPakh64
-
I assume you mean game properties which you wish to remain whether you load an old save or even start a new game (like volume, subtitles etc). I also assume that you save those properties in variables inside the game.
If you indeed save the properties in variables, then what happens is correct, since the WME save function makes sure to save everything you have in memory. What I suggest you do is saving the settings in a file, and every time you start or load a game, open that file and set your properties from there. I haven't worked with files in WME yet but if you have tried working with files in other languages you will not have any trouble. I am certain other members of the forum who have finished games have worked with files.
Better start from the file object documentation: http://docs.dead-code.org/wme/generated/scripting_ref_file.html (http://docs.dead-code.org/wme/generated/scripting_ref_file.html)
-
Also - and this is a little bit simpliest way than working with files - you can use functions that read/write data in the registry:
RegWriteNumber Writes a given number to the Windows Registry.
RegWriteString Writes a given string to the Windows Registry.
RegReadNumber Reads a numeric value from the Windows Registry.
RegReadString Reads a string value from the Windows Registry.
-
tnx a lot, I try them.
-
What 2.0 proposed seems better than mine, so I suggest you try his first.
The only drawback I can see is something many games and applications do, which is not deleting the registry entries they used after the application is uninstalled ::)
-
What 2.0 proposed seems better than mine, so I suggest you try his first.
The only drawback I can see is something many games and applications do, which is not deleting the registry entries they used after the application is uninstalled ::)
WME anyway creates its own section in the registry to store some service data, and user's data will be created in that section, so in our case it is not so bad :)
-
hello again, well since the strings I want to load in the window are not so little and there is is a good possibility that the strings would get changed, so I went for the anarchist's method. ::)
So after doing this method a new problem arose! before I explain it I have to say that this window is for loading presaved games. so now I really need to call "AfterLoad" event to refresh the window according to the string file. the window is loaded in a script other than Game.script, the problem is even though I have declared the window variable in both script as global, I still get these two error and warning: ::slug
Warning: variable 'GameDebugModeToolWindow' is inaccessible in the current block. Consider changing the script (script:scripts\game.script, line:138)
Runtime error. Script 'scripts\game.script', line 138
Call to undefined method 'ApplyEvent'. Ignored.
any ideas?
-
ok problem solved, but honestly I don't know how!
now I can load my window according to the file. thank you all.