So I have a mod that I would like to update with some additional settings that users can tweak in the MCM, and it saves all the settings to an ini file. Here is what the what the beginning of my MCM script looks like:
if GetGameLoaded
if FileExists "Config/MyMod.ini"
set MyVar to GetModINI "MyMod/Variables/Setting1"
..
else
SetModINI "MyMod/Variables/Setting1" DefaultValue
..
endif
..
endif
I can see from the GECK Wiki page about the GetModINISetting function that it returns 0 if the key is missing, which made me initially try to just run a check on each call for GetModINI to see if it returns a 0, and just set it to the default value if it does. However, I realized that the settings I want to add are numeric, and it is possible that some people would want them to be 0, so I don't want to overwrite it in that case. Is there some clever way to detect a missing ini key, using either the ini functions added by MCM, or JIP? Or is there some other simple solution that I am overlooking? Any help is appreciated.