Best Method To Add CVARs To Player Setup Menu

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
22alpha22
Posts: 277
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Best Method To Add CVARs To Player Setup Menu

Post by 22alpha22 »

Been awhile since I've been on the ZDoom forums, I didn't want to make a new topic for this question but the How Do I thread seems to be locked.

Anyway I was wondering what the best way would be to add some custom CVARs to the player setup menu. I don't want to add any new menus or customize any of the existing ones except to add user configurable CVARs to the player setup menu. Some of the CVARs will be simple booleans while others will be a switchable string argument for example: ("Off", "Minimal", "Normal", or "Full"). I know I can do this through MENUDEF but correct me if I'm wrong, MENUDEF would require me to define all the menus if I remember correctly. Plus I'm pretty sure it is deprecated. ZScript would be the other option and while I have learned to use ZScript somewhat, I have not at all tried any menu stuff with it.
Jarewill
Posts: 1333
Joined: Sun Jul 21, 2019 8:54 am

Re: Best Method To Add CVARs To Player Setup Menu

Post by Jarewill »

MENUDEF deprecated? Not at all.
You don't even need to redefine the menus just to add a single option:

Code: Select all

AddOptionMenu "NewPlayerMenu"
{
    StaticText ""
    Option "Bool Option", "option_cvar1", "OnOff"
    Option "Custom Option", "option_cvar2", "NewValue1"
}

OptionValue "NewValue1"
{
    0, "Off"
    1, "Minimal"
    2, "Normal"
    3, "Full"
} 
User avatar
22alpha22
Posts: 277
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: Best Method To Add CVARs To Player Setup Menu

Post by 22alpha22 »

Thanks for the info, guess my memory isn't what it used to be because I could have swore I once read that MENUDEF required defining all menus. Anyway thanks.

Return to “Scripting”