New UI Combine/autoinventory macro
Posted: Sat May 01, 2004 2:55 am
I am trying to convert over the old gpurp.mac for the new UI to just hit combine and either autoinventory or destroy. So far it doesn't work but I am making slow progress, I hope. Take a look and see if I am going in the right direction.
Code: Select all
| GPurp.mac
| General purpose macro for automating tradeskills with the new TS interface.
| Usage: /macro gpurp [action on success] [action on failure] [end on trivial]
| Specified actions can be 0 (to destroy) and 1 {to keep) created items.
| If end on trivial is 1, the macro will end when the items trivial. (Defaults to 0)
| This macro will /autoinventory by default, if no switches are provided.
| Example usage:
| /macro gpurp 1 0 0
| This would keep successful combines, destroy unsuccessful combines, and continue
| running when the items trivial.
| Be sure to have selected your recipe and put the mouse over the combine button
| before running the macro!
#event NOITEM "Sorry, but you don't have everything you need for this recipe in your general inventory."
#event SUCC "You have fashioned the items together to create something new!"
#event FAIL "You lacked the skills to fashion the items together."
#event TRIV "You can no longer advance your skill from making this item."
#event SKILLUP "You have become better at"
Sub Main
/declare SKILLUP int outer
/declare COMBINEATTM int outer
/declare COMBINESUCC int outer
/declare COMBINETRIV int outer
/declare COMBINESKIL int outer
/declare SUCCACTION int outer
/declare FAILACTION int outer
/declare ENDONTRIV int outer
/if (${Param0}) {
/varset SUCCACTION 1
/varset FAILACTION 1
/varset ENDONTRIV 0
} else {
/varset SUCCACTION ${Param0}
/varset FAILACTION ${Param1}
/varset ENDONTRIV ${Param2}
}
:Loop
/if (!${Window[TradeskillWnd].Child[CombineButton].Enabled}) /goto :Loop
/notify TradeskillWnd CombineButton leftmouseup
/delay 5
/doevents
/if (${EventType.Equal[NULL]}) /goto :Loop
/return
Sub Event_NOITEM
/echo Missing one of the required items for this recipe; aborting.
/call EndMacro
/return
Sub Event_FAIL
| /varcalc COMBINEATTM ${COMBINEATTM}+1
/call SortItems FAILACTION
/return
Sub Event_SUCC
| /varcalc COMBINEATTM ${COMBINEATTM}+1
/call SortItems SUCCACTION
/return
Sub Event_SKILLUP
| /varcalc COMBINESKIL ${COMBINESKIL}+1
/return
Sub Event_TRIV
/if (${ENDONTRIV}) {
/echo Item is now trivial; aborting.
/call EndMacro
}
/return
Sub SortItems
:itemloop
/if (${Cursor.ID}) {
/autoinv
/delay 5
}
|Here i stick in the code to destroy items
/if (${Cursor.ID}) /goto :itemloop
/return
Sub EndMacro
| /echo Total time running: $running
| /echo Number of combines: @COMBINEATTM
| /echo Success rate (%): $($calc(@COMBINESUCC/@COMBINEATTM))
| /echo Combines per skillup: $int($calc(@COMBINEATTM/@COMBINESKIL))
/cleanup
/endmacro
/return