Jump to content

MCM script errors in papyrus.0.log


Recommended Posts

BIG EDIT I had a tiny thought, your just trying to display the armor slots while not manipulating it, why are you even using states? OVER KILL anyone? Just use a plain text options

 


Form[] akItems = PlayerRef.GetContainerForms()

Int nIndex = akItems.Length

While nIndex

  nIndex -= 1

  Armor akArmor = akItems[nIndex] As Armor

  If akArmor != None && akArmor.IsPlayable() == True

   If PlayerRef.IsEquipped(akArmor)

    self.AddTextOption(akArmor.GetName(), GetbodySlot(akArmor.GetSlotMask()))

   EndIf

  EndIf

EndWhile

If you want to say click on it and get the armor rating yeah you need states, just to display it, no, btw I kept it simple, I could listed the the armor in inventory he was not wearing.

 

 

 

Is my code not analogous to yours in presentation? I use an array _npc_text_slots[] because elsewhere in my code I iterate through it to unequip or not according to the users checking the textoption true or not.

SetCursorPosition(7)
  SetCursorFillMode(TOP_TO_BOTTOM)
  i = 46
  While i < 62
   AddHeaderOption("$Slot_"+i)
   AddTextOptionST("$slot"+i,"",_npc_text_slots[i - 30])
   SetTextOptionValueST(_npc_text_slots[i - 30])
   i = i + 1
  EndWhile

Perhaps I erred in using the word state to refer to the textoption that are displayed?

I have two pages to display armour, one requires the user to click a check box to fill in the armour worn by the NPC under the crosshair.

 

I've had this code working in my MCM for years, I just never had to track the error messages in my log before a user reported them:)

Anyway thanks to both for replying, I'm all sorted now on this issue:)

 

 

diziet

 

Link to comment
Share on other sites

Addendum:

 

Playing some more I found the following which I post for anyone coming here via googleduckbinging;

The MCM docs state:

SetToggleOptionValueST(bool checked, bool noUpdate = false, string stateName = "")

the optional last parameter allows to alter the boolean value of another state.

But this doesn't work if the other state is not on the same page as the state that the SetToggleOptionValueST occurs in, that circumstance leads to the error below:

ERROR: Cannot use SetToggleOptionValueST outside a valid option state

this has been the source of a lot of my confusion:) Clearly the definition of "valid option state" includes (amongst other things) being on the same page!

For newbies like me who wish to have an OnSelect() event alter the boolean value of a state on other page it is enough to alter the variable itself e.g.

checked = !checked

and then upon the selecting the page the other state is on you will see the checkbox changed. I am assuming at the moment that all this is true for other option types as well.

No response being asked for this post. just sticking it here because I wish I had found something like this earlier:)

I'm off to double check option flags now!

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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