Remove Advertisements

Macro that counts gear in your inventory

All things /script related

Moderators: Fridmarr, Worldie, Aergis, _Chloe

Macro that counts gear in your inventory

Postby DisRuptive1 » Sun Oct 07, 2012 3:19 pm

I need a macro that will tell me how much Living Steel I can make so I know when I need to stop farming. I want the macro to add the following numbers together:

  • Amount of Ghost Iron Ore divided by 120
  • Amount of Trillium Bars divided by 6
  • Amount of Living Steel I have in my inventory
  • Amount of Black and White Trillium Ore divided by 24 (I know)

and then whatever number I get, round it down, and do it within 255 characters, although if it can do what it needs to do and takes up multiple macro spaces that's fine too. I don't know enough this can be done or not but I don't know enough about scripts which is why I'm asking. I'd be perfectly happy with a macro that could only do the first bullet point (rounded down).
User avatar
DisRuptive1
 
Posts: 181
Joined: Sat May 17, 2008 12:50 pm

Re: Macro that counts gear in your inventory

Postby Zalaria » Mon Oct 08, 2012 4:42 am

I think this is close. I don't have enough of the ingredients on me, so I can't test it. It's at 204 characters, includes ghost iron bars (which you didn't mention), and uses the lower of your black and white trillium.


edit: this isn't right, but left for posterity. Better one to come later in the thread.
Code: Select all
/run local g,h,w,b,l,t,f=GetItemCount(72092),GetItemCount(72096),GetItemCount(72103),GetItemCount(72094),GetItemCount(72104),GetItemCount(72095),math.floor;print(f((g/2+h)/60)+f(t/6)+l+f(math.min(w,b)/2))



I could trim it down more by making a variable to call GetItemCount, but this fits.
Last edited by Zalaria on Mon Oct 08, 2012 1:20 pm, edited 1 time in total.
Dovie'andi se tovya sagain - It's time to roll the dice
User avatar
Zalaria
Maintankadonor
 
Posts: 646
Joined: Tue Sep 11, 2007 7:27 am

Re: Macro that counts gear in your inventory

Postby DisRuptive1 » Mon Oct 08, 2012 9:40 am

Wow, I didn't think it was possible. For the most part, the macro works just as I envisioned it. Because it's working so well, may I ask for your assistance to make the macro a bit more specific?

Specifically, it takes 12 White Trillium Ore and 12 Black Trillium Ore to make a Living Steel Bar (with an Alchemist). If I have 11 White Trillium and 13 Black Trillium, I can't get any Living Steel. Currently your macro is taking all the Trillium Ore I have, dividing it by 24, and then rounding down (just as I asked for, so thanks for delivering). Can you instead change the portion of the macro that counts trillium, take the lesser amount of Black or White Trillium Ore, divide by 12 and then round down?

For instance if I have 12 White, and 24 Black, I would want the macro to return a 1. If I have 48 Black and 10 White, I would want a 0. If I have 26 White and 48 Black, I would want a 2. Because your macro did everything I asked it to, what I want the macro to do would be:

  • Amount of Ghost Iron Ore divided by 120
  • Amount of Ghost Iron Bars divided by 60
  • Amount of Trillium Bars divided by 6
  • Amount of Living Steel I have in my inventory
  • The lesser amount of Black or White Trillium Ore divided by 12, rounded down
  • All of the above added together after each one individually rounded down
User avatar
DisRuptive1
 
Posts: 181
Joined: Sat May 17, 2008 12:50 pm

Re: Macro that counts gear in your inventory

Postby Zalaria » Mon Oct 08, 2012 1:35 pm

That's pretty close to what I tried to do, though I combined the ghost irons (ore/2 + bar) and made a mistake in the trillium ore section (it's the number of trillium bars you can make, not the number of living steel).

But you can do better.
Say you had 5 trillium bars and 10 ghost iron bars? That's a living steel.

So let's see.
Code: Select all
Living Steel = Living Steel         L1 = l
Living Steel = 6 Trillium Bar       L2 = floor(T/6)
                                    L  = L1 + L2 = l + floor(T/6)
Trillium Bar = Trillium Bar         T1 = t
Trillium Bar = 2 White Tril Ore     
              +2 Black Tril Ore     T2 = floor(min(w,b)/2)
Trillium Bar = 10 Ghost Iron Bar    T3 = floor(G/10)
                                    T  = T1 + T2 + T3 = t + floor(min(w,b)/2) + floor(G/10)
G.I. Bar     = G.I. Bar             G1 = h
G.I. Bar     = 2 G.I. Ore           G2 = floor(g/2)
                                    G  = G1 + G2 = h + floor(g/2)

Putting that all together...
    L = l + floor((t + floor(min(w,b)/2) + floor((h + floor(g/2))/10))/6)


Turning that into a macro... 158 characters, max living steel you can make with your current mats. Totally untested.
Code: Select all
/run local I=GetItemCount;local g,h,w,b,l,t,f=I(72092),I(72096),I(72103),I(72094),I(72104),I(72095),math.floor;print(l+f((t+f(math.min(w,b)/2)+f((h+f(g/2))/10))/6))


edit 10:21PM EST - fixed a bug.
Dovie'andi se tovya sagain - It's time to roll the dice
User avatar
Zalaria
Maintankadonor
 
Posts: 646
Joined: Tue Sep 11, 2007 7:27 am


Return to Add-ons, UI, and Macros

Who is online

Users browsing this forum: No registered users and 1 guest

cron

Remove Advertisements

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 380 on Tue Oct 14, 2008 6:28 pm

Users browsing this forum: No registered users and 1 guest