Self Automated Tradeskill Macros

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

DryGnome
orc pawn
orc pawn
Posts: 25
Joined: Tue Sep 14, 2004 4:45 pm

Post by DryGnome » Sat Sep 18, 2004 1:20 pm

I hate to do this but some good programmers seem to read this thread. Is it possible to make a macro that hands in 4x Red Wine to Lokar To'Biath assuming you're right next to him and you have it in your inventory. I'm hoping after seeing enough simple macros, I'll learn the code.

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Sat Sep 18, 2004 2:46 pm

DryGnome wrote:I hate to do this but some good programmers seem to read this thread. Is it possible to make a macro that hands in 4x Red Wine to Lokar To'Biath assuming you're right next to him and you have it in your inventory. I'm hoping after seeing enough simple macros, I'll learn the code.
Here you go:

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

Just did a search for it and there it was.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

New Poison Making Macro, GREAT money saving potential

Post by GD » Sat Sep 18, 2004 7:33 pm

When I was originally writing this, I didn't like the fact that it sold every component that was left over from the previous batch, even if it could still be used, sometimes at a considerable loss. Now it'll only sell components that change between recipes, potentially saving thousands of plat in the process.

With expensive recipes that return components on failures, and the new Salvage AA, implementing this method into the other SATM's can greatly decrease the amount of plat required to increase TradeSkills.

Code: Select all

|
| Poison.mac
| Takes you from 1 to 250 in Poison Making
| Version 1.2
| Date: September 18, 2004
|
| v1.2 Changes: Now only sells components that change between Recipes
|
| Please be sure to get the lastest updates at http://www.soc-music.com/mq2/
|
| Before are the settings you need to change for you.
| This Macro can take you up to 250 in Poison Making.
| SkillMaxWanted can be change to what skill you want to stop at.
| MerchantName is which merchant you are at.
| You will need to change the DelayMult to higher if you are laggy, this
|   number will be multiplied to the default delay.
|
| This Macro works best in the Abysmal Sea since all the components are there.
| You WILL need to be next to the merchant in order for this to work.
| Also, be sure you have a lot of money on you to go from 1 to 250.
|
| Requirements:
| You will need a Mortar and Pestle (in the last slot).
|
| Disclaimer:
| Code was used from other programers also from the MQ Forums.
| Thanks to GD for putting the posion making macro up.
|
#event CombineError "#*#There was no place to put that#*#"
#event CombineError "#*#You cannot combine these items in this container type!#*#"
#event CombineError "#*#did not accept these items#*#"
#include common/sell.inc
#include common/buy.inc
#include common/packs.inc
#include common/cleanpacks.inc

Sub Main
    /declare OldSkill int outer
    /declare SkillMaxWanted int outer
    /declare PackCode string outer
    /declare Component[6] string outer
    /declare i int outer
    /declare MerchantName string Outer
    /declare VialName item outer
    /declare SuspName item outer
    /declare CompName item outer
    /declare CombItemName string outer
    /declare ItemTo string outer
    /declare EndingVar int outer
    /declare Levelname int outer
    /declare DelayMult int outer
    /varset OldSkill ${Me.Skill[Make Poison]}

    /declare ItemTriv int outer
    /declare SellFlag int outer 0
    /declare OldVial string outer NULL
    /declare OldSusp string outer NULL

| ************************************************
| *   Change these settings to what you want.    *
| ************************************************

    /varset SkillMaxWanted 250
    /varset MerchantName "Viliani I`Xvoyt"
    /varset DelayMult 1

