Jump to content

MCM Script Stumped


Recommended Posts

ok I give up. Can't figure out why my MCM function isn't working in a specific instance. This code works perfectly for dozens of other menu categories but for this one category it leaves several items as blank titled check marks meaning it isn't acquiring the name of the item. The ONLY difference I can see between these missing items and the other items on the list that are working is the fact that the missing items are weapons rather than armor. The other thing is that these weapon items are actually on a sub formlist which the code is able to make a deep dive for and return the name just fine on the weapons. Furthermore this function works as written on any named object no matter of form type if it's on the native formlist rather than a subform.

 

Any advice is appreciated.

 

 

Function ListItem()
   ObjectReference DISP
   Form ITM

While Index < ITMCNT
    DISP = DISPLIST.GetAt(Index) as ObjectReference
    ITM = ITMLIST.GetAt(Index) as Form
    
    if ITM.GetName() != ""    
        ItemName = ITM.GetName()
    else
        SubList = ITMLIST.GetAt(Index) as FormList
        ITM = Sublist.GetAt(0) as Form
debug.notification("item is " + ITM.getname() + " ")
        ItemName = ITM.GetName()
    Endif
        if DISP.IsEnabled()
            AddToggleOption(" " + ItemName + " ", true)
        else
            AddToggleOption(" "+ ItemName +" ", False)
        endif
    Index += 1
EndWhile

EndFunction
Link to comment
Share on other sites

Because it's just for the purposes of acquiring the name. The main list has 60 items and the sublists each have only 2 and they are both named the same thing (one is enchanted and one is unenchanted),and both the weapons on these sublists are properly named just like the armor items but for some reason they just will not acquire the name from weapons on sublists in this case.

Link to comment
Share on other sites

Have you tried just the line

 

if ITM.GetName()

 

instead of

 

if ITM.GetName() != ""

 

Empty Strings should return false either way

 

edit: also another thought, maybe check that the weapons don't have non-empty but blank strings in their name field, such as " " or something similar.

Edited by blennus
Link to comment
Share on other sites

  • Recently Browsing   0 members

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