Jump to content

MCM call function


Recommended Posts

Hi, I'm tring to follow the example here:

https://github.com/Neanka/MCM_0.1_AS3/wiki/Control-Types

of a button, this is my first attempt at an MCM menu in F4.

This is my config.json and it does show the two buttons:

{
  "modName": "dz_no_attacks",        
  "displayName": "MCM for No Settlement Attacks",
  "minMcmVersion": 2,                        
  "content": [
  {
   "text": "Demo Button",
   "type": "button",
   "help": "This button disallows attacks at abernathy.",
   "action": {
   "type": "CallFunction",
   "form": "dz_no_attacks.esp|800",   
   "function": "dz_disallow_attacks",
   "params": []
      }
  },
  {
    "text": "Another Demo Button",
    "type": "button",
    "help": "Displays a messagebox via a CallGlobalFunction action.",
    "action": {
   "type": "CallGlobalFunction",
   "script": "Debug",
   "function": "MessageBox",
   "params": ["Hello world!"]
     }
  }
]
}

Now at the moment the call to the global debug function works, but I cannot get this function to run from the top button in my test script:

Scriptname dz_no_attacks_quest_script Extends Quest

Function dz_disallow_attacks()
debug.trace("value is ")
debug.messagebox("new value is ")
EndFunction

there is neither a message box in game, or a trace in the Papyrus.log.0 file.

The script is attached to a quest, and that quest shows up in the console so I assume it is running?

 

diziet

 

Link to comment
Share on other sites

Are you sure that your quest's formID is 800? Suspicious that it would be the exact same formID as in the sample on github.

 

 

The form field accepts the plugin name and the form ID of the form that you want to call the function on. In most cases, this form is a Quest.

For example, if your quest has the formID 0000173E, then you would specify "MyMod.esp|173E" as the form parameter. This tells the MCM where the function is located in.
Link to comment
Share on other sites

Yes it is 800, it was F99, but in an attempt to cover every possibility I changed it and then changed the config:)

As for the function not being global, that is confusing, because the necessity of specifying the form and script seems odd for a global function, and the MCM config posted has a section for a global function, which is a different format?

Is my mistake in expecting the trace or messagebox to work from an MCM menu?

 

diziet

Link to comment
Share on other sites

Well I fixed it , but I don't know how. I decided to deliberately make the esp name false to see what error message I would get. Sure enough in MCM.log it said the esp was wrong, which meant at least that the MCM menu was getting that far, I simply renamed the esp back, and it started working! Since all I did was removed the first 's' in:

"form": "dz_no_attacks.esp|800"

and then put it back, I have no clue, perhaps some odd formatting thing in notepad++?

 

Anyway, thankyou for your replies.

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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