Changing multiple CVARs in MenuDef

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!)
Post Reply
User avatar
LanHikariDS
Posts: 179
Joined: Tue Aug 04, 2015 11:30 pm
Location: Playing in the snow

Changing multiple CVARs in MenuDef

Post by LanHikariDS »

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
Lord Misfit
Posts: 221
Joined: Wed Dec 27, 2006 8:13 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: Canton, OH
Contact:

Re: Changing multiple CVARs in MenuDef

Post by Lord Misfit »

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

Code: Select all

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 all

	Command "Restore Default Settings", 			"mygame_defaults1"
Hope that helps. o.o
User avatar
LanHikariDS
Posts: 179
Joined: Tue Aug 04, 2015 11:30 pm
Location: Playing in the snow

Re: Changing multiple CVARs in MenuDef

Post by LanHikariDS »

Aha, thank you!
User avatar
Revae
Posts: 98
Joined: Wed Jul 02, 2014 7:52 pm
Location: CA
Contact:

Re: Changing multiple CVARs in MenuDef

Post by Revae »

Hey, an old thread relevant to my interests...
The problem with this seems to be that it won't save the cvars between plays. You can't exec an external list of settings from an alias, either. Or force a writeini.
So what do? How would I set something like this up without the player having to hop into the menu every time they play?
Post Reply

Return to “Scripting”