http://ezserver.online/forums/index.php?topic=5513.0^ ^ ^ This is a running thread with different things I've found useful with MQ2.
As much as I enjoy trying to figure all this mq2 code out, I realize most people probably either don't know what they need nor have the motivation to learn since very few come from a coding background. Most people play EZ to get away from having to focus too hard on things they aren't motivated by. So this next snippet is going to focus on something everyone on EZ should be familiar with again...social hotkeys. I could post a long line of code and tell you where to copy and paste it and tell you how to execute it in game, but before I get ahead of myself and lose your interest I'm just going to show a hotkey you can use to track kill counts in T10.
This will check to see if you task window is open, if it isn't then it'll open it using the default keybind alt+q. Then is checks your active quest list to see a quest that matches [IV: For]. If found, it clicks on that quest. The next line again checks for a quest that matches [IV: For] and puts the task objective(s) into the bccmd window. I do a second check for the quest before sending the objectives to the bccmd channel because if I didn't, it would send whatever quest I had highlighted's objectives. Then this button executes the alt+q keypress again to close the window. No multilines, no nested if statements, just 4 simple lines to put into a social hotkey.
.
.
.
Note: This will ONLY work for the specified quest.
The code can be cannibalized and used for other kill quests by simply changing the search parameters for what .List[ ] is looking for.
For the plagueborn kill quest QFI: Purge the Plagueborn:
Line 1: /if (!${Window[TaskWnd].Open}) /keypress alt+q
Line 2: /if (${Window[TaskWnd].Child[TASK_TaskList].List[QFI: Purge,2]}) /notify TaskWnd TASK_TaskList listselect ${Window[TaskWnd].Child[TASK_TaskList].List[QFI: Purge,2]}
Line 3: /if (${Window[TaskWnd].Child[TASK_TaskList].List[QFI: Purge,2]}) /bc ${Window[TaskWnd].Child[TASK_TaskElementList].List[1,2]} Plaugeborn Kill Counter
Line 4: /if (${Window[TaskWnd].Open}) /keypress alt+q
The part in particular you are interested in for selecting the task from the window is line 2. One thing you need to know is the name of the task in the task window. Breaking down this line of code:
/if (${Window[TaskWnd].Child[TASK_TaskList].List[QFI: Purge,2]}) /notify TaskWnd TASK_TaskList listselect ${Window[TaskWnd].Child[TASK_TaskList].List[QFI: Purge,2]}The /if is checking a condition. The condition it is checking is the MQ2 TopLevelObject, or TLO, Window. This is an object that MQ2 has access to the properties of, any UI window would be a TLO. So we need to tell MQ2 which window we want it to work with and that is nested in the brackets right after the TLO Window[
HERE ]. In this particular code, the window being manipulated is the Task Window known to MQ2 as TaskWnd. You can read up on the Window TLO here >
https://www.macroquest2.com/wiki/index.php/TLO:Window. Now we haveto tell MQ2 what part of the TaskWnd we want to work with. You can see that we want a Child element of the TaskWnd named TASK_TaskList. This is chained from the Window object with a period to the child element TASK_TaskList and tells MQ2 with another chain-period that it's of the data type List.
Now that MQ2 is looking at the TLO > Window > TaskWnd > Child Element TASK_TaskList > Of Data Type List
We can manipulate the List itself. The list would be whatever quests/tasks that are currently populating the Task Window. This is where we need to tell MQ2 which item in the list of items we want to work with. This particular code is targeting a Quest whose name Starts with the text
QFI: Purge. It also tells MQ2 what index to start it's search at. The reason 2 is the index is because the index for the data type List starts at 1 as opposed to the normal zero based index and the first index is the letter Q, if you look in your task window you can confirm this. So index 2 is where the text I want to tell MQ2 to match starts.
You then use the /notify command for MQ2 to click the task. You need to tell it which window to work with so again, after the /notify command I tell it to use the TaskWnd and child TASK_TaskList then use the command
listselect to select the list item from the TLO window. It's the same code as the previous code use in the /if conditional check. So the whole line of code reads:
If there exists a quest/task in the
TLO Window named
TaskWnd with child element
TASK_TaskList that matches
QFI:Purge, THEN use the notify command on the Window named
TaskWnd on the child element
TASK_TaskList and select the element of the list data type with text matching
QFI:Purge.
This will make the character select the quest on their task window if it's found. To clarify why I'm using the /if conditional to check before actually clicking on the quest itself, I do this because I want to make sure the quest is actually in the character's window before trying to execute the code to select it. This particular code is what I use to /bca to all my toons for them to echo back to me on line 3 with the count of how many mobs they have killed out of how many are needed to finish the quest. But you could omit that part and just tell them to tell the toon to port them or whatever it is you're trying to do. I'd suggest first making sure the Task Window is open for MQ2 to manipulate though at first, you can use the alt+q keypress of the DoOpen method of the Window TLO to make sure it's open.
The code for that hotkey would look something like :
Line 1:
/bca target TargetNameLine 2:
/if (!${Window[TaskWnd].Open}) /keypress alt+qLine 3:
/if (${Window[YourWindow].Child[YourChildElement].List[YourTaskName,2]}) /notify YourWindow YourChildElement listselect ${Window[YourWindow].Child[YourChildElement].List[YourTaskName,2]}Line 4:
/bca hail (or whatever you do/say to get into the zone)
That's the quick and dirty and I'm sure confusing answer to your request. If you run into any issues don't hesitate to ask either in a reply here or in game to Dimurwar and I'll try to help you get it set up the way you want it. There are a few other pieces of code that might help your playstyle here >
http://ezserver.online/forums/index.php?topic=5513.0