Cvar Replacement?
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Cvar Replacement?
Is there a way to save strings and data that will be saved in game without using cvars? Using too many of them will end up crashing the game and I want to know if there's a workaround.
Re: Cvar Replacement?
Everything saves in save. Well, almost everything, but those that not saves are very specific edge cases.
Or you mean saves between different game sessions?
Or you mean saves between different game sessions?
Re: Cvar Replacement?
Like if you decide to save a game but come back to it later. Not sure if everything saves that way.Apeirogon wrote:Everything saves in save. Well, almost everything, but those that not saves are very specific edge cases.
Or you mean saves between different game sessions?
For example having a string saved to a static event handler or something.
Re: Cvar Replacement?
In this particular case, the string saved in the static event handler is NOT saved, since the static event handlers are created on startup, and exist outside the scope of the playsim.TXTX wrote: Like if you decide to save a game but come back to it later. Not sure if everything saves that way.
For example having a string saved to a static event handler or something.
Anything that is part of the playsim (actors, etc.) will have their properties serialized and saved into the savegames. Thus, if, say, an actor stores some data on themselves, when the game is reloaded from a save, that data (at the point of the save) will be restored. If, however, you want persistant NON-playsim data (for example, a flag that says whether you beat the final boss before), CVARs are currently your only option. There have been discussions about this being implemented (can't find them atm), but I don't believe it will happen anytime soon. For now, you must rely on CVARs for persistant non-playsim data.TXTX wrote:Is there a way to save strings and data that will be saved in game without using cvars? Using too many of them will end up crashing the game and I want to know if there's a workaround.
Re: Cvar Replacement?
Thank you for the helpful reply. Suppose I can't do much about it unless I find some hacky way of implementing for now.3saster wrote: In this particular case, the string saved in the static event handler is NOT saved, since the static event handlers are created on startup, and exist outside the scope of the playsim.
Anything that is part of the playsim (actors, etc.) will have their properties serialized and saved into the savegames. Thus, if, say, an actor stores some data on themselves, when the game is reloaded from a save, that data (at the point of the save) will be restored. If, however, you want persistant NON-playsim data (for example, a flag that says whether you beat the final boss before), CVARs are currently your only option. There have been discussions about this being implemented (can't find them atm), but I don't believe it will happen anytime soon. For now, you must rely on CVARs for persistant non-playsim data.
- gwHero
- Posts: 360
- Joined: Mon May 08, 2017 3:23 am
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: The Netherlands
Re: Cvar Replacement?
There are global variables https://zdoom.org/wiki/ZScript_global_variablesTXTX wrote:Is there a way to save strings and data that will be saved in game without using cvars? Using too many of them will end up crashing the game and I want to know if there's a workaround.
Re: Cvar Replacement?
I'll have to take a look at that. Should be helpful.gwHero wrote: There are global variables https://zdoom.org/wiki/ZScript_global_variables