Whether it's by having another flag 'archive' or something to indicate they should be archived, I'm trying to set up a system where the player's selected choice when ZScript is remembered.
Specifically the CVAR struct, when using SetInt, etc. doesn't actually record it, which to me seems like an intentional decision - and it makes sense that it does so.
Allow 'user' CVARINFO cvars to be set by ZScript
Moderator: GZDoom Developers
-
- Posts: 8109
- Joined: Sun Jan 28, 2007 3:55 pm
-
- Posts: 2038
- Joined: Thu May 02, 2013 1:27 am
- Graphics Processor: nVidia with Vulkan support
- Location: Brazil
Re: Allow 'user' CVARINFO cvars to be set by ZScript
This is actually a complicated bug that no one's fixed yet because of the complexity of the code. It actually works if you use FindCVar instead of GetCVar (which is why menus work), but that doesn't work for most use-cases.Major Cooke wrote:Specifically the CVAR struct, when using SetInt, etc. doesn't actually record it, which to me seems like an intentional decision - and it makes sense that it does so.
IIRC the reason it happens is because the game creates an instance of the CVar struct for the actual INI/config CVar, (which is the one FindCVar gives you) and also creates separate instances for each player number. (that are retrieved by GetCVar using a PlayerInfo)
The latter is where the problem lies, as it seems it makes no exceptions for the consoleplayer/local peer, and the changes to the latter instances don't affect the config instance, so they end up not getting saved to the INI file.
-
- Posts: 765
- Joined: Thu Apr 25, 2013 12:21 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
- Graphics Processor: nVidia with Vulkan support
- Location: The Corn Fields
Re: Allow 'user' CVARINFO cvars to be set by ZScript
this has been an issue for some time, as PB has said. It's been annoying to say the least.
-
- Posts: 15
- Joined: Sun Aug 09, 2020 2:46 pm
Re: Allow 'user' CVARINFO cvars to be set by ZScript
Oh, yes. Have just ran into the same issue. Spent some time trying to figure out why, while being seemingly updated ingame (when accessed via GetCVar) , my user cvar was not persisted between GZDoom restarts, and then remembered previous version of DoomDelta had a "bug" where hud style would not be saved, that could be worked around by changing scope to server.
So I've used the same workaround for my mod for now.
If the bug is somewhat complex, at least an error message in console to warn dev about unexpected behaviour would be appreciated, so that they don't waste time trying to figure that out.
PS And that non-string cvars work as expected really is adding to the confusion here.
My bad. They don't.
So I've used the same workaround for my mod for now.
If the bug is somewhat complex, at least an error message in console to warn dev about unexpected behaviour would be appreciated, so that they don't waste time trying to figure that out.
PS And that non-string cvars work as expected really is adding to the confusion here.
My bad. They don't.