Tradeskill macro using new tradeskill window

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

Moderator: MacroQuest Developers

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Tradeskill macro using new tradeskill window

Post by BrainDeath » Fri Apr 30, 2004 11:09 pm

Edit: updated to work with June 20, 2004 zip

10-18-04: Minor changes to NewTS.mac and added the macro as an include file NewTS.inc

Both files REQUIRE that you update the line:

#define EQFolder "C:\Program Files\EverQuest"

to match your own EQ folder.

Just finished converting and testing this and thought I would post it.

Let me warn you, this macro wasnt designed with skilling up in mind. It doesn't have options to stop on trivial, warn you before going over 200 in skill etc. It was designed for high-volume batching of tradeskill recipes.

This macro lets you tradeskill something like grobb liquidised meat start to finish without touching the keyboard as long as you've loaded up with the proper ingredients.

Usage examples:
/macro newts glm
Makes grobb liquidised meat. You must have a mixing bowl and all the ingredients in your inventory and be standing near a brew barrel.
/macro newts glm soda
Makes grobb liquidised meat starting from the soda water subrecipe.

Since some recipes require environmental containers that arent near each other they have to be broken down. For example, look at the entry for Misty Thicket Picnics in the ini file. I have my mixing bowl, sewing kit and all ingredients and tools in my inventory before I start. The way I do it then is to stand next to a forge and do steel bonings with /macro newts sb. Then I make my picnic baskets with /macro newts pb. I then move to a brew barrel and make the jumjum spiced beer with /macro newts jsb. Finally, I go stand next to an oven and /macro newts mtp which finishes off the recipe. Moving around like this isn't necessary for many recipes however, especially brewing recipes.

Additional documentation is included in the macro and ini file.

I only wrote this macro because I was paranoid that an easy way to catch macroers would be to see who was doing high volumes of combines using the old interface. After using it though, I found that it was much faster than my old tradeskill macro.

Be aware that the macro will pause on incoming tells if you are not using tell windows and will not pause on incoming tells if you are.

Oh, and parts of the code are freely borrowed from the many fine macros out there. :)

I've included the macro, a sample ini file and my common.inc which it uses.

Update: I have now also added the macro as an include file.

Macro

Code: Select all

| NewTS.mac by BrainDeath last updated 10-18-2004
| Uses INI files to create a complete recipe including subcombines
| using the new tradeskill interface.
| The name of the major recipe as defined in the INI file is required
| as the first parameter.  A second optional parameter is a subrecipe
| of the major recipe.  This is helpful for example if you halted the
| macro for some reason and don't want it to retry all the subcombines
| but just continue with the one it was on when halted.

#turbo 

#include common.inc

| Update the line below to indicate where you installed EQ.
#define EQFolder "C:\Program Files\EverQuest"

#event Full "#*#There was no place to put that#*#" 
#event Error "#*#You cannot combine these items#*#" 
#event Failure "#*#You lacked the skills#*#" 
#event Success "#*#You have fashioned the items together to create something new#*#" 
#event Alternate "#*#You have fashioned the items together to create an alternate product#*#" 
#event Trivial "#*#You can no longer advance your skill from making this item#*#" 
#event SkillUp "#*#You have become better at#*#" 
#event NoIngredients "#*#Sorry, but you don't have everything you need for this recipe#*#"

#chat tell 

Sub Main
   /cleanup
| Declare variables
   /call DeclareOuters
   /declare inifile string local
   /declare MajorRecipe string local
   /declare ContInUse string local
   /declare RecipeCtr string local

| Define macro INI filename. 
   /varset inifile newts.ini
   
| Check for parameter of Major Recipe.
   /if (!${Defined[Param0]}) /call EndMacro "You must specify a recipe."
   /varset MajorRecipe ${Param0}

| Check for ini file.
   /if (${String[${Ini[${inifile}]}].Equal[NULL]}) /call EndMacro "Could not find ${inifile} INI file." 
   
| Check for recipe list in macro INI file.
   /if (${String[${Ini[${inifile},${MajorRecipe}]}].Equal[NULL]}) /call EndMacro "Recipe ${MajorRecipe} not defined in ${inifile} INI file." 
   
| Check that ContainerInUse is defined in macro INI file.
   /varset ContInUse ${Ini[${inifile},Settings,ContainerInUse]}
   /if (${ContInUse.Equal[NULL]}) /call EndMacro "ContainerInUse setting not defined in ${inifile} INI file." 

| Check to see if starting in middle of major recipe
   /if (${Defined[Param1]}) {
      /call FindSubRecipe "${inifile}" "${MajorRecipe}" "${Param1}"
      /varset RecipeCtr ${Macro.Return}
   } else {
      /varset RecipeCtr 1
   }
   /if (${RecipeCtr.Equal[NOTFOUND]}) /call EndMacro "Subrecipe specified not defined in ${inifile} INI file." 

| Make the recipes    
   /call DoRecipes "${inifile}" "${MajorRecipe}" "${ContInUse}" "${Int[${RecipeCtr}]}"
   /cleanup
   /beep
/return 


| Declare outer variables.
Sub DeclareOuters
   /declare EQUIFile string outer EQFolder\UI_${Me}_${MacroQuest.Server}.ini
   /declare EventType string outer
   /declare SkillTrivialCounter int outer
   /declare SkillFailCounter int outer 
   /declare SkillSuccessCounter int outer 
   /declare SuccessRate float outer 
   /declare TotalAttempts int outer 
   /declare SkillUpRate float outer 
   /declare SkillUpCounter int outer 
/return


