I'm not particularly avoiding spending money, but I'm a retired programmer, so I figured this would be a good bite-sized task that I can do to get up to speed on Lua scripting and scripting in general. It turned out to be a little bit more than bite-sized, but I haven't been excited enough to program until 5 in the morning in a long time, so that's a plus.
I am having one odd issue though. My code was doing what you said above, I don't tick the box, but I switch to experiment mode and pick up each item and drop them into the tradeskill container. The weird bit is that sometimes upon hitting "combine" I get a popup that complains about having stacked items in the tradeskill container, but I can clearly see that I have two things in there, each with a stack size of one. It doesn't happen every time. I'll attach my code in case someone has some insight into this issue.
while mq.TLO.FindItem(task.items[0]) do
--Put all of the components into the loom (or whatever)
for itemIndex,itemName in pairs(task.items) do
--print("ItemIndex " .. itemIndex .. ", Name " .. itemName);
mq.cmdf('/ctrl /itemnotify "%s" leftmouseup', itemName)
repeat mq.delay(500) until (mq.TLO.Cursor.ID()) --wait for an item to be on the cursor
mq.cmdf("/nomodkey /itemnotify enviro%d leftmouseup", itemIndex)
repeat mq.delay(500) until (not mq.TLO.Cursor.ID()) --wait for no item on the cursor
end
--Do the combine and destroy the results (easier than turning it in later)
combineFailed = false
combineSucceeded = false
mq.delay(500)
mq.cmd("/notify ContainerWindow Container_Combine leftmouseup")
repeat
mq.doevents()
mq.delay(100)
until (combineFailed or combineSucceeded)
if (combineSucceeded) then
repeat mq.delay(500) until (mq.TLO.Cursor.ID()) --wait for an item to be on the cursor
mq.cmd.destroy()
repeat mq.delay(500) until (not mq.TLO.Cursor.ID()) --wait for no item on the cursor
end
end
The basic gist is that I have a data structure telling me what items are used in which quests (not depicted). I also have two mq.event callbacks for success or failure of the combine (these are also not depicted, but they set the combineFailed and combineSucceeded flags).
So the flow is:
1. Loop as long as I have some of the first recipe item (since it is CR and not farmed, they all should be equal).
2. Loop over all items in the recipe, for each item: pick one up, place it into the container.
3. Clear my fail/success flags so that I won't advance until I get one callback or the other.
4. Hit the combine button
5. Wait for one of the callbacks to set one of the two flags
6. If I had a success then I just destroy the item on the cursor (since I only care about getting the skill ups--I don't care about the quest, but maybe that's wrong).
The trouble kicks in on step 4. Sometimes I hit the combine button and just get a popup saying that I have stacked stuff (but I can see I haven't). It is consistent for one run of the script. It either combines the whole pile successfully. But if it fails the first time then it is stuck waiting on the callback, but I can manually dismiss the popup and manually hit the "combine" button (again) and then the automation happily proceeds all the way to adding the two items and hitting combine, but getting stuck again.
I'm thinking the issue may be with the ctrl key. I'm a bit unclear on this. I'm assuming that /nomodkey says that none of ctrl, shift, alt are pressed? Is that remembered across calls, so if I make one "cmd" call with /ctrl, will that still be in effect on future calls if I don't say /nomodkey? I'm considering doing explicit leftmousedown events as well, before each leftmouseup, just in case they make the client happier.
Thanks for the help.