| ************************************************
| ************************************************

    :start
    /echo Poison Making is at ${Me.Skill[Make Poison]}

    /if (${Me.Skill[Make Poison]}>=${SkillMaxWanted}) {
      /echo Poison Making is at ${SkillMaxWanted}. Quiting!
      /endmacro
    }

    /if (${Me.Skill[Make Poison]}>=172 && ${Me.Skill[Make Poison]}<=250) {
      /varset VialName "Sealed Poison Vial"
      /varset SuspName "Ethereal Suspension"
      /varset CompName "Creeper Ivy"
      /varset CombItemName "SoS"
      /varset ItemTo "Spirit of Sloth"
      /varset ItemTriv 250
      /varset OldVial NULL
      /varset OldSusp "Constrict Suspension"

    }

    /if (${Me.Skill[Make Poison]}>=130 && ${Me.Skill[Make Poison]}<172) {
      /varset VialName "Sealed Poison Vial"
      /varset SuspName "Constrict Suspension"
      /varset CompName "King's Thorn"
      /varset CombItemName "CR"
      /varset ItemTo "Calcium Rot"
      /varset ItemTriv 171
      /varset OldVial NULL
      /varset OldSusp NULL
    }

    /if (${Me.Skill[Make Poison]}>=98 && ${Me.Skill[Make Poison]}<130) {
      /varset VialName "Sealed Poison Vial"
      /varset SuspName "Constrict Suspension"
      /varset CompName "Gelsemium Root"
      /varset CombItemName "BF"
      /varset ItemTo "Brain Freeze"
      /varset ItemTriv 129
      /varset OldVial "Lined Poison Vial"
      /varset OldSusp NULL
    }

    /if (${Me.Skill[Make Poison]}<98) {
      /varset VialName "Lined Poison Vial"
      /varset SuspName "Constrict Suspension"
      /varset CompName "Alocasia Root"
      /varset CombItemName "AS"
      /varset ItemTo "Atrophic Sap"
      /varset ItemTriv 97
      /varset OldVial NULL
      /varset OldSusp NULL
    }

    /varset EndingVar 1
    /target ${MerchantName}
    /face
    /nomodkey /click right target
    /call OpenPacks

    /if (${SellFlag}) {
        /delay ${Math.Calc[${DelayMult}*2]}s
        /if (${OldVial.NotEqual[NULL]}) {
            /call Sell ${OldVial}
            /delay ${Math.Calc[${DelayMult}*1]}s
        }
        /if (${OldSusp.NotEqual[NULL]}) {
            /call Sell ${OldSusp}
            /delay ${Math.Calc[${DelayMult}*1]}s
        }
        /call Sell ${CompName}
        /varset SellFlag 0
    }

    /delay ${Math.Calc[${DelayMult}*1]}s
    /call Buy ${VialName} 20
    /delay ${Math.Calc[${DelayMult}*1]}s
    /call Buy ${SuspName} 20
    /delay ${Math.Calc[${DelayMult}*1]}s
    /call Buy ${CompName} 40
    /delay ${Math.Calc[${DelayMult}*1]}s
    /nomodkey /notify MerchantWnd DoneButton leftmouseup
    /call ClosePacks
    /call OpenPacks
    /delay ${Math.Calc[${DelayMult}*2]}s


    /call readIni "${CombItemName}"
    :Begin
       /if (${EndingVar}==1) /call ClearCursor
       /for i 1 to 6
             /if (${EndingVar}==1) /call AddComp "${Component[${i}]}" ${i}
       /next i
       /if (${EndingVar}==1) /call DoCombine
       /if (${EndingVar}==1) /goto :Begin

    /delay ${Math.Calc[${DelayMult}*1]}s
    /call ClosePacks
    /delay ${Math.Calc[${DelayMult}*1]}s
    /target ${MerchantName}
    /face
    /nomodkey /click right target
    /delay ${Math.Calc[${DelayMult}*1]}s
    /call OpenPacks
    /delay ${Math.Calc[${DelayMult}*2]}s
    /call Sell ${ItemTo}
    /delay ${Math.Calc[${DelayMult}*1]}s
    /nomodkey /notify MerchantWnd DoneButton leftmouseup
    /call ClosePacks

    /goto :start

    /return

