Allow 'user' CVARINFO cvars to be set by ZScript

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Allow 'user' CVARINFO cvars to be set by ZScript

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

by 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.

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

by 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.

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

by 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.

Allow 'user' CVARINFO cvars to be set by ZScript

by 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.

Top