WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Massive buying macro (https://www.wowinterface.com/forums/showthread.php?t=58158)

leftleft 08-18-20 07:48 PM

Massive buying macro
 
Quote:

/run C={GetCursorInfo()}if C and (C[1]=="merchant")then BuyMerchantItem(C[2],20)PickupMerchantItem(C[2])end
You have to pick a item from merchant's list and use this macro. Then you can buy that item by 20 units.
Of course, you can edit the quantity. You can test by 1 unit.



I used this macro to buy by 1000 units. Like this,
Quote:

/run C={GetCursorInfo()}if C and (C[1]=="merchant")then BuyMerchantItem(C[2],1000)PickupMerchantItem(C[2])end

Seerah 08-19-20 11:30 AM

Stick a local in front of your declaration of the C variable so that your macro doesn't collide with any other poorly named leaked globals also named C in any addons you use.

Code:

/run local C={GetCursorInfo()}if C and (C[1]=="merchant")then BuyMerchantItem(C[2],20)PickupMerchantItem(C[2])end

leftleft 08-31-20 09:42 PM

It's a 3 option macro which could be used often.
You can buy 1000 units by executing this macro when pressing Ctrl key, 20 units when pressing Alt key. And default quantity is 100 units.

Code:

/run C={GetCursorInfo()}if C and (C[1]=="merchant")then a=100;if IsControlKeyDown()then a=1000;end;if IsAltKeyDown()then a=20;end;BuyMerchantItem(C[2],a)PickupMerchantItem(C[2])end

Rilgamon 09-01-20 03:20 AM

And without making your variables 'C' and 'a' local you can run in situations that are not predictable.

Especially when you have one of the following (luckily mostly outdated) addons
C: https://www.townlong-yak.com/globe/wut/#q:C
a: https://www.townlong-yak.com/globe/wut/#q:a

leftleft 09-18-20 10:05 PM

There is no 255 units limitation. You can buy 1000 units fully by executing this macro when pressing Ctrl key.
You can buy 100 units when pressing Alt key.
And to buy stack by stack, default quantity is the maximum stack size of that item.( e.g) 1, 20, 200)

Code:

/run C={GetCursorInfo()}if C and C[1]=="merchant"then i=C[2]p=GetMerchantItemMaxStack(i)a=p;if IsControlKeyDown()then a=1000;end;if IsAltKeyDown()then a=100;end;t=a/p;if a<p then t=1;p=a;end;for k=1,t do BuyMerchantItem(i,p)end;PickupMerchantItem(i)end

Ketho 09-18-20 10:35 PM

is it me or is this guy just repeating himself

leftleft 09-19-20 12:10 AM

If you can't see what's the difference, sorry, it may be not for you.


All times are GMT -6. The time now is 05:29 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI