New UI Combine/autoinventory macro

For questions regarding conversion of scripts from the old, parm style to the new MQ2Data format. Conversion questions only!

Moderator: MacroQuest Developers

Wink-
a ghoul
a ghoul
Posts: 122
Joined: Tue Apr 27, 2004 2:41 pm

New UI Combine/autoinventory macro

Post by Wink- » 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 

Wink-
a ghoul
a ghoul
Posts: 122
Joined: Tue Apr 27, 2004 2:41 pm

Post by Wink- » Sun May 02, 2004 3:50 am

Shameless self bump, I got this to do one combine and /autoinventory but it stops there and ends, I have no idea why. I figure I might as well spend my man hours working on this macro instead of the monotony of clicking combine and autoinventory. Any advice would be appreciated, I've learned tons in the past 2 days :)