Allow 'user' CVARINFO cvars to be set by ZScript

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

Allow 'user' CVARINFO cvars to be set by ZScript

Postby Major Cooke » Mon Dec 27, 2021 1:18 am

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.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: Allow 'user' CVARINFO cvars to be set by ZScript

Postby phantombeta » Mon Dec 27, 2021 4:37 am

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.

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.

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.
User avatar
phantombeta
Tired of being treated like trash by control freaks
 
Joined: 02 May 2013

Re: Allow 'user' CVARINFO cvars to be set by ZScript

Postby SanyaWaffles » Mon Dec 27, 2021 11:04 am

this has been an issue for some time, as PB has said. It's been annoying to say the least.
User avatar
SanyaWaffles
Certified Heretic and Grill Champion
 
Joined: 25 Apr 2013
Location: Disappointment Island
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Allow 'user' CVARINFO cvars to be set by ZScript

Postby Ludicrous_peridot » Tue Dec 28, 2021 3:40 am

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.
Ludicrous_peridot
 
Joined: 09 Aug 2020


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests