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.

Best Method To Add CVARs To Player Setup Menu

Postby 22alpha22 » Thu Sep 09, 2021 8:51 am

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.
User avatar
22alpha22
So lonely...
 
Joined: 21 Feb 2014
Location: Montana, USA
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Best Method To Add CVARs To Player Setup Menu

Postby Jarewill » Thu Sep 09, 2021 10:51 am

MENUDEF deprecated? Not at all.
You don't even need to redefine the menus just to add a single option:
Code: Select allExpand view
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"
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Best Method To Add CVARs To Player Setup Menu

Postby 22alpha22 » Fri Sep 10, 2021 4:28 am

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.
User avatar
22alpha22
So lonely...
 
Joined: 21 Feb 2014
Location: Montana, USA
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia (Modern GZDoom)


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests