• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Macro - Struggling to get this code to work on emu. Simple vendor search macro

foromoro

Well-known member
Joined
Dec 2, 2019
RedCents
233¢
Wrote a quick macro to accept input from the macro line and then search vendors for that item and report back if it's there. I know I'm still stuck in the old times, but with my limited time it's easier to stick with what I know :)

What I do not know is the following:

1) Just in general, what is the purpose of the ,2 following the Item name when checking the merchant's ItemList for that item?

2) In this specific Macro, it will only report back positive hits for items that are assigned to odd number parameters, Item1, Item3, and Item5. I do not know why? When I manually /echo the ListItem check line (line num. 20) it returns a number larger than 0, but the macro seems to completely ignore items in the Item2 and Item4 variables. Is this something related to question 1 and, hence, goes back to my larger misunderstanding of why there's a ,2 on the line to begin with?

[CODE title="itemsearch"]Sub Main(string Item1, string Item2, string Item3, string Item4, string Item5)

/declare ListID int outer 0
/declare Found int outer 0
/declare a int outer 0

:waitforwindow
/if (${Merchant.Open} && ${Merchant.ItemsReceived}) {
/goto :checking
} else {
/delay 1
/goto :waitforwindow
}

:checking
/varset Found 0
/varset a 1

/for a 1 to 5
/varset ListID ${Window[MW_PurchasePage].Child[MW_ItemList].List[=${Item${a}},2]}
/if (${ListID} > 0) {
/echo \ag YES! Merchant has ${Item${a}} !!
/if (${Found} < 1) /varset Found 1
}
/varcalc a ${a} + 1
/next a

/goto :Finishing

:Finishing
/delay 1
/if (${Found}==1) {
/echo \ayWe found some items. Take time to buy them.
/goto :WaitToBuy
} else {
/echo \at All done here for now. Go to another merchant!
/nomodkey /notify MerchantWnd MW_Done_Button LeftMouseUp
/goto :waitforwindow
}

:WaitToBuy
/if (${Merchant.Open}) {
/delay 1
/goto :WaitToBuy
} else {
/echo \at All done here for now. Go to another merchant!
/goto :waitforwindow
}
/return[/CODE]
 

int List[Text,Col]

Applies to: Combobox, Listbox, TreeView

Search a list for an item by text. Returns the index of the first element that matches the given text string.

Parameters:

  • Text: Text to search for. Partial match is performed. Prefix with = to perform an exact match.
  • Col: [optional] Column index of the item in the item in the list. If not provided, the first column is searched.
 

int List[Text,Col]

Applies to: Combobox, Listbox, TreeView

Search a list for an item by text. Returns the index of the first element that matches the given text string.

Parameters:

  • Text: Text to search for. Partial match is performed. Prefix with = to perform an exact match.
  • Col: [optional] Column index of the item in the item in the list. If not provided, the first column is searched.
Thank you, as always, for such a quick response. Looks like I was misreading this page. The info I was looking for is after each int and string. My bad.

Any chance you have any insight into why the macro only successfully fires off on odd-numbered variables?
 
Thank you, as always, for such a quick response. Looks like I was misreading this page. The info I was looking for is after each int and string. My bad.

Any chance you have any insight into why the macro only successfully fires off on odd-numbered variables?
frankly, macro code sucks, it is terrible to look at, it is rage inducing seeing the struggle that is macrocode and goto's just bleh - I also only ever kludged macros together

I imagine it is because you're varcalcing a + 1 instead of letting it go through the loop
 
frankly, macro code sucks, it is terrible to look at, it is rage inducing seeing the struggle that is macrocode and goto's just bleh - I also only ever kludged macros together

I imagine it is because you're varcalcing a + 1 instead of letting it go through the loop
Wow that's exactly what it was. Guess I didn't realize the /for loop auto increased the value of a.

Thank you again!
 
Maybe the fact that I struggled with that one line for over an hour should be my push to convert this into Lua. Seems simple enough of a place to start.
 
Macro - Struggling to get this code to work on emu. Simple vendor search macro

Users who are viewing this thread

Back
Top
Cart