physicsgaming Posted September 1, 2022 Share Posted September 1, 2022 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. Link to comment Share on other sites More sharing options...
physicsgaming Posted September 5, 2022 Author Share Posted September 5, 2022 So I did not find a way to do this, but my work around was to set all values that should never be 0 to the default value whenever GetModINI returns 0. As for the values that might legitimately be 0 in the INI, they get allowed to remain at 0 and only get updated when changed explicitly by the user. Link to comment Share on other sites More sharing options...
Recommended Posts