TS Macro with INI. (MQ2Data) Working

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

Moderator: MacroQuest Developers

Digitalxero
a ghoul
a ghoul
Posts: 129
Joined: Tue Sep 10, 2002 5:01 pm

TS Macro with INI. (MQ2Data) Working

Post by Digitalxero » Thu Apr 22, 2004 5:10 am

Ok I started from scratch and rewrote a TS Macro with INI Support. It does not have all the options the old TS macro had, but I will work those in as time permits or someone else can update it to include them

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
Last edited by Digitalxero on Sat Apr 24, 2004 6:06 am, edited 4 times in total.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Re: TS Macro with INI. (MQ2Data) 90% done

Post by wassup » Thu Apr 22, 2004 5:55 am

Digitalxero wrote:I have not figured out how to convert the following to MQ2Data yet

Code: Select all

$pack(@l3,name)
$pack(@CombInt,slots)-1
$pack(@CombInt,empty)
See my reply Digitalxero:

http://macroquest2.com/phpBB2/viewtopic.php?t=6441

You also might want to read up some more on the types... quite a bit of your current macro needs work.

Married
decaying skeleton
decaying skeleton
Posts: 4
Joined: Sun Dec 21, 2003 12:31 am

Post by Married » Fri Apr 23, 2004 1:05 am

It did not work for me.
Keep trying :) I am currently trying to get it to work, and am not having much luck.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Fri Apr 23, 2004 5:13 am

${Me.Inventory[22+@l13].Name} == $pack(@l3,name)
when searching for the combiner

Digitalxero
a ghoul
a ghoul
Posts: 129
Joined: Tue Sep 10, 2002 5:01 pm

Post by Digitalxero » Fri Apr 23, 2004 8:01 pm

Ok updated

bob_the_builder
a hill giant
a hill giant
Posts: 275
Joined: Tue Jul 22, 2003 1:22 pm

Post by bob_the_builder » Fri Apr 23, 2004 11:53 pm

Disable Smilies in your post

8)

Bob_smiles