defaultcvar for KEYDEFS

Moderator: GZDoom Developers

Post Reply
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

defaultcvar for KEYDEFS

Post by GooberMan »

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.
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: defaultcvar for KEYDEFS

Post by Blue Shadow »

User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: defaultcvar for KEYDEFS

Post by GooberMan »

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.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: defaultcvar for KEYDEFS

Post by randi »

Added in r4280 via CVARINFO. Was that soon enough for you?
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: defaultcvar for KEYDEFS

Post by GooberMan »

:D Holy crap. Thank ye.

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.
User avatar
Nash
 
 
Posts: 17500
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: defaultcvar for KEYDEFS

Post by Nash »

Question:
◦string: A string value. It's not too useful for mods but is included for completeness. Defaults to "".
How less useful is it really? Are there any implications or limitations?
User avatar
GooberMan
Posts: 1336
Joined: Fri Aug 08, 2003 12:57 am
Location: Helsinki, Finland

Re: defaultcvar for KEYDEFS

Post by GooberMan »

I'm already using strings as callbacks for ACS_NamedExecute all over the shop. User defined strings? Well. There's definitely implications there.
User avatar
Nash
 
 
Posts: 17500
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: defaultcvar for KEYDEFS

Post by Nash »

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.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”