The LootWindow

The following script illustrates advanced topics on how to obtain information from and manipulate the LootWindow. The comments provided, along with the ISXEQ2 wiki, should provide the documentation necessary to work with the LootWindow in all modes.

function main()
{
;; If no lootwindow is up/available, we can't do very much
if !${LootWindow(exists)}
{
echo "No LootWindow Available"
return
}

;;;; NOTES:
;;;; 1. To select a groupmember from the dropdownbox (i.e., when using "Leader Only" loot), simply call the Set
;;;; METHOD of the eq2dropdownbox with the index of the one you want. For example, using the routine above,
;;;; once you matched the name of the person you wanted: LootWindow.GroupMembers:Set[${GroupMembersCounter}]
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

do
{
;; The "ItemsPage" MEMBER of the 'eq2lootwindow' datatype has various UI elements as children. This script
;; is only interested in the 'eq2icon' children, as there will be an icon for every item and it is the "icon"
;; that needs to be LeftClicked to indicate selection.
if (${LootWindow.ItemsPage.Child[${ChildrenCounter}].Type.Find[eq2icon]})
{
;; if the icon's "NodeID" is less than or equal to zero, then it's a blank placeholder, and we skip it.
if (${LootWindow.ItemsPage.Child[${ChildrenCounter}].NodeID} <= 0)
continue

;;;; NOTES:
;;;; 1. To select an item in the window (i.e., when using "Leader Only" loot), simply call the LeftClick
;;;; METHOD of the icon that has the NodeID that matches the ItemID for the item you wish to select.
;;;; For example, LootWindow.ItemsPage.Child[${ChildrenCounter}]:LeftClick
;;
;; (UPDATE: Per the issue raised in http://forge.isxgames.com/issues/1780, it may be necessary
;; to LeftClick the corresponding eq2text rather than eq2icon.)
;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If using "Leader Only" loot, once the script has set the correct group member's name from the
;; GroupMembers, and selected the intended item from the ItemsList, all that is left is to call:
;; LootWindow.LeaderAssign:LeftClick
}