Project

General

Profile

 

Also available in: PDF

How to iterate through an eq2widget's structure/hierarchy

To use this test script, simply create a file in your /innerspace/scripts folder called DumpWidgets.iss and place the entire text below.   Then, you can run the script by typing the following command in the InnerSpace console (while in the game):   run DumpWidgets "EQ2UIPage[MainHUD,ZoneReuse].Child[Page,MainPage.TabPages.BattlegroundsPage]"


#ifndef DumpWidgets_i
#define DumpWidgets_i

function DumpWidgets(string startElement)
{
    variable string dumpText

    dumpText:Set["${startElement}"]
    
    if ${${startElement}.Label(exists)}
    {
        dumpText:Concat[" - Label: ${${startElement}.Label}"]
    }

    if ${${startElement}.ShortLabel(exists)}
    {
        dumpText:Concat[" - ShortLabel: ${${startElement}.ShortLabel}"]
    }

    if ${${startElement}.RowHighlighted(exists)}
    {
        dumpText:Concat[" - RowHighlighted: ${${startElement}.RowHighlighted}"]
    }

    if ${${startElement}.NumChildren(exists)}
    {
        variable int childIndex
        variable int childCount

        dumpText:Concat[" - NumChildren: ${${startElement}.NumChildren}"]

        echo ${dumpText}

        childIndex:Set[0]
        childCount:Set[${${startElement}.NumChildren}]

        while ${childIndex:Inc} <= ${childCount}
        {
            variable string elementType

            elementType:Set["${${startElement}.ChildType[${childIndex}]}"]

            variable string nextElement

            nextElement:Set["${startElement}.Child[${elementType},${childIndex}]"]

            call DumpWidgets "${nextElement}"
        }
    }
    else
    {
        echo ${dumpText}
    }
}
#endif