Jump to content

Question about GetName() from a formlist


Recommended Posts

So GetName() can pull an item name off an item that is on a formlist with no problem, but it can't do so from a nested FormList (a formlist within a formlist). Can anyone think of a way to structure a simple function such as if it calls GetName() on the index and results in NONE to call up the formlist AT said index and run GetName() on that list's index 0 instead? I'm just mentally fried at the moment and get get my head around it. I've managed to condense my 2K+ lines of MCM code down to a few hundred, but this one function is sort of holding me up. Thanks in advance.

Link to comment
Share on other sites

Well maybe I have a solution. I coded this to check if the GetName() result string is "" or not (returns text or none) and if it returns no text fill another property with what FormList is at the index location and then poll it's 0 index for a name. Compiles fine, but wanna check here before testing it out.

 

 

Function ListItem()
   ObjectReference DISP
   Form ITM

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

EndFunction
Link to comment
Share on other sites

Nevermind I got it working. Had some functions conditioned in the wrong order :P

 

 

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
        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

  • Recently Browsing   0 members

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