KEYDEFS is the place to set up aliases and add menu options to the keys menu. But for years, there has been no way to add custom cvars for your mod.
I finally hit this problem when trying to make a simple slider to control text speed for cutscenes. Using MENUDEF on a cvar that hasn't been set and archived in a previous instance of ZDoom results in the slider always sitting at zero and not responding to movement.
My suggestion is the addition of a command called defaultcvar. It takes two parameters - the cvar name, and the default value. The effect of calling this from the console or KEYDEFS would be to check if the cvar exists, set it to the default if it does not exist, and set it to archive.
It would be fab to have this soon as I'm looking at releasing an open pre-alpha for my project and want the slider to actually work for it.
defaultcvar for KEYDEFS
Moderator: GZDoom Developers
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: defaultcvar for KEYDEFS
And yet it's been two years.
The method I suggest is different, though, and allows it to be used outside of MENUDEF. I use a few other CVARs for debugging purposes, and subsequently don't want them advertised in a menu.
The method I suggest is different, though, and allows it to be used outside of MENUDEF. I use a few other CVARs for debugging purposes, and subsequently don't want them advertised in a menu.
Re: defaultcvar for KEYDEFS
Added in r4280 via CVARINFO. Was that soon enough for you?
Re: defaultcvar for KEYDEFS

I obviously still haven't finished Prime Directive, so that's plenty soon enough. Having it there for the final release was all that was absolutely required.
Re: defaultcvar for KEYDEFS
Question:
How less useful is it really? Are there any implications or limitations?◦string: A string value. It's not too useful for mods but is included for completeness. Defaults to "".
Re: defaultcvar for KEYDEFS
I'm already using strings as callbacks for ACS_NamedExecute all over the shop. User defined strings? Well. There's definitely implications there.
Re: defaultcvar for KEYDEFS
Nevermind I just read through everything again (was too excited earlier haha).
I guess the not-so-useful part is that there's no function to set the string for a CVar. Only ints and floats.
I guess the not-so-useful part is that there's no function to set the string for a CVar. Only ints and floats.