• You've discovered RedGuides 📕 an EverQuest multi-boxing community 🛡️🧙🗡️. We want you to play several EQ characters at once, come join us and say hello! 👋
  • IS THIS SITE UGLY? Change the look. To dismiss this notice, click the X --->

Question - Any Way To Open a Loom From A Script? (1 Viewer)

Joined
Jan 29, 2023
RedCents
156¢
I'm trying to write a Lua script to do all of the Crescent Reach beginner tradeskill quests automatically. I've got my guy navigating around and getting quests, however, I can't seem to figure out how to open the Loom (or Oven, etc.). I was hoping the tradeskill stuff would show up in the MQ Console -> Inspectors -> Switches, but they don't appear to. It would really suck if the user needs to intervene to click the Loom/Oven/etc.

Thanks for the help.
 
Solution
So just to summarize the correct answer, so that I can accept it (all the credit goes to @wired420):

1. /itemtarget loom -- this will target the named item in the world
2. /click left item -- this will click on the item.

Note that you first need to move near the item. You can also use "/mapfilter ground show" and/or "/mapfilter object show" to discover the name of the items.
I am able to "/itemtarget loom" and it says "Item 'Loom' targeted. However, when I try to "/click left" it is clicking left exactly where my cursor is located. I guess if I pitch my camera just right it may be possible. Is there any way to just activate my target without needing my mouse to be in precisely the correct location? Thanks.
 
You will also have to go into experiment mode, since you never made the recipe before..

and the open tradeskills window with right click should be unchecked I believe:

mq.cmd(
'/notify OptionsWindow OGP_TradeskillCtrlClickCheckbox leftmouseup')


Experiment click

mq.cmd('/notify TradeskillWnd COMBW_ExperimentButton leftmouseup')

There is a resource that already does all this, and so much more, it just happens to be the one I made.. but if you are going for 0 dollars and 0 cents, your way is the way..

 
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.

INI:
    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.
 
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.

INI:
    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.

If a combine fails but you have Salvage AA's you would need to check the container, to clean it out, before starting the combine process again. It may have items left over and that would definitely cause the stack dialog.

Additionally, you will have to make a component population routine for the portable containers, if you've not already.

Also, to get to 54, you will need to go through several quests with the same NPC, so it will cap at a specific skill level, you would need the next quest to keep increasing the skill level.

To complete the automation, not sure how far in the weeds you are..

buy containers as needed, nav to npcs and static containers, check for task updates and keep requesting items as needed, turn in items, destroy leftovers, get next quest, on and on..

I am using this to combine:

mq.cmd('/notify ContainerCombine_Items Container_Combine leftmouseup')
 
Last edited:
Thanks I'll try your combine command later (after going to lunch lest I lose my wife). I'm in the weeds still. I'm not sure I intend to care about anyone with tradeskill AAs because this script is only going to do the free combines in CR (but now I'm porting it over to an Abysmal Sea version instead). If I want to do something beyond that then I'll make a different script.
 
OMG I finally figured out why I was getting that popup. I had a mixing bowl in my inventory. Whenever it was open then it was ambiguous which combine button was to be pressed (community loom or mixing bowl) and I guess it favored the mixing bowl over the community loom. Anyway, I just need my bags closed and then its all good. There is probably a way to disambiguate this, no?
 
OMG I finally figured out why I was getting that popup. I had a mixing bowl in my inventory. Whenever it was open then it was ambiguous which combine button was to be pressed (community loom or mixing bowl) and I guess it favored the mixing bowl over the community loom. Anyway, I just need my bags closed and then its all good. There is probably a way to disambiguate this, no?
INI:
    /while (${Window[ContainerCombine_Items].Open}) {
        /notify ContainerCombine_Items StandardDoneButton leftmouseup
        /delay 3s !${Window[ContainerCombine_Items].Open}
    }
Close all open container windows before you open the one you want.

INI:
#Event CombineOK        "You have fashioned the items together #*#"
#Event CombineOK        "You have luckily fashioned the items together #*#"
PS: there are 2 valid combineSucceeded events. Don't know if you noticed.

INI:
        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
What you are doing here is exceedingly dangerous. You know what you expect to make, check your cursor (item name) if that is the item that you expect. Recently they royally messed up and the order of item return was not the made item first, lots of blah blah reason why this is now going to be the case. After some pushback made item is once again returned first, just don't rely on that order.
 
Last edited:
Question - Any Way To Open a Loom From A Script?

Users who are viewing this thread

Back
Top