Simple tradeskill combine.mac

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

Groo
decaying skeleton
decaying skeleton
Posts: 6
Joined: Tue Feb 24, 2004 1:46 pm

Simple tradeskill combine.mac

Post by Groo » Mon Apr 26, 2004 2:14 pm

Simple tradeskill combine.mac

Works with the standard recipe.ini file. Now updated for new MQ2 syntax

Code: Select all

| Combine.mac by Groo Apr 23, 2004

#event FullInventory "There was no place to put that"
#event CombineError "You cannot combine these items in this container type!"
#chat tell

Sub Main 
    /declare PackCode global
    /declare Component array
    /declare i global

    /call readIni "@Param0"
    :Begin 
	    /call ClearCursor
	    /for i 0 to 9
	       	/call AddComp "@Component(@i)" @i
	    /next i
	    /call DoCombine 
	    /goto :Begin 
	/return 

Sub readIni(RecipeName) 
    /declare Container local

    /echo Running @RecipeName recipe

	/if (${Ini["recipes.ini","@RecipeName",-1,"NOTFOUND"].Equal["NOTFOUND"]}) {
        /echo Recipe @RecipeName not found 
        /endmacro 
    } 

	/varset Container "${Ini[recipes.ini,@RecipeName,Cont,Enviro]}"

	/if (${String[@Container].Equal[Enviro]}) { 
        /varset PackCode "Enviro"
	} else {
        /varset PackCode ${FindItem[=@Container].InvSlot}
		
		/if (${String[@PackCode].Equal[NULL]}) { 
			/echo Could not find container @Container
		    /endmacro 
		}
		| pack1 = 22, ... , pack8 = 29
		/varset PackCode "pack"${Math.Calc[@PackCode-21].Int}		
	}  

    /for i 0 to 9
        /varset Component(@i) "${Ini[recipes.ini,@RecipeName,Comp@i,NOTFOUND]}"
    /next i 
    /return

sub ClearCursor 
    :Loop 
		/if (!${Cursor.ID}) /return
		/autoinv
		/delay 1s
		/doevents 
		/goto :Loop 
    /return 

sub DoCombine 
    :Loop 
		/combine @PackCode
		/delay 1s
	    /doevents 
		/if (${InvSlot[@PackCode].Item.Items}) /goto :Loop
	/delay 5
    /return 

sub AddComp(CompName, PackSlot)
	/if (${String[@CompName].Equal[NOTFOUND]}) /return

	/if (!${FindItem[@CompName].ID}) {
        /echo Could not find @CompName in inventory
		/beep
	    /endmacro 
    }

	:Loop 
		/ctrl /itemnotify ${FindItem[=@CompName].InvSlot} leftmouseup

		/if (!${Cursor.ID}) {
			/delay 1
			/goto :Loop
		}

	/if (${String[@PackCode].Equal[Enviro]}) { 
		/itemnotify ${InvSlot[enviro${Math.Calc[@PackSlot+1].Int}]} leftmouseup
	} else {
		/itemnotify in @PackCode ${Math.Calc[@PackSlot+1].Int} leftmouseup
	}	
	/return 

Sub Event_CombineError 
    /endmacro 
    /return 

Sub Event_FullInventory 
    /endmacro 
    /return