Lots of CVARs and config saving [split]

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Lots of CVARs and config saving [split]

Post by Accensus »

So if you have a mod that adds 50 CVARs (there is one such mod), and you want to have default values each time the mod starts up, you have to load each and every CVAR's default value in autoexec.cfg? Or even worse, delete the CVARs from the user's ini file? Your workaround may work, but it's exactly 0% practical, even for non-mod CVARs.
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: "don't save changes on exit" cvar

Post by Rachael »

First I have to wonder - what does a mod need 50 CVARs for - and secondly, is there any reason you're particular over all 50 of them?
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: "don't save changes on exit" cvar

Post by Accensus »

Didn't quite get your second question, but to answer the first - CustomDoom has 72 CVARs and I need those to be able to adjust each option separately. There's a lot of stuff in there. I've put a "Restore to defaults" button, of course, but that's a rare case. I think a CVAR to rule them all is not a bad idea. Being able to purposely not save only the CVARs (both mod and non-mod) may or may not prove useful. Saving the .ini like Blue Shadow said may backfire if you change your controls or other options and forget to update the .ini. You'll end up with an old copy. Been there, done that, but with a mod. Accidentally reverted a few changes which opened some work for me.
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: "don't save changes on exit" cvar

Post by Rachael »

The second question was asking why all 50 (or 72 in this case) needed to be explicitly set.

I guess for CustomDoom, that makes a bit of sense. For that, though, it might just be more practical to write an INI manager that can export and import CustomDoom's settings, creating a kind of "profile" system. Everything ZDoom exports for CustomDoom, specifically, will be in its own section, making it easy to extract and replace the section easily.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: "don't save changes on exit" cvar

Post by Accensus »

Well, to not have them changed, that's why. Of course, you could set only the ones you want to use so they won't get overwritten, but with a mod like that you never know what you'll use at a given moment.

As for the export thingy, that actually sounds like a very good idea, but I don't really know how to make one such system. How to get ZDoom to export the CVARs in their own section? (You can PM me if you don't feel like derailing the thread.)
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: "don't save changes on exit" cvar

Post by Rachael »

ZDoom itself can't do it, but it wouldn't be too hard to write a program that can. That same program can translate each variable into a console command, so that you can exec them in on the fly.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: "don't save changes on exit" cvar

Post by Accensus »

Seems like I lack both the imagination and skill to make such a program.
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: "don't save changes on exit" cvar

Post by Rachael »

Can you post or PM a config snippet? I'm not able to get CustomDoom to export settings, myself, so I am stuck trying to develop a script blind for it.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: Lots of CVARs and config saving [split]

Post by Accensus »

Spoiler: CVARINFO
Spoiler: Config File
I suppose the CVARs is what you need. Here are all of them with their default values. And, Eruanna, thank you for taking your time to write that script. Putting your name on the special thanks list. May not mean much, but it's better than nothing, I guess. Even if you don't succeed, the name will stay. Efforts like these are greatly appreciated. :)

EDIT: Thanks go to wildweasel, too, for moving the thread. :)
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Lots of CVARs and config saving [split]

Post by Rachael »

I'm creating a cmd script - I mostly just needed the section name. Having the actual entries will be useful too, though, as it will allow me to test.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: Lots of CVARs and config saving [split]

Post by Accensus »

Still, I don't even remember the last time I wrote a batch file. Most useful one I've written was a simple copy, rename, delete to automate a mod backup. I thought you were writing it in Python or something.
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Lots of CVARs and config saving [split]

Post by Rachael »

Okay, wow, this is going to be harder than I thought. I thought ZDoom separates each mod's CVAR list to its own section, I was wrong. I'll have to use the CVARINFO after all. This script is going to be a little lengthy, but I am using subroutines as much as possible to cut down on repeated code.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: Lots of CVARs and config saving [split]

Post by Accensus »

Could you give me more info on how the script is expected to work? Do you feed it external values from a file which it reads and modifies in the actual config file? It might be kinda pointless in the case of CustomDoom to keep the values to their defaults as there's a "Reset to defaults" button which is handled directly by the mod. Unless the point of this is to make a profiling system.
User avatar
Rachael
Posts: 13968
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Lots of CVARs and config saving [split]

Post by Rachael »

Well, what I thought you wanted was a script where you would type at the command line, something like:

Code: Select all

> custom-doom-export super-hard-profile.cfg
And then it would export the variables from your zdoom.ini file (using a bit of a "search" to find where it is) and export all custom doom variables into a file, like this:

Code: Select all

set custom_doom_var1 0
set custom_doom_var2 3
... etc
so that you could later execute in ZDoom's console this command:

Code: Select all

exec super-hard-profile.cfg
And bam.
User avatar
Accensus
Banned User
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: Lots of CVARs and config saving [split]

Post by Accensus »

Hmm, I gotta try this out for myself. I am starting to understand now. One question, though: what will happen if I add more CVARs? I suppose I'll have to edit the source code of the script in order to reflect the changes and whatnot.
Locked

Return to “Editing (Archive)”