EZ Server

General Category => Quest and Guides => Topic started by: Ogru on January 20, 2022, 11:55:33 am



Title: Another Combine Heroic Resists macro
Post by: Ogru on January 20, 2022, 11:55:33 am
I decided to make another combine Heroic Resists macro. It is based on Dimurs macro, but is heavily modified.

Key features:
  • Combines all resist augs in inventory (not bank) up to the max rank set, going rank by rank.
  • Only combines ranks X and XV in sets of 8 not 2
  • Works with stacked Augments
  • If you run out of inventory slots, skips to next rank

Make a file called ResistAugs.mac (or whatever you want) and paste this code into it.

To run, just type /mac ResistAugs [max combine up to rank]

Example 1: If you only have 26x Rank I augs in your inventory and ran "/mac ResistAugs IV". This would end with you having 1x Rank I, 1x Rank II, and 3x Rank IV.

Example 2: If you only have 300x Rank X augs in your inventory and ran "/mac ResistAugs XVI". This would end with you having 1x Rank XIII, 1x Rank XV, and 1x Rank XVI.


ResistAugs.mac
Code:
|==== Version 1.0
|==== Coded by Ogru for use on EZServer
|==== Based on Dimurs Heroic Resists macro
|-------------------------------------------------------
|--------- A Magic Box in slot 10 is required ----------
|-------------------------------------------------------

#turbo

|==== Sub Main
Sub Main(MaxRank)
|Adjust min/max delays if not combining properly
/if (!${Defined[minDelay]}) /declare minDelay int outer 5
/if (!${Defined[maxDelay]}) /declare maxDelay int outer 15

/if (!${Defined[HRAugsInBags]}) /declare HRAugsInBags int outer
/if (!${Defined[HROpenBagSlots]}) /declare HROpenBagSlots string outer
/if (!${Defined[MagicBoxItemCount]}) /declare MagicBoxItemCount string outer
/if (!${Defined[MaxRankNum]}) /declare MaxRankNum int outer 0
/if (!${Defined[HRRank]}) /declare HRRank string outer
/if (!${Defined[HRRankID]}) /declare HRRankID int outer

/declare i int local
/declare a string local I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX|

|Find Max Rank Number
/for i 1 to 20
/if (${MaxRank.Equal[${a.Arg[${i},|]}]}) {
/varcalc MaxRankNum ${i}-1
}
/next i

/call OpenBags

/If (${InvSlot[pack10].Item.Name.NotEqual[A Magic Box]}) {
/bc [+r+]SLOT 10 Must be A Magic Box[+x+]
/goto :TheEnd
}
/If (${InvSlot[pack10].Item.Items} > 0) {
/bc [+r+]A Magic Box in slot 10 MUST be empty to start[+x+]
/goto :TheEnd
}

|Loop through each rank of SoHR
/for i 1 to ${MaxRankNum}
/varset HRRank ${a.Arg[${i},|]}
/varset HRRankID ${FindItem[=stone of heroic resistance ${HRRank}].ID}

/call HRTallyBagSlots
/delay 1
/call HRCombineAugs
/next i

:TheEnd
/autoinventory
/cleanup

/Return
|==== End Sub Main

|==== Sub HRTallyBagSlots
Sub HRTallyBagSlots
/declare i int local 1
/declare j int local
/varset HRAugsInBags 0

/if (${FindItemCount[=stone of heroic resistance ${HRRank}]} > 0 ) {
/for i 1 to 9
/for j 1 to ${InvSlot[pack${i}].Item.Container}
/if (${InvSlot[pack${i}].Item.Item[${j}].ID}==${HRRankID}) {
/varcalc HRAugsInBags ${HRAugsInBags} + ${InvSlot[pack${i}].Item.Item[${j}].Stack}
}
/next j
/next i
/bc [+y+]Rank: ${HRRank}[+x+] > In bags: [+t+]${HRAugsInBags}[+x+] - Equipped: [+t+]${Int[${Math.Calc[${FindItemCount[=stone of heroic resistance ${HRRank}]}-${HRAugsInBags}]}]}[+x+]
}

/Return
|==== End Sub HRTallyBagSlots

|==== Sub OpenBags
Sub OpenBags
/declare i int local
/for i 1 to 10
/if (${InvSlot[pack${i}].Item.Container}) {
/if (!${Window[pack${i}].Open}) /itemnotify pack${i} rightmouseup
}
/next i
/Return
|==== End Sub OpenBags

|==== End Sub CheckBagSpace
Sub CheckBagSpace
/declare i int local
/varset HROpenBagSlots 0
/for i 1 to 9
/if (${InvSlot[pack${i}].Item.Container}) /varcalc HROpenBagSlots ${HROpenBagSlots}+${Int[${Math.Calc[${InvSlot[pack${i}].Item.Container}-${InvSlot[pack${i}].Item.Items}]}]}
/next i
/varset MagicBoxItemCount ${InvSlot[pack10].Item.Items}
/Return
|==== Sub CheckBagSpace


|==== Sub HRCombineAugs
Sub HRCombineAugs
/declare Bag int local 1
/declare Slot int local
/declare FirstPass bool local true
/declare TotalAugsInBags int local ${HRAugsInBags}

:CombineLoop
/call CheckBagSpace

|--- Rank X and XV
/if ((${HRRank.Equal[X]}) || (${HRRank.Equal[XV]})) {
/if (${TotalAugsInBags}<8) /goto :TheEnd
/if (${Math.Calc[${MagicBoxItemCount}+${HRAugsInBags}]}<8) {
/goto :TheEnd
}
/if ((${HROpenBagSlots}<1) && (${Math.Calc[${MagicBoxItemCount}+${HRAugsInBags}]}>8)) {
/echo Not enough bag slots, moving to next Rank
/goto :TheEnd
}

|--- All other Ranks
} else {
/if (${HRAugsInBags}<2) /goto :TheEnd
/if ((${HROpenBagSlots} < 1) && (!${FirstPass})) {
/echo Not enough bag slots, moving to next Rank
/goto :TheEnd
}
}

