dizietemblesssma Posted August 9, 2022 Share Posted August 9, 2022 Is there a way to get the MCM menu to display some value from a script property thus: "This text never changes" "this is the property value that might change" I can't seem to find a control type that does this and I'm thinking it might not be possible? diziet Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 9, 2022 Author Share Posted August 9, 2022 I solved this by rooting around in the github pages for MCM and writing: { "id": "speedmult_display", "type": "text", "help": "Displays the resultant speed multiplier.", "textFromStringProperty": { "form": "dz_F4_little_things.esp|0800", "scriptName": "dz_F4_little_things_quest_script", "propertyName": "multiplier_display" } }, however I cannot get MCM.Refreshmenu() to update the display of the property "multiplier_display", even though the value of that value is changed by another control on the same page, and debug.trace statements show that the property is successfully altered.Am I misunderstanding what MCM.Refreshmenu() does or is there a special way to use it?I've got it in this function: Function OnMCMSettingChange(string modName, string id) If (modName == "dz_F4_little_things") ; if you registered with OnMCMSettingChange|MCM_Demo this should always be true If (id == "change_speedmult") debug.trace("DF4LT: change_speedmult value was changed!") MCM.RefreshMenu() EndIf EndIf debug.trace("DF4LT: MCM setting changed") MCM.RefreshMenu() EndFunction both debug.trace lines from this show up in the papyrus.0.log but the MCM.RefreshMenu() line doesn't appear to do anything.diziet Link to comment Share on other sites More sharing options...
DlinnyLag Posted August 9, 2022 Share Posted August 9, 2022 (edited) Am I misunderstanding what MCM.Refreshmenu() does or is there a special way to use it? Yes, you are misunderstanding. And it is encoded in the name of OnMCMSettingChange function.It is about "settings" change that are stored in settings.ini for your mod. It is not about game's value change.You have to initialize your in-game value to the same value as in setting.ini to avoid inconsistency. On game load, for example. You can use MCM.GetModSetting* functions for it. You can put the value(s) to settings.ini ahead of time and update your in-game values when MCM calls OnMCMSettingChange. You can call MCM.GetModSetting* functions here.An example from my mod: snippet from config.json: { "id": "sModeratePositiveColor:Default", "text": "Moderate Positive color", "type": "textinput", "help": "0x00RRGGBB", "valueOptions": { "sourceType": "ModSettingString" } }, from settings.ini: [Default] sModeratePositiveColor = 0x002E86C1Be aware about naming convention. Id in config.json must match definition in settings.ini the MCM.RefreshMenu() line doesn't appear to do anything. This function should be called after calling of SetModSetting* in OnMCMSettingChange to enforce MCM to re-read changed settings file and update UI. Edited August 9, 2022 by DlinnyLag Link to comment Share on other sites More sharing options...
dizietemblesssma Posted August 9, 2022 Author Share Posted August 9, 2022 Hmm, thanks for replying. I am a little confused though, my function: Function OnMCMSettingChange(string modName, string id) If (modName == "dz_F4_little_things") ; if you registered with OnMCMSettingChange|MCM_Demo this should always be true If (id == "change_speedmult") debug.trace("DF4LT: change_speedmult value was changed!") MCM.RefreshMenu() EndIf EndIf debug.trace("DF4LT: MCM setting changed") MCM.RefreshMenu() EndFunctionis clearly being called as my papyrus .0.log shows:[08/09/2022 - 04:46:26AM] DF4LT: function dz_new_mod_speedmult called[08/09/2022 - 04:46:26AM] DF4LT: new speedmult mod selected is -9.000000[08/09/2022 - 04:46:26AM] DF4LT: game reports speedmult as 91.000000[08/09/2022 - 04:46:26AM] DF4LT: multiplier_display is The current speedmult actorvlaue is91.000000[08/09/2022 - 04:46:26AM] DF4LT: change_speedmult value was changed![08/09/2022 - 04:46:26AM] DF4LT: MCM setting changed the last two lines of that log excerpt come from the two debug.trace statements in OnMCMSettingChange and are not produced by any other code. Clearly I am catching the OnMCMSettingChange event, although I have no settings.ini.Are you saying that MCM.RefreshMenu() does not update the menu display with changed values of script properties (which the log excerpt show me have changed), but only updates the menu with changed values stored in settings.ini? diziet Link to comment Share on other sites More sharing options...
Recommended Posts