USAGE: /macro ts #Combines "<Combine set>"
IE: /macro ts 10 bits
Set #Combines to 0 to combine untill you runn out of space
Code: Select all
|New TS
| ts.mac (tradeskill.mac)
|INI Support by Diggler
|MQ2Data Converstion Digitalxero
#turbo
#define INIFile "recipes.ini"
#event SkillTrivial "You can no longer advance your skill from making this item"
#event SkillUp "You have become better at"
#event SkillFailure "You lacked the skills"
#event SkillSuccess "You have fashioned the items together to create something new"
#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 TotalComp global
/declare Comparray array
/declare NumCombines global
/declare i global
/declare InvNums array
/declare PackName array
/declare Slot global
/varset InvNums(22) 250
/varset InvNums(23) 260
/varset InvNums(24) 270
/varset InvNums(25) 280
/varset InvNums(26) 290
/varset InvNums(27) 300
/varset InvNums(28) 310
/varset InvNums(29) 320
/varset PackName(22) pack1
/varset PackName(23) pack2
/varset PackName(24) pack3
/varset PackName(25) pack4
/varset PackName(26) pack5
/varset PackName(27) pack6
/varset PackName(28) pack7
/varset PackName(29) pack8
/if (@Param0==0) {
/varset NumCombines -1
} else {
/varset NumCombines @Param0
}
/call Comp_List @Param0 "@Param1"
:Start
/call Pause
/call Have_Comps @Param0 "@Param1"
/call Do_Combine @Param0 "@Param1"
/if (${Int[@NumCombines]}==0) {
/echo Compleated @Param0 Combines. Ending now
/call End_Macro
} else {
/goto :Start
}
/return
Sub Comp_List
/if (${Ini[INIFile, @Param1, Cont].Left[1].Equal[#]}) {
/varset Comparray(0) "${FindItem[${Ini[INIFile, @Param1, Cont].Right[${Math.Calc[${Ini[INIFile, @Param1, Cont].Length}-1]}]}].Name}"
/echo Setting Container to: ${FindItem["${Ini[INIFile, @Param1, Cont].Right[${Math.Calc[${Ini[INIFile, @Param1, Cont].Length}-1]}]}"].Name}
} else /if (${Bool[${Ini[INIFile, @Param1, Cont].Equal[enviro]}]}) {
/varset Comparray(0) enviro
/echo Setting Container to: Enviromental Container
} else {
/varset Comparray(0) "${FindItem[=${Ini[INIFile, @Param1, Cont]}].Name}"
/echo Setting Container to1: ${FindItem[=${Ini[INIFile, @Param1, Cont]].Name}
}
/varset TotalComp = 0
/for i 0 to 10
/if (${Ini[INIFile, @Param1, Comp${Int[@i]}].Left[1].Equal[#]}) {
/varset Comparray(${Int[${Math.Calc[@i+1]}]}) "${FindItem[${Ini[INIFile, @Param1, Comp${Int[@i]}].Right[${Math.Calc[${Ini[INIFile, @Param1, Comp${Int[@i]}].Length}-1]}]}].Name}"
/varadd TotalComp 1
/echo Component ${Int[@TotalComp]}: ${FindItem[${Ini[INIFile, @Param1, Comp${Int[@i]}].Right[${Math.Calc[${Ini[INIFile, @Param1, Comp${Int[@i]}].Length}-1]}]}].Name}
} else /if (${Bool[${Ini[INIFile, @Param1, Comp${Int[@i]}]}]}) {
/varset Comparray(${Int[${Math.Calc[@i+1]}]}) "${FindItem[=${Ini[INIFile, @Param1, Comp${Int[@i]}]}].Name}"
/varadd TotalComp 1
/echo Component ${Int[@TotalComp]}: ${FindItem[=${Ini[INIFile, @Param1, Comp${Int[@i]}]}].Name}
}
/next i
/return
Sub Have_Comps
/for i 1 to ${Int[@TotalComp]}
/if (!${Bool[${FindItem["@Comparray(@i)"]}]}) {
/echo Missing @Comparray(@i)
/call End_Macro
}
/next i
/return
Sub Do_Combine
/varset Slot @InvNums(${FindItem[@Comparray(0)].InvSlot})
/for i 1 to ${Int[@TotalComp]}
/ctrl /itemnotify ${FindItem[@Comparray(@i)].InvSlot} leftmouseup
/call pickup
/if (${String["@Comparray(0)"].Equal[enviro]}) {
/itemnotify ${InvSlot[enviro${Int[@i]}]} leftmouseup
/call drop
} else {
/varadd Slot 1
/itemnotify ${Int[@Slot]} leftmouseup
/call drop
}
/next i
/if (${String["@Comparray(0)"].Equal[enviro]}) {
/combine enviro
/delay 2s
/call AutoInv
} else {
/combine @PackName(${FindItem[@Comparray(0)].InvSlot})
/delay 2s
/call AutoInv
}
/if (@NumCombines>0) /varsub NumCombines 1
/return
Sub AutoInv
:AutoInv
/if (${Bool[${Cursor.ID}]}) {
/autoinv
/delay 2s
/goto :AutoInv
}
/return
Sub pickup
:Wait
/if (!${Cursor.ID}) /goto :Wait
/return
Sub drop
:Wait
/if (${Cursor.ID}) /goto :Wait
/return
Sub Pause
:Pause
/if (${Target.Name.Equal[${Me.Name}]}) /goto :Pause
/return
Sub End_Macro
/endmacro
/return