Sub readIni(RecipeName)
    /declare Container string

    /echo Running ${RecipeName} recipe, which makes ${ItemTo}.

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

    /varset Container "${Ini[Poison.ini,${RecipeName},Cont,Enviro]}"
   /delay 1

    /if (${Container.Equal[Enviro]}) {
         /varset PackCode Enviro
    } else {
         /varset Container "${FindItem[${Container}]}"
         /varset PackCode ${FindItem[${Container}].InvSlot}

         /if (${PackCode.Equal[NULL]}) {
            /echo Could not find container ${Container}
            /varset EndingVar 2
            /return
         }
         | pack1 = 22, ... , pack8 = 29
         /varset PackCode pack${Math.Calc[${PackCode}-21].Int}
    }
    /call cleanPack ${Container}

    /for i 1 to 6
        /varset Component[${i}] ${Ini[Poison.ini,${RecipeName},Comp${Math.Calc[${i}-1].Int},NOTFOUND]}
    /next i
    /return

sub ClearCursor
    :Loop
      /if (!${Cursor.ID}) /return
      /autoinv
    /delay ${Math.Calc[${DelayMult}*5]s
      /doevents
      /goto :Loop
    /return

sub DoCombine
    :Loop
      /combine ${PackCode}
      /delay ${Math.Calc[${DelayMult}*1]}s
      /if (${PackCode.Equal[Enviro]}) /delay 1s
      /doevents
      /if (${InvSlot[${PackCode}].Item.Items}) /goto :Loop
      /delay ${Math.Calc[${DelayMult}*5]s
      /if (${Me.Skill[Make Poison]}>${OldSkill}) {
        /echo Your Poison Making Went Up!! It's now ${Me.Skill[Make Poison]}!
        /varset OldSkill ${Me.Skill[Make Poison]}
        /if (${OldSkill}>=${ItemTriv}) {
          /echo Recipe is now Trivial, selling leftover components and moving to next Recipe
          /varset SellFlag 1
        }
      }
    /return

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

   /if (!${FindItem[=${CompName}].ID}) {
      /echo Could not find ${CompName} in inventory
      /beep
      /varset EndingVar 2
      /return
    }

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

      /if (!${Cursor.ID}) {
         /delay ${Math.Calc[${DelayMult}*1]}s
         /goto :Loop
      }

   /if (${PackCode.Equal[Enviro]}) {
      /nomodkey /itemnotify ${InvSlot[enviro${PackSlot}]} leftmouseup
   } else {
      /nomodkey /itemnotify in ${PackCode} ${PackSlot} leftmouseup
   }
   /return

Sub Event_CombineError
    /varset EndingVar 2
/return
Opinions are like assholes, everyone has one, but most of them stink.

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Sat Sep 18, 2004 7:57 pm

When I first made the macro it didn't have the clean container function. So it would have to sell the left over components so they didn't get left behind in the container and cause the macro to have an error next time it went to combine, now that there is a clean container function none of the macros actually need to sell the componets when is starting over, it only needs to sell the actual made product. I was actually going to change these so they don't sell the components at the start now since the clean container function is working properly now. That is on a soon to be released update.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

DryGnome
orc pawn
orc pawn
Posts: 25
Joined: Tue Sep 14, 2004 4:45 pm

Post by DryGnome » Sat Sep 18, 2004 11:53 pm

Ya I agree with GD, esspecially with the smithing macro that bougth 30 sheet metal and 10 molds then resold 20 sheet metal. Kinda sad.

krea823
orc pawn
orc pawn
Posts: 16
Joined: Thu Apr 15, 2004 9:57 am

Post by krea823 » Sun Sep 19, 2004 2:15 am

it isn't hard to take out the sell back part of the macros. If it's that much of a problem then make some edits.

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Sun Sep 19, 2004 7:21 am

krea823 wrote:it isn't hard to take out the sell back part of the macros. If it's that much of a problem then make some edits.
Then it's not fully automated, and you'd get left over parts from various recipes left over at times, slowly filling up your inventory.
Opinions are like assholes, everyone has one, but most of them stink.

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Sun Sep 19, 2004 9:29 am

DryGnome wrote:Ya I agree with GD, esspecially with the smithing macro that bougth 30 sheet metal and 10 molds then resold 20 sheet metal. Kinda sad.
The reason I did that on the smithing one is because once you get to the higher smithing recipe in teh macro it uses all 30 sheets.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

krea823
orc pawn
orc pawn
Posts: 16
Joined: Thu Apr 15, 2004 9:57 am

Post by krea823 » Sun Sep 19, 2004 5:21 pm

DryGnome wrote:Ya I agree with GD, esspecially with the smithing macro that bougth 30 sheet metal and 10 molds then resold 20 sheet metal. Kinda sad.
Drygnome if you remove or comment out the sell back parts of the macro (except for the itemto sell back) it won't sell the sheets back. Or the water and molds if for some reason you had any left over, but it will keep buying enough to have 30 sheets, 10 molds, and 20 flasks. So by the time you get to the end of the macro it will be using all 30 sheets, 10 molds, and flasks. All you'll have left to sell back each cycle at that point will be the items you made since on failure you get nothing back. This keeps it fully automated and no waste.

Just checked the code and it buys a stack of water each time...only need 10, but that's only a few gp so I doubt that's an issue.
Though you could change this

Code: Select all

/call Buy ${CompC} 20
To this

Code: Select all

/call Buy ${CompC} 10

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Sun Sep 19, 2004 7:10 pm

The problem with not buying more then what is needed for water is that you will drink it and not have enough components for all the trys.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

krea823
orc pawn
orc pawn
Posts: 16
Joined: Thu Apr 15, 2004 9:57 am

Post by krea823 » Sun Sep 19, 2004 8:31 pm

I thought of that, but I just keep my normal food/drink in the first 2 slots of my bags so I don't have to worry about drinking the flasks, and I keep all 8 general inventory slots filled. Either with bags or somethign mundane like a stack of bonechips or something.

User avatar
OnyxSys
a ghoul
a ghoul
Posts: 133
Joined: Sun Dec 21, 2003 9:58 pm
Contact:

Post by OnyxSys » Mon Sep 20, 2004 5:24 am

very nice Rogue poison making skill 1 - 250 in one night :) This time i didnt leave 30k on him :P lol and all is working great with this macro, flawless..

User avatar
Override
a hill giant
a hill giant
Posts: 179
Joined: Sun Dec 29, 2002 9:19 am

Post by Override » Mon Sep 20, 2004 5:51 pm

krea823 wrote:I thought of that, but I just keep my normal food/drink in the first 2 slots of my bags so I don't have to worry about drinking the flasks, and I keep all 8 general inventory slots filled. Either with bags or somethign mundane like a stack of bonechips or something.
If everyone did that I could write it so it didn't buy extra stuff, but I try to macro for every possible situation. Some people keep all there food and water in the last slot of the last bag, and some people use water flask as their drinks, if you do that even if you put it in the first slot its going to only have what you need. So the easiest solution was to have it buy a few extra.
Self Automated Tradeskill Macros at:
[url=http://www.override13.com/mq2/]http://www.override13.com/mq2/[/url]

User avatar
Zornecro
a ghoul
a ghoul
Posts: 82
Joined: Sun Sep 19, 2004 10:19 pm
Location: El Paso, TX

Bazaar buying macro failed

Post by Zornecro » Mon Sep 20, 2004 7:46 pm

Set up the macro and it started searching and found something to buy. It targeted the trader in question, pathed to them, and kept auto-running straight past them into the wall. The MQ window showed:

failed to parse /if condit '&{TargetName.Equal[Kruune]}', non-numeric encountered
- Zornecro Mancer, Retired EQ1 Veeshan
- Unktehila, Redtigre, Twinaxe, EQ2 Crushbone

DryGnome
orc pawn
orc pawn
Posts: 25
Joined: Tue Sep 14, 2004 4:45 pm

Post by DryGnome » Mon Sep 20, 2004 10:27 pm

Oh, btw.... Despite the cost... Any hopes of raising to smithing macro past 115?