| Check for the existence of a subrecipe for the major recipe in your INI file.
Sub FindSubRecipe(inifile,MajorRecipe,SubRecipe)
   /declare SubINI string local
   /declare SubCtr int local 1
   :Loop 
      /varset SubINI ${Ini[${inifile},${MajorRecipe},Recipe${SubCtr}]}
      /if (${SubINI.Find[${SubRecipe}]}) /return ${SubCtr}
      /if (${SubINI.Equal[NULL]}) /return NOTFOUND
      /varcalc SubCtr ${SubCtr}+1 
   /goto :Loop 
/return


| Grab the subrecipe from INI file and execute it.
Sub DoRecipes(inifile,MajorRecipe,ContInUse,int RecipeCtr)
   /declare SubRecipe string local
   :Loop 
      /varset SubRecipe ${Ini[${inifile},${MajorRecipe},Recipe${RecipeCtr}]}
      /if (${SubRecipe.Equal[NULL]}) /return
      /if (${SubRecipe.Left[1].Equal[#]}) /varset SubRecipe ${SubRecipe.Right[-1]}
      /call ResetCounters
      /echo Executing recipe ${SubRecipe}... 
      /call TradeSkills "${inifile}" "${MajorRecipe}" "${RecipeCtr}" "${ContInUse}"
      /call DisplayStats
      /varcalc RecipeCtr ${RecipeCtr}+1 
   /goto :Loop 
/return 


| Reset the counters for the statistics display.
Sub ResetCounters
   /varset SkillTrivialCounter 0 
   /varset SkillFailCounter 0 
   /varset SkillSuccessCounter 0 
   /varset SuccessRate 0 
   /varset TotalAttempts 0 
   /varset SkillUpRate 0 
   /varset SkillUpCounter 0 
/return


|  Checks the INI file for the subrecipe parameters, opens the appropriate
|  container and performs the combines.
Sub TradeSkills(inifile,MajorRecipe,int SubRecipeNum,ContInUse) 
   /declare ContType string local
   /declare ContName string local
   /declare PackNum int local
   /declare SubRecipe string local

   /varset ContType ${Ini[${inifile},${MajorRecipe},ContType${SubRecipeNum}]}
   /if (${ContType.Equal[NOTFOUND]}) /Call EndMacro "Could not find Container Type for Recipe ${MajorRecipe}, subrecipe number ${SubRecipeNum} in file ${inifile}." 

   /varset ContName ${Ini[${inifile},${MajorRecipe},ContName${SubRecipeNum}]}
   /if (${ContName.Equal[NOTFOUND]}) /Call EndMacro "Could not find Container Name for Recipe ${MajorRecipe}, subrecipe number ${SubRecipeNum} in file ${inifile}." 

| Find and open combiner
   /if (${ContType.Equal[enviro]}) {
      /call OpenEnviro "${ContName}" "${ContInUse}"
      /if (${Macro.Return.NotEqual[OPEN]}) /call EndMacro "Could not open environmental container ${ContName}. Return Code: ${Macro.Return}"
      /varset PackNum e
   } else /if (${ContType.Equal[pack]}) {
      /call OpenPack "${ContName}"
      /if (${Macro.Return.NotEqual[OPEN]}) /call EndMacro "Could not open pack ${ContName}. Return Code: ${Macro.Return}"
      /varset PackNum ${Macro.Return}
   } else {
      /call EndMacro "Invalid Container Type defined for Recipe ${MajorRecipe}, subrecipe number ${SubRecipeNum} in file ${inifile}." 
   }
   
| Main Combine Routine
   /call ClearCursor
   /varset SubRecipe ${Ini[${inifile},${MajorRecipe},Recipe${SubRecipeNum}]}
   /if (${SubRecipe.Equal[NOTFOUND]}) /Call EndMacro "Could not find Recipe ${MajorRecipe}, subrecipe number ${SubRecipeNum} in file ${inifile}." 
   /call ChooseRecipe "${SubRecipe}"
   :Begin
      /call DoCombine
      /if (!${EventType.Equal[Event_NoIngredients]}) /goto :Begin
   /call ClearCursor
   /notify COMBW_FlagsArea COMBW_CloseButton leftmouseup
/return 


| Type input string "Recipe" into search box in new tradeskill interface,
| click search and select the first recipe returned in the search results.
Sub ChooseRecipe(Recipe)
   /if (${Recipe.Left[1].Equal[#]}) { 
      /notify COMBW_FavoritesArea COMBW_ShowFavoritesButton leftmouseup
      /varset Recipe ${Recipe.Right[-1]}
   } else {
      /notify COMBW_SearchArea COMBW_SearchTextEdit leftmouseup
      /delay 5
      /call Type "${Recipe}"
      :WaitForSearchButton
         /if (!${Window[COMBW_SearchArea].Child[COMBW_SearchButton].Enabled}) /goto :WaitForSearchButton
      /notify COMBW_SearchArea COMBW_SearchButton leftmouseup
   }
   /delay 10
   /notify COMBW_RecipeListArea COMBW_RecipeList listselect ${Window[COMBW_RecipeListArea].Child[COMBW_RecipeList].List[${Recipe}]} 
/return


| Click combine until you get an event.
Sub DoCombine
   /varset EventType NULL
   :Loop
      /if (!${Window[COMBW_CombineArea].Child[COMBW_CombineButton].Enabled}) /goto :Loop
      /notify COMBW_CombineArea COMBW_CombineButton leftmouseup
      /delay 10
      /doevents
      /if (${EventType.Equal[NULL]}) /goto :Loop
/return


| Open an enviromental container given name (item).  Action tells whether or
| not to wait for the container to become available.
Sub OpenEnviro(item,action) 
   /declare count1 int local 0
   :Loop
      /call EnviroOpen "${item}"
      /if (${Macro.Return.Equal[OPEN]}) /return OPEN
      /squelch /itemtarget ${item}
      /if (!${Target.Distance}) /return NOTFOUND
      /if (${Target.Distance}>20) /return NOTINREACH
      /face fast nolook 
      /click left item 
   :Check 
      /varcalc count1 ${count1}+1 
      /delay 10 
      /call EnviroOpen "${item}"
      /if (${Macro.Return.Equal[OPEN]}) /return OPEN
      /if (${count1}==5) { 
         /if (${action.Find[WAIT]}) /varset count1 0 
         /goto :Loop 
         } 
      /if (${count1}==10) /goto :Loop 
      /if (${count1}>=15) { 
         /return INUSE 
         } 
      /goto :Check 
/return OPEN

| Checks to see if an enviromental container is open given its name.
Sub EnviroOpen(Name)
   /if  (${Window[TradeskillWnd].Open}) {
      /if (${Window[COMBW_ContainerArea].Child[COMBW_ContainerName].Text.Find[${Name}]}) {
         /return OPEN
      } else {
         /notify COMBW_FlagsArea COMBW_CloseButton leftmouseup
      }
   }
/return NOTOPEN


| Opens a pack given its name. 
Sub OpenPack(PackName)
   /declare PackNum int local
   
   /call ContFind "${PackName}"
   /if (!${Macro.Return}) /return NOTFOUND
   /varset PackNum ${Macro.Return}
   
   /if (!${Window[Pack${PackNum}].Open}) { 
      /if (!${Window[Inventory].Open}) /keypress INVENTORY
      /if (${Ini[${EQUIFile},TradeskillWnd,CtrlBypass].Equal[1]}) { 
         /itemnotify pack${PackNum} rightmouseup 
      } else { 
         /Ctrl /itemnotify pack${PackNum} rightmouseup 
      }
      /delay 5
   }
   /if (${PackName.Left[1].Equal[#]}) /varset PackName ${PackName.Right[-1]}
   /call EnviroOpen "${PackName}"
   /if (${Macro.Return.Equal[OPEN]}) /return OPEN
/return OPEN


| Determine the pack number of a container
| Input: name of container, if name starts with # will use "contains" for comparison
|        to find the container
| Output: pack number of container or 0 if container is not in inventory
Sub ContFind(InName)
   /declare ContName string local 
   /declare NameFlag int local 
   /declare loopctr int local 
   /declare PackNum int local 0

   /if (${InName.Left[1].Equal[#]}) { 
      /varset ContName ${InName.Right[-1]}
      /varset NameFlag 0 
   } else { 
      /varset ContName ${InName}
      /varset NameFlag 1 
   } 
   /for loopctr 1 to 8 
      /if (!${NameFlag}) /if (${String[${Me.Inventory[Pack${loopctr}]}].Find[${ContName}]}) /varset PackNum ${loopctr}
      /if (${NameFlag}) /if (${String[${Me.Inventory[Pack${loopctr}]}].Equal[${ContName}]}) /varset PackNum ${loopctr}
   /next loopctr 
/return ${PackNum}


| Type out the input string.  Only non-alphabetic character
| currently handled is space.
Sub Type(InStr)
   /declare char string local
   /declare loopctr int local
   /for loopctr 1 to ${InStr.Length}
      /varset char ${InStr.Mid[${loopctr},1]}
      /if (!${char.Length}) {
         /keypress space chat
      } else {
         /keypress ${char} chat
      }
   /next loopctr
/return


| Display combine statistics.
Sub DisplayStats 
   /echo Combine Statistics - Successes: ${SkillSuccessCounter}, Failures: ${SkillFailCounter}, Trivial: ${SkillTrivialCounter}
   /varcalc TotalAttempts ${SkillFailCounter}+${SkillSuccessCounter} 
   /if (${TotalAttempts}) { 
      /varcalc SuccessRate (${SkillSuccessCounter}/${TotalAttempts})*100 
      /varcalc SkillUpRate (${SkillUpCounter}/${TotalAttempts})*100 
      /echo Success Rate: ${SuccessRate.Deci}% out of ${TotalAttempts} attempts 
   } else { 
      /echo Unable to complete a combine.  No Stats to report 
   } 
   /if (${SkillUpCounter}) /echo Skill Ups: ${SkillUpCounter} , Skill Rate: ${SkillUpRate.Deci}% out of ${TotalAttempts} attempts 
|   /if (${SkillTrivialCounter}) /echo THIS ITEM IS OR HAS GONE TRIVIAL! 
/return 


| Event handling.
Sub Event_Chat 
   /varset EventType Event_Chat
   /call ClearCursor
   /keypress TARGETME
   /call Pause
/return 

Sub Event_Full 
   /varset EventType Event_Full
   /delay 5
   /call ClearCursor
   /cleanup
   /call EndMacro "Your inventory is full." 
/return 

Sub Event_Error 
   /varset EventType Event_Error
   /delay 5
   /call ClearCursor
/return 

Sub Event_Success 
   /varset EventType Event_Success
   /varcalc SkillSuccessCounter ${SkillSuccessCounter}+1 
   /call WaitForPickup
   /call ClearCursor
/return 

Sub Event_Failure 
   /varset EventType Event_Failure
   /varcalc SkillFailCounter ${SkillFailCounter}+1 
/return 

Sub Event_Alternate
   /varset EventType Event_Alternate
   /call WaitForPickup
   /call ClearCursor
/return 

Sub Event_NoIngredients
   /varset EventType Event_NoIngredients
/return

Sub Event_Trivial
   /varcalc SkillTrivialCounter ${SkillTrivialCounter}+1 
/return

Sub Event_Skillup
   /varcalc SkillUpCounter ${SkillUpCounter}+1 
   /echo ${SkillUpCounter} skill ups in ${Math.Calc[${SkillFailCounter}+${SkillSuccessCounter}+1].Int} attempts! 
/return
INI file

Code: Select all

; NewTS INI 

[Settings] 
; Wait for enviro container to become available?
;ContainerInUse=WAIT 
ContainerInUse=ABORT

| List of recipes to execute. 
| If Recipe entry starts with a # the macro will look in your
| favorite recipes list rather than searching for the recipe.
| If container name starts with # exact name is not required.
| This works well for collapsible containers.
| Valid container types are "enviro" for environmental containers
| or "pack" for containers held in inventory.

[glm] 
;Grobb Liquidised Meat
Recipe1=liquidised gator
ContType1=pack
ContName1=#Mixing Bowl
Recipe2=liquidised snake
ContType2=pack
ContName2=#Mixing Bowl
Recipe3=liquidised rat
ContType3=pack
ContName3=#Mixing Bowl
Recipe4=soda water
ContType4=enviro
ContName4=Brew Barrel
Recipe5=grobb liquidised meat
ContType5=enviro
ContName5=Brew Barrel


[kc]
;Kaladim Constitutional
Recipe1=#celestial essence
ContType1=pack
ContName1=#Mixing Bowl
Recipe2=soda water
ContType2=enviro
ContName2=Brew Barrel
Recipe3=fermented yarrow
ContType3=enviro
ContName3=Brew Barrel
Recipe4=kaladim constitutional
ContType4=enviro
ContName4=Brew Barrel


[qat]
;Qeynos Afternoon Tea
Recipe1=#celestial essence
ContType1=pack
ContName1=#Mixing Bowl
Recipe2=Cream
ContType2=pack
ContName2=#Mixing Bowl
Recipe3=bayle
ContType3=enviro
ContName3=Brew Barrel
Recipe4=Qeynos Afternoon Tea
ContType4=enviro
ContName4=Brew Barrel


;Misty Thicket Picnic subs start =======================
[sb]
;Steel Boning
Recipe1=Steel Boning
ContType1=enviro
ContName1=Forge

[pb]
:Picnic Basket
Recipe1=woven mandrake
ContType1=pack
ContName1=#Sewing Kit
Recipe2=picnic basket
ContType2=pack
ContName2=#Sewing Kit

[jsb]
;Jumjum Spiced Beer
Recipe1=jumjum spiced beer
ContType1=enviro
ContName1=Brew Barrel

[mtp]
;Misty Thicket Picnic
Recipe1=jumjum salad
ContType1=pack
ContName1=#Mixing Bowl
Recipe2=royal mints
ContType2=pack
ContName2=#Mixing Bowl
Recipe3=mature cheese
ContType3=pack
ContName3=#Mixing Bowl
Recipe4=winter chocolate
ContType4=pack
ContName4=#Mixing Bowl
Recipe5=apricot marmalade
ContType5=enviro
ContName5=oven
Recipe6=marmalade sandwich
ContType6=pack
ContName6=#Mixing Bowl
Recipe7=jumjum cake
ContType7=enviro
ContName7=oven
Recipe8=slice of jumjum cake
ContType8=enviro
ContName8=oven
Recipe9=misty thicket picnic
ContType9=enviro
ContName9=oven
;Misty Thicket Picnic subs end ===================
common.inc

Code: Select all

| common.inc Common Subroutines
| Converted 4/30/2004

| Wait for cursor to contain something.
Sub WaitForPickup 
:waiting
   /delay 1 
   /if (!${Cursor.ID}) /goto :waiting
/return 

|Wait for cursor to become empty.
Sub WaitForDrop 
:waiting 
   /delay 1
   /if (${Cursor.ID}) /goto :waiting
/return 

| Send everything on cursor to inventory.
Sub ClearCursor 
:Loop 
   /if (${Cursor.ID}) { 
      /autoinv
      /delay 5
   } 
   /if (${Cursor.ID}) /goto :Loop 
/return 

| Pause while self is targeted.
Sub Pause 
   /if (!${String[${Target}].Equal[${Me}]}) /return
   /echo Pausing!! To resume, type /target clear or target something else. 
   :HoldingPattern 
      /delay 20 
      /if (${String[${Target}].Equal[${Me}]}) /goto :HoldingPattern 
/return 

| Error reporting. 
Sub EndMacro(Error) 
   /echo ${Error}
   /echo An error has occured.. ending macro. 
   /beep
   /endmacro 
/return 
NewTS.inc

Code: Select all

| NewTS.inc by BrainDeath last updated 10-18-2004
| Uses INI files to create a complete recipe including subcombines
| using the new tradeskill interface.
| The name of the major recipe as defined in the INI file is required
| as the first parameter.  A second optional parameter is a subrecipe
| of the major recipe.  This is helpful for example if you halted the
| macro for some reason and don't want it to retry all the subcombines
| but just continue with the one it was on when halted.
| Converted to an include file from NewTS.mac

#turbo 

#include common.inc

| Update the line below to indicate where you installed EQ.
#define EQFolder "C:\Program Files\EverQuest"

#event Full "#*#There was no place to put that#*#" 
#event Error "#*#You cannot combine these items#*#" 
#event Failure "#*#You lacked the skills#*#" 
#event Success "#*#You have fashioned the items together to create something new#*#" 
#event Alternate "#*#You have fashioned the items together to create an alternate product#*#" 
#event Trivial "#*#You can no longer advance your skill from making this item#*#" 
#event SkillUp "#*#You have become better at#*#" 
#event NoIngredients "#*#Sorry, but you don't have everything you need for this recipe#*#"

#chat tell 

Sub NewTS
   /cleanup
| Declare variables
   /call DeclareOuters
   /declare inifile string local
   /declare MajorRecipe string local
   /declare ContInUse string local
   /declare RecipeCtr string local

| Define macro INI filename. 
   /varset inifile newts.ini
   
| Check for parameter of Major Recipe.
   /if (!${Defined[Param0]}) /return NO_RECIPE
   /varset MajorRecipe ${Param0}

| Check for ini file.
   /if (${String[${Ini[${inifile}]}].Equal[NULL]}) /return INI_NOT_FOUND
   
| Check for recipe list in macro INI file.
   /if (${String[${Ini[${inifile},${MajorRecipe}]}].Equal[NULL]}) /return RECIPE_NOT_FOUND
   
| Check that ContainerInUse is defined in macro INI file.
   /varset ContInUse ${Ini[${inifile},Settings,ContainerInUse]}
   /if (${ContInUse.Equal[NULL]}) /return CONTAINERINUSE_NOT_DEFINED


| Check to see if starting in middle of major recipe
   /if (${Defined[Param1]}) {
      /call FindSubRecipe "${inifile}" "${MajorRecipe}" "${Param1}"
      /varset RecipeCtr ${Macro.Return}
   } else {
      /varset RecipeCtr 1
   }
   /if (${RecipeCtr.Equal[NOTFOUND]}) /return SUBRECIPE_NOT_FOUND

| Make the recipes    
   /call DoRecipes "${inifile}" "${MajorRecipe}" "${ContInUse}" "${Int[${RecipeCtr}]}"
   /cleanup
   /beep
/return SUCCESS


| Declare outer variables.
Sub DeclareOuters
   /if (!${Defined[EQUIFile]}) /declare EQUIFile string outer EQFolder\UI_${Me}_${MacroQuest.Server}.ini
   /if (!${Defined[EventType]}) /declare EventType string outer
   /if (!${Defined[SkillTrivialCounter]}) /declare SkillTrivialCounter int outer
   /if (!${Defined[SkillFailCounter]}) /declare SkillFailCounter int outer 
   /if (!${Defined[SkillSuccessCounter]}) /declare SkillSuccessCounter int outer 
   /if (!${Defined[SuccessRate]}) /declare SuccessRate float outer 
   /if (!${Defined[TotalAttempts]}) /declare TotalAttempts int outer 
   /if (!${Defined[SkillUpRate]}) /declare SkillUpRate float outer 
   /if (!${Defined[SkillUpCounter]}) /declare SkillUpCounter int outer 
   /if (!${Defined[DestroyFlag]}) /declare DestroyFlag bool outer FALSE
/return


| Check for the existence of a subrecipe for the major recipe in your INI file.
Sub FindSubRecipe(inifile,MajorRecipe,SubRecipe)
   /declare SubINI string local
   /declare SubCtr int local 1
   :Loop 
      /varset SubINI ${Ini[${inifile},${MajorRecipe},Recipe${SubCtr}]}
      /if (${SubINI.Find[${SubRecipe}]}) /return ${SubCtr}
      /if (${SubINI.Equal[NULL]}) /return NOTFOUND
      /varcalc SubCtr ${SubCtr}+1 
   /goto :Loop 
/return


| Grab the subrecipe from INI file and execute it.
Sub DoRecipes(inifile,MajorRecipe,ContInUse,int RecipeCtr)
   /declare SubRecipe string local
   :Loop 
      /varset SubRecipe ${Ini[${inifile},${MajorRecipe},Recipe${RecipeCtr}]}
      /if (${SubRecipe.Equal[NULL]}) /return
      /if (${SubRecipe.Left[1].Equal[#]}) /varset SubRecipe ${SubRecipe.Right[-1]}
      /call ResetCounters
      /echo Executing recipe ${SubRecipe}... 
      /call TradeSkills "${inifile}" "${MajorRecipe}" "${RecipeCtr}" "${ContInUse}"
      /call DisplayStats
      /varcalc RecipeCtr ${RecipeCtr}+1 
   /goto :Loop 
/return 


| Reset the counters for the statistics display.
Sub ResetCounters
   /varset SkillTrivialCounter 0 
   /varset SkillFailCounter 0 
   /varset SkillSuccessCounter 0 
   /varset SuccessRate 0 
   /varset TotalAttempts 0 
   /varset SkillUpRate 0 
   /varset SkillUpCounter 0 
/return


|  Checks the INI file for the subrecipe parameters, opens the appropriate
|  container and performs the combines.
Sub TradeSkills(inifile,MajorRecipe,int SubRecipeNum,ContInUse) 
   /declare ContType string local
   /declare ContName string local
   /declare PackNum int local
   /declare SubRecipe string local

   /varset ContType ${Ini[${inifile},${MajorRecipe},ContType${SubRecipeNum}]}
   /if (${ContType.Equal[NOTFOUND]}) /return CONTTYPE_NOT_DEFINED

   /varset ContName ${Ini[${inifile},${MajorRecipe},ContName${SubRecipeNum}]}
   /if (${ContName.Equal[NOTFOUND]}) /return CONTNAME_NOT_DEFINED

| Find and open combiner
   /if (${ContType.Equal[enviro]}) {
      /call OpenEnviro "${ContName}" "${ContInUse}"
      /if (${Macro.Return.NotEqual[OPEN]}) /return ENVIRO_NOT_OPEN
      /varset PackNum e
   } else /if (${ContType.Equal[pack]}) {
      /call OpenPack "${ContName}"
      /if (${Macro.Return.NotEqual[OPEN]}) /return PACK_NOT_OPEN
      /varset PackNum ${Macro.Return}
   } else {
      /return CONTTYPE_INVALID
   }
   
| Main Combine Routine
   /call ClearCursor
   /varset SubRecipe ${Ini[${inifile},${MajorRecipe},Recipe${SubRecipeNum}]}
   /if (${SubRecipe.Equal[NOTFOUND]}) /return SUBRECIPE_NOT_FOUND
   /call ChooseRecipe "${SubRecipe}"
   :Begin
      /call DoCombine
      /if (!${EventType.Equal[Event_NoIngredients]}) /goto :Begin
   /call ClearCursor
   /notify COMBW_FlagsArea COMBW_CloseButton leftmouseup
/return 


| Type input string "Recipe" into search box in new tradeskill interface,
| click search and select the first recipe returned in the search results.
Sub ChooseRecipe(Recipe)
   /if (${Recipe.Left[1].Equal[#]}) { 
      /notify COMBW_FavoritesArea COMBW_ShowFavoritesButton leftmouseup
      /varset Recipe ${Recipe.Right[-1]}
   } else {
      /notify COMBW_SearchArea COMBW_SearchTextEdit leftmouseup
      /delay 5
      /call Type "${Recipe}"
      :WaitForSearchButton
         /if (!${Window[COMBW_SearchArea].Child[COMBW_SearchButton].Enabled}) /goto :WaitForSearchButton
      /notify COMBW_SearchArea COMBW_SearchButton leftmouseup
   }
   /delay 10
   /notify COMBW_RecipeListArea COMBW_RecipeList listselect ${Window[COMBW_RecipeListArea].Child[COMBW_RecipeList].List[${Recipe}]} 
/return


| Click combine until you get an event.
Sub DoCombine
   /varset EventType NULL
   :Loop
      /if (!${Window[COMBW_CombineArea].Child[COMBW_CombineButton].Enabled}) /goto :Loop
      /notify COMBW_CombineArea COMBW_CombineButton leftmouseup
      /delay 10
      /doevents
      /if (${EventType.Equal[NULL]}) /goto :Loop
/return


| Open an enviromental container given name (item).  Action tells whether or
| not to wait for the container to become available.
Sub OpenEnviro(item,action) 
   /declare count1 int local 0
   :Loop
      /call EnviroOpen "${item}"
      /if (${Macro.Return.Equal[OPEN]}) /return OPEN
      /squelch /itemtarget ${item}
      /if (!${Target.Distance}) /return NOTFOUND
      /if (${Target.Distance}>20) /return NOTINREACH
      /face fast nolook 
      /click left item 
   :Check 
      /varcalc count1 ${count1}+1 
      /delay 10 
      /call EnviroOpen "${item}"
      /if (${Macro.Return.Equal[OPEN]}) /return OPEN
      /if (${count1}==5) { 
         /if (${action.Find[WAIT]}) /varset count1 0 
         /goto :Loop 
         } 
      /if (${count1}==10) /goto :Loop 
      /if (${count1}>=15) { 
         /return INUSE 
         } 
      /goto :Check 
/return OPEN

| Checks to see if an enviromental container is open given its name.
Sub EnviroOpen(Name)
   /if  (${Window[TradeskillWnd].Open}) {
      /if (${Window[COMBW_ContainerArea].Child[COMBW_ContainerName].Text.Find[${Name}]}) {
         /return OPEN
      } else {
         /notify COMBW_FlagsArea COMBW_CloseButton leftmouseup
      }
   }
/return NOTOPEN


| Opens a pack given its name. 
Sub OpenPack(PackName)
   /declare PackNum int local
   
   /call ContFind "${PackName}"
   /if (!${Macro.Return}) /return NOTFOUND
   /varset PackNum ${Macro.Return}
   
   /if (!${Window[Pack${PackNum}].Open}) { 
      /if (!${Window[Inventory].Open}) /keypress INVENTORY
      /if (${Ini[${EQUIFile},TradeskillWnd,CtrlBypass].Equal[1]}) { 
         /itemnotify pack${PackNum} rightmouseup 
      } else { 
         /Ctrl /itemnotify pack${PackNum} rightmouseup 
      }
      /delay 5
   }
   /if (${PackName.Left[1].Equal[#]}) /varset PackName ${PackName.Right[-1]}
   /call EnviroOpen "${PackName}"
   /if (${Macro.Return.Equal[OPEN]}) /return OPEN
/return OPEN


| Determine the pack number of a container
| Input: name of container, if name starts with # will use "contains" for comparison
|        to find the container
| Output: pack number of container or 0 if container is not in inventory
Sub ContFind(InName)
   /declare ContName string local 
   /declare NameFlag int local 
   /declare loopctr int local 
   /declare PackNum int local 0

   /if (${InName.Left[1].Equal[#]}) { 
      /varset ContName ${InName.Right[-1]}
      /varset NameFlag 0 
   } else { 
      /varset ContName ${InName}
      /varset NameFlag 1 
   } 
   /for loopctr 1 to 8 
      /if (!${NameFlag}) /if (${String[${Me.Inventory[Pack${loopctr}]}].Find[${ContName}]}) /varset PackNum ${loopctr}
      /if (${NameFlag}) /if (${String[${Me.Inventory[Pack${loopctr}]}].Equal[${ContName}]}) /varset PackNum ${loopctr}
   /next loopctr 
/return ${PackNum}


| Type out the input string.  Only non-alphabetic character
| currently handled is space.
Sub Type(InStr)
   /declare char string local
   /declare loopctr int local
   /for loopctr 1 to ${InStr.Length}
      /varset char ${InStr.Mid[${loopctr},1]}
      /if (!${char.Length}) {
         /keypress space chat
      } else {
         /keypress ${char} chat
      }
   /next loopctr
/return


| Display combine statistics.
Sub DisplayStats 
   /echo Combine Statistics - Successes: ${SkillSuccessCounter}, Failures: ${SkillFailCounter}, Trivial: ${SkillTrivialCounter}
   /varcalc TotalAttempts ${SkillFailCounter}+${SkillSuccessCounter} 
   /if (${TotalAttempts}) { 
      /varcalc SuccessRate (${SkillSuccessCounter}/${TotalAttempts})*100 
      /varcalc SkillUpRate (${SkillUpCounter}/${TotalAttempts})*100 
      /echo Success Rate: ${SuccessRate.Deci}% out of ${TotalAttempts} attempts 
   } else { 
      /echo Unable to complete a combine.  No Stats to report 
   } 
   /if (${SkillUpCounter}) /echo Skill Ups: ${SkillUpCounter} , Skill Rate: ${SkillUpRate.Deci}% out of ${TotalAttempts} attempts 
|   /if (${SkillTrivialCounter}) /echo THIS ITEM IS OR HAS GONE TRIVIAL! 
/return 


| Event handling.
Sub Event_Chat 
   /varset EventType Event_Chat
   /call ClearCursor
   /keypress TARGETME
   /call Pause
/return 

Sub Event_Full 
   /varset EventType Event_Full
   /delay 5
   /call ClearCursor
   /cleanup
   /return INVENTORY_FULL
/return 

Sub Event_Error 
   /varset EventType Event_Error
   /delay 5
   /call ClearCursor
/return 

Sub Event_Success 
   /varset EventType Event_Success
   /varcalc SkillSuccessCounter ${SkillSuccessCounter}+1 
   /call WaitForPickup
   /call ClearCursor
/return 

Sub Event_Failure 
   /varset EventType Event_Failure
   /varcalc SkillFailCounter ${SkillFailCounter}+1 
/return 

Sub Event_Alternate
   /varset EventType Event_Alternate
   /call WaitForPickup
   /call ClearCursor
/return 

Sub Event_NoIngredients
   /varset EventType Event_NoIngredients
/return

Sub Event_Trivial
   /varcalc SkillTrivialCounter ${SkillTrivialCounter}+1 
/return

Sub Event_Skillup
   /varcalc SkillUpCounter ${SkillUpCounter}+1 
   /echo ${SkillUpCounter} skill ups in ${Math.Calc[${SkillFailCounter}+${SkillSuccessCounter}+1].Int} attempts! 
/return
Last edited by BrainDeath on Mon Oct 18, 2004 5:35 pm, edited 7 times in total.

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Tue May 04, 2004 9:15 pm

I was considering converting this to an include file with no outer variable declarations. Anyone interested? If not, I probably won't bother.

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Thu May 13, 2004 11:12 am

Updated 5-13-04 to work with latest version.

kasodo
a lesser mummy
a lesser mummy
Posts: 64
Joined: Fri Feb 13, 2004 9:41 am

Very Nice

Post by kasodo » Thu May 13, 2004 12:13 pm

Thank you for this Braindeath, Ran it at work and it was very easy to set up and run! Great work. Making it an include would be very nice to have. Maybe a plugin =D
<Oid> You know whats sad
<Oid> here soon, lax will log in
<Oid> and go "You fucking idiots!"
* Lax has joined #macroquest
* ChanServ sets mode: +o Lax
...
<Lax> you fucking idiots!

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Thu May 13, 2004 2:18 pm

Like this a lot, will probably start using it for all my mass production needs.

On recipies...anyone have some other recipies they use alot? Celestial Essence, Ethereal Metal Rings/Sheets/Swatches/Cured and the temper/curing agent for that stuff comes to mind for this as starters.

Anyone have those recipies already written? And, do we actually need them if we have them saved in our favorites list?

Also I do think this would be useful as an include. Im thinking it could be called from a macro that would move between merchants/containers to buy ingredients, etc. It might also be a useful include from a skillup macro, where they could add the trivial levels, etc.

Thanks a bunch for your work on this, would like to try and get this working tonight.

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Thu May 13, 2004 5:10 pm

So I added this to the ini:

Code: Select all

[ce]
;celestial essence
Recipe1=Celestial Solvent
ContType1=pack 
ContName1=#Mixing Bowl
Recipe2=The Scent of Marr
ContType1=pack 
ContName1=#Mixing Bowl
And tried to make it with /mac newts ce

It came back complaining:
Unknown # comment #event Full "#*#There was no place to put that#*#"
Unable to add macro line.

I am kinda hoping this is just a Blech problem that will go away with the next zip, but did I do this the right way?

kasodo
a lesser mummy
a lesser mummy
Posts: 64
Joined: Fri Feb 13, 2004 9:41 am

10lb Pie

Post by kasodo » Fri May 14, 2004 10:12 am

Haven't completely tested this yet but it shoudl work.

Code: Select all

[10lb]
;Halas 10lb Pie
Recipe1=#cream
ContType1=pack
ContName1=#Mixing Bowl
Recipe2=#creamy fennel sauce
ContType2=pack
ContName2=#Mixing Bowl
Recipe3=filleted bear
ContType3=pack
ContName3=#Spit
Recipe4=filleted lion
ContType4=pack
ContName4=#Spit
Recipe5=filleted mammoth
ContType5=pack
ContName5=#Spit
Recipe6=filleted wolf
ContType6=pack
ContName6=#Spit
Recipe7=bear fillet in cream
ContType7=pack
ContName7=#Spit
Recipe8=lion fillet in cream
ContType8=pack
ContName8=#Spit
Recipe9=mammoth fillet in cream
ContType9=pack
ContName9=#Spit
Recipe10=wolf fillet in cream
ContType10=pack
ContName10=#Spit
Recipe11=clump of dough
ContType11=pack
ContName11=#Mixing Bowl
Recipe12=Halas 10lb Meat Pie
ContType12=enviro
ContName12=Oven
<Oid> You know whats sad
<Oid> here soon, lax will log in
<Oid> and go "You fucking idiots!"
* Lax has joined #macroquest
* ChanServ sets mode: +o Lax
...
<Lax> you fucking idiots!

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

Crash Errors

Post by GD » Sat May 15, 2004 9:47 pm

* * UPDATE * *
Macro doesn't like recipes that have ( or ) in the name, below is the fix:

Code: Select all

Sub DoRecipes(inifile,MajorRecipe,ContInUse,int RecipeCtr)
	/declare SubRecipe string local
	:Loop
		/varset SubRecipe ${Ini[${inifile},${MajorRecipe},Recipe${RecipeCtr}]}
		/if (${SubRecipe.Equal[NULL]}) /return
		[color=red]/if (${SubRecipe.Find[(]}) /varset SubRecipe ${SubRecipe.Left[${Math.Calc[${SubRecipe.Find[(]}-1]}]}[/color]
		/if (${SubRecipe.Left[1].Equal[#]}) /varset SubRecipe ${SubRecipe.Right[-1]}
		/call ResetCounters
		/echo Executing recipe ${SubRecipe}...
		/call TradeSkills "${inifile}" "${MajorRecipe}" "${RecipeCtr}" "${ContInUse}"
		/call DisplayStats
		/varcalc RecipeCtr ${RecipeCtr}+1
	/goto :Loop
/return
Opinions are like assholes, everyone has one, but most of them stink.

Skate4mindgame
decaying skeleton
decaying skeleton
Posts: 4
Joined: Sat Mar 06, 2004 11:51 pm

HELP!!!! hehe

Post by Skate4mindgame » Mon May 17, 2004 3:14 pm

Was working great for me then i crashed logged back on and tried running it again nothing will work. Items such as kilns, pottery wheels, forges dissapear as well when i run the macro after getting spammed with errors i tried redoing the macros inc files and ini, also tried reinstalling MQ2 nothing worked. Any ideas??

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Mon May 17, 2004 3:38 pm

Any ideas? hmmmm....

Maybe post some of those errors so we might have the smallest idea as to what is wrong? I dunno, crazy me. :wink:

robdawg
a ghoul
a ghoul
Posts: 114
Joined: Tue Mar 23, 2004 11:54 am
Contact:

....

Post by robdawg » Mon May 17, 2004 3:40 pm

I have got this macro to crash on a consistant basis.

IF you have the tradeskill window open before running this macro, it will crash.

I have duplicated this about 5 times and confirmed it. As for a fix, well I dont really care because I just make sure that I dont run it with a tradeskill window open. :)
ROBDAWG

[url=http://www.seathound.com]Seat Hound[/url]
[url=http://www.sportsrumormill.com]Sports Rumor Mill[/url]
[url=http://www.packerforum.com]Packer Forum[/url]

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Tue May 18, 2004 9:44 am

A change in one of the recent zips appears to have broken this. I'm checking it out.

As far as crashing if the tradeskill window is already open, you aren't supposed to run this macro with the tradeskill window open :P Feel free to stick a /cleanup at the beginning if you want.
Chill wrote:did I do this the right way?
No, you are trying to do the ini like the standard TS macro ini. The included ini file above already has CE in it. The problem with CE is that it has a million recipes. So add the scent of marr one to your favorites list in the tradeskill window and then use:

Code: Select all

[ce]
Recipe1=#celestial essence
ContType1=pack
ContName1=#Mixing Bowl

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Tue May 18, 2004 11:07 am

Ok, checked it out, definitely broken with 5-17 zip.

Figured out what's wrong and I will update the macro when I get an answer to the question I asked in this thread.

BrainDeath
a ghoul
a ghoul
Posts: 86
Joined: Sun Mar 07, 2004 5:00 pm

Post by BrainDeath » Thu May 20, 2004 7:12 am

Decided to quit being lazy and just fixed it. Tested and working.

I didn't incorporate the change suggested by GD, and here's why. The recipe name specified in the ini file can't contain any non alphabetic characters other than space. Examples of things that don't work are: Bayle's Delight, Vegetable Oil (4), etc.

The problem is this sub:

Code: Select all

| Type out the input string.  Only non-alphabetic character
| currently handled is space.
Sub Type(InStr)
   /declare char string local
   /declare loopctr int local
   /for loopctr 1 to ${InStr.Length}
      /varset char ${InStr.Mid[${loopctr},1]}
      /if (!${char.Length}) {
         /keypress space chat
      } else {
         /keypress ${char} chat
      }
   /next loopctr
/return
If anyone has any suggestions to correct this, please let me know.

eqaussie
a ghoul
a ghoul
Posts: 124
Joined: Tue Mar 16, 2004 5:58 am

Post by eqaussie » Mon May 24, 2004 8:13 pm

Dont suppose you can add an option for CTRL-Clicking?

I had been trying to get this to work for ages but had CTRL-Click turned on, so every time i tried running it, it would crash EQ