/varset FirstPass False

/for Bag 1 to 9
/for Slot 1 to ${InvSlot[pack${Bag}].Item.Container}
/if (${InvSlot[pack${Bag}].Item.Item[${Slot}].ID}==${HRRankID}) {
/ctrlkey /itemnotify in pack${Bag} ${Slot} leftmouseup
/delay ${minDelay}
/delay ${maxDelay} (${Cursor.ID})
/itemnotify in pack10 ${Int[${Math.Calc[${InvSlot[pack10].Item.Items}+1]}]} leftmouseup
/delay ${minDelay}
/delay ${maxDelay} (!${Cursor.ID})
/varcalc HRAugsInBags ${HRAugsInBags}-1

/if (((${HRRank.Equal[X]}) || (${HRRank.Equal[XV]})) && (${InvSlot[pack10].Item.Items}<8)) {
/goto :CombineLoop
}

/if ((${InvSlot[pack10].Item.Items}==2) || (${InvSlot[pack10].Item.Items}==8)) {
/combine pack10
/delay ${minDelay}
/delay ${maxDelay} (${Cursor.ID})
/autoinventory
/delay ${minDelay}
/delay ${maxDelay} (!${Cursor.ID})
/call ClearBag10
/goto :CombineLoop
}
}
/next Slot
/next Bag

/goto :CombineLoop

:TheEnd
/Return
|==== End Sub HRCombineAugs

|==== Sub ClearBag10
Sub ClearBag10
/declare j int local

/If (${InvSlot[pack10].Item.Items} > 0) {
/for j 1 to ${InvSlot[pack10].Item.Container}
/if (${InvSlot[pack10].Item.Item[${j}].ID}) {
/shiftkey /itemnotify in pack10 ${j} leftmouseup
/delay ${minDelay}
/delay ${maxDelay} (${Cursor.ID})
/if (${Cursor.ID}) /autoinv
/delay ${maxDelay} (!${Cursor.ID})
}
/next j
}
/Return
|==== End Sub ClearBag10

Please let me know in game or here if there are any issues or suggestions.


Title: Re: Another Combine Heroic Resists macro
Post by: wachna on January 20, 2022, 12:10:00 pm
Do I have to make several stacks or doesnt matter? If I got lets say 1000 Xs can I just max rank XX and let it roll?


Title: Re: Another Combine Heroic Resists macro
Post by: Loyal on January 20, 2022, 12:17:54 pm
I am legit excited to use this macro when I next play. Thanks!


Title: Re: Another Combine Heroic Resists macro
Post by: Ogru on January 20, 2022, 12:23:08 pm
Do I have to make several stacks or doesnt matter? If I got lets say 1000 Xs can I just max rank XX and let it roll?

You will probably have to run it a couple times because you will run out of space since 1000 rank X will make 125 Rank XIII's but you wont have to do anything other than, run it, wait for it to finish, then run it again.


Title: Re: Another Combine Heroic Resists macro
Post by: Loyal on January 20, 2022, 04:25:46 pm
I am getting the following error, no augs are being combined so its getting tripped up before it gets going.

I took precautions by emptying my bags of anyhting but resist augs. Slot 10 is an empty Magic Box. I use all magic boxes but went ahead and swapped out all my other magic boxes for normal bags, just in case, but no dice.

Any thoughts?



Title: Re: Another Combine Heroic Resists macro
Post by: Ogru on January 20, 2022, 04:55:04 pm
I am getting the following error, no augs are being combined so its getting tripped up before it gets going.

I see what the issue was and have updated the code.


Title: Re: Another Combine Heroic Resists macro
Post by: Loyal on January 20, 2022, 05:53:33 pm
Thanks! It's working.


Title: Re: Another Combine Heroic Resists macro
Post by: wachna on January 21, 2022, 05:39:00 am
If I got a stack of 100 Xs it creates 1 XIII and puts it in the slot from where the 100 have been and puts the 92 into box 10…

What am I doing wrong?


Title: Re: Another Combine Heroic Resists macro
Post by: Ogru on January 21, 2022, 08:26:02 am
You probably just need to increase the min/max delays times. I also did not not test it with the older version of MQ2, so you may need to download the newest one if you havent in a while.


Title: Re: Another Combine Heroic Resists macro
Post by: Ginge on January 21, 2022, 08:35:16 am
You probably just need to increase the min/max delays times. I also did not not test it with the older version of MQ2, so you may need to download the newest one if you havent in a while.

I'm using the 2004 version as if I try to use the newer version it crashes after server select  :D :D I'll test it when on this version when I have a stack built up.

Tank


Title: Re: Another Combine Heroic Resists macro
Post by: wachna on January 21, 2022, 09:22:26 am
You probably just need to increase the min/max delays times. I also did not not test it with the older version of MQ2, so you may need to download the newest one if you havent in a while.

Will try the delay adjustment on monday. Thx


Title: Re: Another Combine Heroic Resists macro
Post by: Loyal on January 21, 2022, 09:38:13 am
I was seeing the same issues when i first ran it. I adjusted the min delay from 3 to 5 and it solved the issue.


Title: Re: Another Combine Heroic Resists macro
Post by: Fecs on January 21, 2022, 01:31:27 pm
works great with the min delay change - now I just need someone to make a Shield of the Ages macro, so that my bots can finally get it, that's waaaaaaaaaay to much clicking for those nerds.