Changing multiple CVARs in MenuDef

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

Changing multiple CVARs in MenuDef

Postby LanHikariDS » Wed Nov 14, 2018 9:50 pm

My question is pretty much as the title states, how do I change multiple CVARs in MenuDef?
I'm doing up a mod with some custom CVAR setup in the menus, and I'm trying to have a single button that sets most of the CVARs to predefined values, not unlike a "Reset to Defaults" button. How can I go about doing this?
User avatar
LanHikariDS
Some people call these demons, I call them bitches.
 
Joined: 05 Aug 2015
Location: Playing in the snow

Re: Changing multiple CVARs in MenuDef

Postby Lord Misfit » Sun Nov 18, 2018 6:44 pm

You need to define aliases for your "set to default" command[s] in the KEYCONF lump of your project:

Code: Select allExpand view
alias mygame_defaults1 "set mygame_var1 [whatever the default number is]; set mygame_var2 [whatever the default number is] (etc)"


Then in MENUDEF:

Code: Select allExpand view
   Command "Restore Default Settings",          "mygame_defaults1"


Hope that helps. o.o
User avatar
Lord Misfit
Servant of Aetherius?
 
Joined: 27 Dec 2006
Location: Canton, OH
Discord: Lord Misfit#9594

Re: Changing multiple CVARs in MenuDef

Postby LanHikariDS » Thu Dec 06, 2018 9:46 pm

Aha, thank you!
User avatar
LanHikariDS
Some people call these demons, I call them bitches.
 
Joined: 05 Aug 2015
Location: Playing in the snow


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest