Jump to content

MCM slider option and papyrus function


Recommended Posts

Here is the MCM example for a slider:

{
  "text": "Demo Slider",
  "type": "slider",
  "help": "A standard slider with constraints. Range: 0-1, Step: 0.01.",
  "valueOptions": {
    "min": 0,
    "max": 1,
    "step": 0.01
  }
}

but there is no indication of how I might pass the selected slider value to a function in a papyrus script, can someone please help?

 

diziet

 

Link to comment
Share on other sites

You could make it directly modify a global via

        "sourceType": "GlobalValue",
        "sourceForm": "mymod.esp|xxxx"

where xxxx is the (hex) formid of that global in your mod (without the load order prefix).

You could then tell your mod to notice the change by also adding

			  "action": {
					"type": "CallFunction",
					"form": "mymod.esp|xxxx", 
					"function": "SettingsUpdated"}

to call your update procedure (or just use the action to do the work directly)

These live after your "step" line before the next }.

 

Update: Remember the function won't be called until you close MCM (as the game is paused), and the keywords like "action" etc must all be lowercase.

Edited by PJMail
Link to comment
Share on other sites

Hi, thanks for the info.

I weant with using "sourceType": "PropertyValueFloat", which has worked with other MCM json files but with this one the property doesn't get updated by the slider, here si the snippet for the slider, the MCM menu shows up in game and the slider gives every appearance of working:

"text": "Select the player's carryweight modifier.",
  "type": "slider",
  "help": "Choose the new carryweight modifier, steps of +/- 100",
  "valueOptions": {
   "min": -200,
   "max": 10000,
   "step": 100,
   "sourceType": "PropertyValueFloat",
   "sourceForm": "dz_F4_little_things.esp|0800",
   "scriptName": "dz_F4_little_things_quest_script",
   "propertyName": "Carry_modifier_float"
      },
  "action": {
    "type": "CallFunction",
    "form": "dz_F4_little_things.esp|0800",
    "scriptName": "dz_F4_little_things_quest_script",
    "function": "dz_new_mod_carry"
    }

but using a simple version of dz_new_mod_carry() that logs the value of Carry_modifier_float shows that it remains 0,

Carry_modifier_float is properly set in the CK on the script:

any ideas?

 

diziet

Link to comment
Share on other sites

in answer to my own question it seems that the property is not set just read, so I need to pass the new setting via:

"action": {
    "type": "CallFunction",
    "form": "dz_F4_little_things.esp|0800",
    "scriptName": "dz_F4_little_things_quest_script",
    "function": "dz_new_mod_carry",
    "params": ["{value}"]
    }

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...