Page 4 of 5

Posted: Sun Jul 04, 2004 9:20 pm
by kellewic
The only time it should give a message about cleaning out a bag is for the combine container. It shouldn't be trying to clean out other packs, but I haven't used it for other combine containers except the enviro container.

What combine container are you using and which version of the code (original posted version or the include version)?

Posted: Sun Jul 04, 2004 10:27 pm
by rasor
am using a collapsible mixing bowl. When i refered to it saying unable to clear out bag # whatever it turns out it's whatever slot i move the mixing bowl to that it calls that bag#. I am using the original macro at the front of this thread.

I quit Everquets...

Posted: Wed Jul 07, 2004 11:24 am
by Kaitain
Sorry for the lack of reply, I've quit playing Everquest. It was just too boring. I don't even have EQ or MQ installed on my computer so I can't really help.

I seriously doubt I'll ever pick up EQ again since WOW and EQ2 will be coming out soon. It's funny too, I have like 17 leatherfoot haversacks on my druid I was going to sell, but even that wasn't any fun anymore either with the assholes selling tinker bags for 50pp profit...

Posted: Wed Jul 07, 2004 1:13 pm
by kellewic
Try this version rasor. I've been fixing and adding things to this macro for a few weeks now. I really haven't had a chance to try it with containers that are in the inventory yet. If you find it still doesn't work, I will try to fix it tonight or tomorrow if possible. There are 2 files (khits.inc and utils.inc). You will need to make a wrapper macro or change sub Make to sub Main in the khits.inc and rename it to khits.mac


khits.inc:

Code: Select all

|**
    khiTS.mac

    Author:     Kaitain Heavy Industries
    Date:       30 Apr 04
    Version:    2.2.2.14

    Description:
    Performs tradeskill combines using recipes supplied in an ini file

    Credits:
    Inspired by Dont_Know_At_All's Trade Skills macro - The status report idea is completely stolen from him (but rewritten by me)
    Ini file uses the format created by Diggler (this will eventually being changed to a new format using item id's)

    Notes:
    * Updated to use MQ2DataVars
    * This is a complete overhaul of the whole macro in addition changing it to work with MQ2Data and MQ2DataVars
    * You should be able to simply rename "sub main" to "sub khiTS" if you want to use this as an included file.
    * No longer destroys tools or components used to do combines when destroy-results is enabled.
    * This is a BIG macro and may be slow as hell on older computers.

   Usage:
   #include khits.inc
   .
   .
   .
   /call Make  <recipe_name> <options>

   Example:
   /call Make khits bits "show-stats=0 destroy=0 abort-on-tell=0 end-on-trivial=0 silent-mode=0 stop-at-skill-level=200"
   Ported to Inc by Draco
**|

| ***** Tweak this to your computer, if you get a lot of an item in the combine container, increase this number ***** |
#define COMBINE_DELAY 3

| ***** CHANGE THIS TO MATCH YOUR INI FILE NAME IF NECESSARY ***** |
#define INIPATH "recipes.ini"


#event SkillTrivial "You can no longer advance your skill from making this item#*#"
#event SkillUp "You have become better at #1#! (#2#)"
#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!"
#event HandsFull   "You cannot combine items when your hands are full#*#"

#chat tell

#define COMBINE_SUCCESS         0
#define COMBINE_FAILED         1
#define COMBINE_ERROR         2
#define COMBINE_INVENTORY_FULL   3
#define COMBINE_TRIVIAL         4

#include utils.inc

| Main entry point
sub Make
    /echo
    /echo *****************************************
    /echo khiTs: Tradeskills running : ${Time}
    /echo *****************************************
    /echo


    | Check for no parameters or help
    /if (!${Defined[Param0]} || ${Param0.Equal[HELP]}) {
        /call displayHelp
        /call clearCursor ${iDestroyResults}
        /endmacro
    }
   
    | container in which the recipe will be made
    /declare containerName      string  local   NOT_SET
   
    | The name of the current component we're getting
    /declare currentComp        string  local   NOT_SET
   
    | Make sure we have that recipe in the ini file
    /declare recipeCheck        string  local   NOT_SET

    | Settings (see end of this file for list of settings)
    | Stops the macro if someone sends you a tell
    /declare abortOnTell        int     local   0
   
    | How many itmes the user has requested be made
    /declare makeThisMany       int     local   0
   
    | Display when you succed, get skillups, fail, etc.
    /declare showStats          int     local   0

    | For looping through containers
    /declare slotNumber         int     local   1
   

   | Exit and Return Flags added by Draco
   /declare combineResult int outer 0
   /declare cleanUpAndExit int outer 0
   /declare combineErrorCounter int outer 0

    | Only declare outer variables once, this is in case you use this as an include   
   /if (!${Defined[components]}) {
        | Array of components used to make the recipe
        /declare components[10]     string  outer
       
       | The name of the combination being done, this is used to look up the recipe in the recipe.ini file
       /declare recipeName         string  outer
       
        | Container in which the recipe will be made
        /declare containerNum       string  outer   NOT_SET
       
        | The number of components in the recipe
        /declare iCompCount         int     outer   0

        | Flags
        /declare bCombineDone       bool    outer   FALSE
        /declare bSkillTrivial      bool    outer   FALSE

        | Destroys the results of a combine (but not any items used in the combine)
        /declare iDestroyResults     int     outer   0

        | Stops the macro when you can no longer get skillups from doing the combine
        /declare iEndOnTrivial       int     outer   0

        | How many times you've tried a combination
        /declare iSkillAttempts      int     outer   0
       
        | How many times it worked
        /declare iSkillSuccess       int     outer   0
       
        | How many times it didn't work
        /declare iSkillFailure       int     outer   0
       
        | How many skill points you have received
        /declare iSkillUps           int     outer   0
       
        | Skill level to stop at
        /declare iStopAtSkillLevel    int     outer    0

       | Keeps MQ window spam to a minimum
       /declare silentMode          int     outer   0
       
       | Output debugging information
       /declare debug             int   outer    0
       
       | Flag to close tradeskill container when finished
       /declare iCloseContainer    int   outer    1
       
        | The results of what we are making
        /declare sResults           string  outer
       
        | Skill we are using (i.e. Brewing, Smithing, etc)
        /declare sUsing            string   outer   NOT_SET
    } else {
        | Clean out the last components used, this is in case we have not cleared the variables or are using this as an include
        /deletevar components
        /declare components[10]
    }


    |Get requested recipe's name
    /varset recipeName ${Param0}

    | If there is only one parameter, then there are no options
    /if (${Defined[Param1]}) {
       /declare tmp int local
       /declare parms int local ${Macro.Params}
       /declare parmString string local
       /varcalc parms ${parms}-1
      
      /for tmp 1 to ${parms}
         /varset parmString ${parmString} ${Param${tmp}}
      /next tmp
      
        /call parseArguments "abort-on-tell" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset abortOnTell ${Macro.Return}
       }

        /call parseArguments "destroy-results" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset iDestroyResults ${Macro.Return}
       }

        /call parseArguments "end-on-trivial" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset iEndOnTrivial ${Macro.Return}
       }

        /call parseArguments "make-this-many" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset makeThisMany ${Macro.Return}
       }

        /call parseArguments "show-stats" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset showStats ${Macro.Return}
       }

        /call parseArguments "stop-at-skill-level" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset iStopAtSkillLevel ${Macro.Return}
       }
       
        /call parseArguments "close-container" "${parmString}"
       
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset iCloseContainer ${Macro.Return}
       }
       
        /call parseArguments "debug" "${parmString}"
        /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
           /varset debug ${Macro.Return}
       }

        /if (!${debug}) {
           /call parseArguments "silent-mode" "${parmString}"
           /if (${Macro.Return.NotEqual[__NOT_FOUND__]}) {
              /varset silentMode ${Macro.Return}
          }
       } else {
          /echo ***** DEBUGGING ON *****
       }
    }

    | Make sure the recipe file exists (the recipes thing is a fix for a bug in the Ini function)
    /varset recipeCheck ${Ini[INIPATH,recipes]}
    /if (${recipeCheck.Equal[NULL]}) {
        /echo khiTS Error: Recipe file not found
        /echo Path = INIPATH
        /goto :khiTSreset
    }

    | Make sure this recipe exists in the recipe.ini file
    /varset recipeCheck ${Ini[INIPATH,${recipeName}]}
    /if (${recipeCheck.Equal[NULL]}) {
        /echo khiTS Error: Recipe not found
        /echo Recipe name = ${recipeName}
        /goto :khiTSreset
    }

    | Get the container name
    /varset containerName ${Ini[INIPATH,${recipeName},Cont]}
    /if (${containerName.Equal[NULL]}) {
        /echo khiTS Error: Error in ini file for this recipe, no container is specified
        /echo khiTS      : Recipe = ${RecipeName}
        /goto :khiTSreset
    }
   
    | Get the skill we are using
    /varset sUsing ${Ini[INIPATH,${recipeName},Skill]}
    /if (${sUsing.Equal[NULL]})   /varset sUsing NOT_SET

    | Get the item we are making
    /varset sResults ${Ini[INIPATH,${recipeName},LongName]}
    /if (${sResults.Equal[NULL]})   /varset sResults ${recipeName}

    | Find the combine container number
    /if (${containerName.Equal[Enviro]}) {
        /if (!${Window[Enviro].Open}) {
            /echo khiTS Error: You must have the enviromental container open to begin
            /goto :khiTSreset
        }
        /varset containerNum e
    } else {
        | Not an enviromental container so find the container's pack number, this is how we will refer to it from now on
        /varset containerNum ${FindItem[=${containerName}].InvSlot.ID}
        /if (${containerNum}) {
            /varcalc containerNum ${containerNum}-21
            /varset containerNum ${containerNum.Arg[0,.]}
        } else {
            | Didn't find the container
            /echo khiTS Error: Could not find container in your inventory
            /echo khiTS      : Contanier name = ${containerName}
            /goto :khiTSreset
        }
    }
   
    | Read the ingredients for the recipe from the ini file       
    :khiTSReadComponentsLoop
    /varset currentComp ${Ini[INIPATH,${recipeName},Comp${iCompCount}]}
   /if (${currentComp.NotEqual[NULL]}) {
        /varcalc iCompCount ${iCompCount}+1
        /varset components[${iCompCount}] ${currentComp}
        /goto :khiTSReadComponentsLoop
    }

    /call OpenPacks

    | Remove anything from the cursor if needed
    /call clearCursor ${iDestroyResults}

    | Clear the combine pack
    /call cleanPack ${containerNum}
    /if (${cleanUpAndExit})   /goto :khiTSreset

   | Let's just do this here rather than through every iteration of combines
   /declare MAIN_CONTAINER string local
    /if (${containerNum.Equal[e]}) {
        /varset MAIN_CONTAINER enviro
    } else {
        /varset MAIN_CONTAINER pack${containerNum}
    }
   
   
    :khiTSCombineLoop
        | Delete or Save items depending on settings
        /call clearCursor ${iDestroyResults}

      /if (!${silentMode})   /echo khiTS: Making ${sResults} - Count = ${iSkillSuccess}

        | Move ingredients to container
        /call addComponents
        /if (${cleanUpAndExit})   /goto :khiTSCleanUpMacro

        | Combine
        /varset bCombineDone FALSE
        /varcalc iSkillAttempts ${iSkillAttempts}+1
       
        :DoCombineLoop
        /combine ${MAIN_CONTAINER}

        | Need this delay here to make sure the combine is finished
        /delay COMBINE_DELAY

        | Call these events individually so they do not conflict with a parent macro if this macro is used as an included file
        /doevents SkillTrivial
        /doevents SkillUp
        /doevents SkillFailure
        /doevents SkillSuccess
        /doevents CombineError
        /doevents FullInventory
        /doevents tell
        /doevents HandsFull
     
         /if (${cleanUpAndExit})   /goto :khiTSCleanUpMacro
        /if (!${bCombineDone})   /goto :DoCombineLoop

        /varset combineErrorCounter 0

        | See if we have made enough
        /if (${makeThisMany} && ${makeThisMany} == ${iSkillSuccess})   /goto :khiTSCleanUpMacro

        /goto :khiTSCombineLoop

    | The macro is ending, clean up
    :khiTSCleanUpMacro
      | Delete or Save items depending on settings - Just in case
      /call clearCursor ${iDestroyResults}
      /call cleanPack ${containerNum}
      /call DisplayStats
     
    :khiTSreset
      /if (${iCloseContainer})   /notify ContainerWindow DoneButton leftmouseup
      /call resetKhits

/return ${combineResult}


Sub resetKhits
   /deletevar combineResult
   /deletevar cleanUpAndExit
   /deletevar combineErrorCounter
   /deletevar containerNum
   /deletevar iCompCount
   /deletevar bCombineDone
   /deletevar bSkillTrivial
   /deletevar iDestroyResults
   /deletevar iEndOnTrivial
   /deletevar iSkillAttempts
   /deletevar iSkillSuccess
   /deletevar iSkillFailure
   /deletevar iSkillUps
   /deletevar sResults
   /deletevar components
   /deletevar iStopAtSkillLevel
   /deletevar recipeName
   /deletevar iCloseContainer
/return



sub clearCursor(int DestroyResults)
   /declare saveCount int local

    :khiTSClearCursorLoop
    /delay 2 ${Cursor.ID}

    | Is there anything on the cursor?
    /if (${Cursor.ID}) {
        /if (${DestroyResults}) {
            | Make sure the item on the cursor is not something we want to save
            /for saveCount 1 to 10
                /if (${components[${saveCount}].Equal[${Cursor.Name}]}) {
                   /if (!${silentMode})   /echo -- Saving ${components[${saveCount}]} to inventory
                    /autoinv
                    /goto :khiTSClearCursorLoop
                }
            /next saveCount

            | Whatever is on the cursor wasn't in the save list
            /if (!${silentMode})   /echo -- Destroying ${Cursor.Name}
            /destroy
        } else {
            /autoinv
        }

        /goto :khiTSClearCursorLoop
    }
/return



Sub DisplayStats
    /echo
    /echo khiTS: Stat display
    /echo ================================
    /echo Attempts: ${iSkillAttempts}
    /echo Successes: ${iSkillSuccess}
    /echo Faliures: ${iSkillFailure}
    /echo Skill Ups: ${iSkillUps}

    /if (${Me.Skill[${sUsing}]}) {
       /echo Skill Level: ${Me.Skill[${sUsing}]}
    } else {
       /echo Skill Level: Unknown
    }
/return



Sub Event_Chat(string type, string sender, string text)
    /if (${String[${abt}].Equal[TRUE]} && ${type.Equal[tell]} ) {
        /echo khiTS Event_Chat: Got a tell, pausing.
        /if (!${Defined[pauseTimer]}) /declare pauseTimer timer outer
        /varset pauseTimer 600
      :TellPause
         /if (${Spawn[gm]}) {
           /if (!${Me.Sitting})   /docommand /sit
           /docommand /camp desktop
           /call mqout "GM in Zone! Logging out"
           /endmacro
         }

        /if (${pauseTimer<1}) /return
        /goto :TellPause
        /mqpause
    }
/return



Sub Event_HandsFull
   /echo khiTS Event_HandsFull Error: Unrecoverable error, ending macro
   /endmacro
/return



Sub Event_CombineError
    /varcalc combineErrorCounter ${combineErrorCounter}+1
    /if (!${silentMode})   /echo khiTS Event_CombineError: ${combineErrorCounter}

    /endmacro
   
    | *** FIXME *** |
    /if (${combineErrorCounter} < 3) {
       /call cleanPack ${containerNum}
       /call clearCursor ${iDestroyResults}
       /varset bCombineDone TRUE
   } else {
       /varset combineResult COMBINE_ERROR
       /varset cleanUpAndExit 1
   }
/return



Sub Event_FullInventory
    /echo khiTS Event_FullInventory Error: Your inventory is full, ending macro.
    /call DisplayStats
    /varset combineResult COMBINE_INVENTORY_FULL
    /varset cleanUpAndExit 1
/return



Sub Event_SkillFailure
    /varcalc iSkillFailure ${iSkillFailure}+1
    /varset bCombineDone TRUE
    /varset combineResult COMBINE_FAILED
/return



Sub Event_SkillSuccess
    /if (${sResults.Equal[${recipeName}]}) {
       /declare MaxWaitCount timer local 100
       :WaitForIt
       /delay 2 ${Cursor.ID}
       /if (!${Cursor.ID} && !${MaxWaitCount} == 0)   /goto :WaitForIt
       /varset sResults ${Cursor.Name}
    }

    /varcalc iSkillSuccess ${iSkillSuccess}+1
    /varset bCombineDone TRUE
    /varset combineResult COMBINE_SUCCESS
/return



Sub Event_SkillUp
   /varset sUsing ${Param1}
    /varcalc iSkillUps ${iSkillUps}+1

    /if (${iStopAtSkillLevel} && ${iStopAtSkillLevel} == ${Param2}) {
        /call DisplayStats
        /call cleanPack ${containerNum}
        /call clearCursor ${iDestroyResults}
        /varset cleanUpAndExit 1
    }
/return



Sub Event_SkillTrivial
    /if (!${bSkillTrivial}) {
        /echo khiTS Event_SkillTrivial: Skill is trivial
        /varset bSkillTrivial TRUE
    }

    /if (${iEndOnTrivial}) {
        /call DisplayStats
        /call cleanPack ${containerNum}
        /call clearCursor ${iDestroyResults}
        /varset cleanUpAndExit 1
    }

    /varset combineResult COMBINE_TRIVIAL
/return



sub cleanPack(string PackNumber)
    /if (!${silentMode})   /echo khiTS cleanPack: Cleaning out pack: ${PackNumber}
   
    | Used for looping through pack slots
    /declare iSlot      int local
   
    | How many freeslots are in the bag
    /declare iCount     int local

    /if (${PackNumber.Equal[e]}) {
       /if (!${silentMode})    /echo khiTs cleanPack: Clearing enviro

        /for iSlot 1 to 10
           /if (${InvSlot[enviro${iSlot}].Item.ID}) {
               /shiftkey /itemnotify enviro${iSlot} leftmouseup
               /call clearCursor ${iDestroyResults}
           }
        /next iSlot
    } else {
      /if (!${silentMode})   /echo khiTs cleanPack: Cleaning out ${PackNumber}
        | Can't empty a non-pack duh!
        /if (!${Me.Inventory[Pack${PackNumber}].Container}) {
            /echo khiTs cleanPack Error: No pack in slot
            /varset cleanUpAndExit 1
            /return
        }

        /for iSlot 1 to ${Me.Inventory[Pack${PackNumber}].Container}
            | Quit if the pack is empty
            /if (!${Me.Inventory[Pack${PackNumber}].Container})   /return

            /if (${debug})   /echo khiTs cleanPack: Clearing Pack: Pack${PackNumber}, Slot:${iSlot}, Item: ${Me.Inventory[Pack${PackNumber}].Item[${iSlot}]}

            /if (${Me.Inventory[Pack${PackNumber}].Item[${iSlot}].ID}) {
                /varset iCount ${Me.Inventory[Pack${PackNumber}].Items}

                /shiftkey /itemnotify in pack${PackNumber} ${iSlot} leftmouseup
                /call clearCursor ${iDestroyResults}

                | Make sure we aren't just putting it back in the same bag
                /if (${Me.Inventory[Pack${PackNumber}].Items} == ${iCount}) {
                    /echo khiTs cleanPack Error: Unable to empty pack
                    /varset cleanUpAndExit 1
                    /return
                }
            }
        /next iSlot
    }

    /if (!${silentMode})   /echo khiTs: Done Cleaning pack
/return TRUE



Sub addComponents
    /declare newLen      int      local
    /declare compNum    int      local
    /declare componentId      int      local 0
    /declare combineSlot   int      local   1

    /for compNum 1 to ${iCompCount}
        /if (!${silentMode})   /echo -- components[${compNum}] = ${components[${compNum}]} : Length = ${components[${compNum}].Length}
        /if (!${components[${compNum}].Length})   /return

        /varset componentId ${FindItem[=${components[${compNum}]}].InvSlot.ID}
       
        /if (${String[${componentId}].NotEqual[NULL]} && ${componentId} > 0) {
           /call addComponent ${combineSlot} ${componentId}
        } else {
           /echo khiTS addComponents Error: You are out of ${components[${compNum}]}
           /varset cleanUpAndExit 1
           /return
        }
    /next compNum
/return


Sub addComponent(int combineSlot, int packSlot)
   /declare failCount   int      local   0
   
   | Check container to see if it is full
   /if (${containerNum.Equal[e]}) {
      | No way I know of to check enviro containers for space - but I'm ignorant so...
   } else {
      /if (!${Me.Inventory[pack${containerNum}].Container} - ${Me.Inventory[pack${containerNum}].Items}) {
         /echo khiTS AddComp Error: Unable to add this item to the container, it is full
         /varset cleanUpAndExit 1
         /return
      }
   }

   :FindEmptySlot
   /if (${containerNum.Equal[e]}) {
      /if (${combineSlot} > 10) {
         /echo khiTS AddComp Error: No such slot ${combineSlot} in container
         /varset cleanUpAndExit 1
         /return
      }
   } else {
      /if (${combineSlot} > ${Me.Inventory[pack${combineSlot}].Container}) {
         /echo khiTS AddComp Error: No such slot ${combineSlot} in container
         /varset cleanUpAndExit 1
         /return
      }
   }

   | See if there's anything in the slot in which we are trying to put the combine component
   /if (${containerNum.Equal[e]}) {
      /itemnotify in enviro ${combineSlot} leftmouseup
   
      | Make sure the cursor is clear, otherwise something was in that slot
      /if (${Cursor.ID}) {
         /itemnotify in enviro ${combineSlot} leftmouseup
         /varcalc combineSlot ${combineSlot}+1
         /goto :FindEmptySlot
      }
   } else {
      /if (${Me.Inventory[pack${containerNum}].Item[${combineSlot}].ID}) {
         /varcalc combineSlot ${combineSlot}+1
         /varset combineSlot ${String[${combineSlot}].Arg[0,.]}
         /goto :FindEmptySlot
      }
   }

   :PickUpItem
   | Slot is empty, so go ahead and put item into it
   /ctrlkey /itemnotify ${packSlot} leftmouseup

   |Check to see if cursor has multiple a stack.
   /if (${Cursor.Stack} > 1 && ${failCount} < 3) {
      /autoinv
      /varcalc failCount ${failCount}+1
      /goto :PickUpItem
   }

   /if (${containerNum.Equal[e]}) {
      /itemnotify in enviro ${combineSlot} leftmouseup
   } else {
      /itemnotify in pack${containerNum} ${combineSlot} leftmouseup
   }
/return


sub displayHelp
    /echo Syntax:   /macro khiTS "<recipe name>" "<options>"
    /echo Example:  /macro khiTS "bits" "show-stats=0 destroy=0 abort-on-tell=0 end-on-trivial=0"
    /echo -
    /echo MAKE SURE THAT
    /echo * Recipe.ini is in your macro folder, or INIPATH points to your recipe.ini file
    /echo * Inventory is open.
    /echo * All your containers are open.
    /echo * Nothing crosses over each other, all windows (bags, inventory, buttons) must be free.
    /echo * Your windos positions are saved (by closing them and opening them again after they have been moved).
    /echo -
    /echo Options:
    /echo --------
    /echo * show-stats
    /echo -- Syntax: show-stats=1|0
    /echo -- Example: show-stats=0
    /echo -- Shows combine statistics.
    /echo -- Set to 1 for show showing stats, 0 to leave out the stats.
    /echo -- Default set to 1 (show stats).
    /echo -
    /echo * destroy-results
    /echo -- Syntax: destroy-results=1|0
    /echo -- Example: destroy-results=1
    /echo -- Tells the macro wether end-result is destroyed or kept.
    /echo -- Set to 1 for destroying end-result, 1 to keep end-result.
    /echo -- Default set to 0 (keep end-result).
    /echo -
    /echo * abort-on-tell
    /echo -- Syntax: abort-on-tell=1|0
    /echo -- Example: abort-on-tell=1
    /echo -- Tell the macro wether it should /endmacro when recieving a tell.
    /echo -- Set to 1 for ending macro on tells, 0 to ignore tells.
    /echo -- Default set to 0 (ignore tells).
    /echo -
    /echo * end-on-trivial
    /echo -- Syntax: end-on-trivial=1|0
    /echo -- Example: end-on-trivial=1
    /echo -- Tell the macro wether it should stop when recieving a trivial message.
    /echo -- Set to 1 for ending macro on trivial, 0 to ignore trivial.
    /echo -- Default set to 0 (ignore trivial).
    /echo -
    /echo * make-this-many
    /echo -- Syntax: make-this-many=#
    /echo -- Example: make-this-many=100
    /echo -- The number of successfull combines you want made (or till no more components are available).
    /echo -- Set to 0 for unlimited combines (or till no more components are available), or to the wanted amount.
    /echo -- Default set to 0 (unlimited).
    /echo -
    /echo * stop-at-skill-level
    /echo -- Syntax: stop-at-skill-level=###
    /echo -- Example: stop-at-skill-level=123
    /echo -- Tell the macro to stop when a certain skill level is reached.
    /echo -- Default set to 0 (do not stop at any skill level)
    /echo -
    /echo * silent-mode
    /echo -- Syntax: silent-mode=1|0
    /echo -- Example: silent-mode=1
    /echo -- Tell the macro to only output errors
    /echo -- Default set to 0 (output everything)
    /echo -
    /echo * debug
    /echo -- Syntax: debug=1|0
    /echo -- Example: debug=1
    /echo -- Tell the macro to only everything. This also sets silent-mode=0
    /echo -- Default set to 0 (do not output debugging information)
    /echo -
    /echo * close-container
    /echo -- Syntax: close-container=1|0
    /echo -- Example: close-container=1
    /echo -- Tell the macro to close the tradeskill container when finished
    /echo -- Default set to 1
/return 

utils.inc:

Code: Select all

| Generic sub to wait for something
| i.e. Cursor.ID, Merchant.Open, etc
Sub WaitFor
   /declare MaxWaitCount timer local 1
   :WaitForX
   /echo WaitFor ${Param0} (${${Param0}})
   /if (${String[${${Param0}}].Equal[NULL]} && ${MaxWaitCounter} > 0) {
      /delay 1
      /goto :WaitForX
   } else {
      /delay 5
      /if (${${Param0}})   /return 1
   }
/return 0


Sub OpenPacks
   /declare slotNumber int local

    | Open all packs if they aren't already
    /for slotNumber 1 to 8
        /if (!${Window[Pack${slotNumber}].Open}) {
            /itemnotify pack${slotNumber} rightmouseup
        }
    /next slotNumber
/return


Sub OpenBanks
   /declare slotNumber int local

    | Open all bank packs if they aren't already
    /for slotNumber 1 to 18
        /if (!${Window[Bank${slotNumber}].Open}) {
         /if (${slotNumber} < 17) {
            /itemnotify bank${slotNumber} rightmouseup
         } else {
            /itemnotify sharedbank${Int[${Math.Calc[${slotNumber}-16]}]} rightmouseup
         }
        }
    /next slotNumber
/return


Sub ClosePacks
   /declare slotNumber int local

    | Close all packs if they aren't already
    /for slotNumber 1 to 8
        /if (${Window[Pack${slotNumber}].Open}) {
            /itemnotify pack${slotNumber} rightmouseup
        }
    /next slotNumber
/return


Sub CloseBanks
   /declare slotNumber int local

   | Open all bank packs if they aren't already
   /for slotNumber 1 to 18
      /if (${Window[bank${slotNumber}].Open}) {
         /if (${slotNumber} < 17) {
            /itemnotify bank${slotNumber} rightmouseup
         } else {
            /itemnotify sharedbank${Int[${Math.Calc[${slotNumber}-16]}]} rightmouseup
         }
      }
   /next slotNumber
/return


| Finds the value of an argument in a parameter string
| Use __ in place of spaces
sub parseArguments(string sArgument, string sParameters)
    /declare iArgNum    int     local
    /declare sArgValue  string  local
   
    /for iArgNum 1 to ${sParameters.Count[=]}
       /if (${sParameters.Arg[${iArgNum}, ].Left[${sArgument.Length}].Equal[${sArgument}]}) {
          |/declare tmp int local ${sArgument.Length}
          |/varcalc tmp (${tmp}+1)*-1
          |/varset sArgValue ${sParameters.Arg[${iArgNum}, ].Right[${tmp}]}
          
          /varset sArgValue ${sParameters.Arg[${iArgNum}, ].Right[${Math.Calc[(${sArgument.Length}+1)*-1]}]}
          
          /if (${String[${sArgValue.Find[__]}].NotEqual[NULL]}) {
             /declare sepLoop int local
             /declare tmpValue string local ${sArgValue}
             /varset sArgValue

             /for sepLoop 1 to ${Math.Calc[${tmpValue.Count[_]}+1]}
                /if (${Math.Calc[${sepLoop}%2]}) {
                   /varset sArgValue ${sArgValue} ${tmpValue.Token[${sepLoop},_]}
                }
             /next sepLoop
          }

          /return ${sArgValue}
       }
    /next iArgNum
/return __NOT_FOUND__ 

Posted: Mon Jul 12, 2004 10:54 pm
by gumper
After reading through all the posts Im still unsure how to use this macro.. I would like to skill up my warriors fletching skills soon and tried powerarrows but it doesnt seem to work, so how exactly do i use this macro to do this for me. I have all the recipes of arrows to get me to 202, but dont know how to plug that into the macro.

thanks

Posted: Mon Jul 12, 2004 11:25 pm
by aChallenged1
powerarrow would not have worked unless you corrected the errors inserted by a recent change in the BBCode in use here. I left some info there for you, not sure if it will make it work, but it will correct part of the problem.

Posted: Mon Jul 19, 2004 9:38 pm
by masacist
ok everythings setup and when i run the macro it says it cannot find the "recipe.ini" file.

i have placed this file in both the Macro folder and INI folder and still it cannot find it :?

anything i'm missing at all guys?

Code: Select all

|** 
khiTS.mac 

Author: Kaitain Heavy Industries 
Date: 30 Apr 04 
Version: 2.2.2.14 

Description: 
Performs tradeskill combines using recipes supplied in an ini file 

Credits: 
Inspired by Dont_Know_At_All's Trade Skills macro - The status report idea is completely stolen from him (but rewritten by me) 
Ini file uses the format created by Diggler (this will eventually being changed to a new format using item id's) 

Notes: 
* Updated to use MQ2DataVars 
* This is a complete overhaul of the whole macro in addition changing it to work with MQ2Data and MQ2DataVars 
* You should be able to simply rename "sub main" to "sub khiTS" if you want to use this as an included file. 
* No longer destroys tools or components used to do combines when destroy-results is enabled. 
* This is a BIG macro and may be slow as hell on older computers. 

Usage: 
#include khits.inc 
. 
. 
. 
/call Make <recipe_name> <options> 

Example: 
/call Make khits bits "show-stats=0 destroy=0 abort-on-tell=0 end-on-trivial=0 silent-mode=0 stop-at-skill-level=200" 
Ported to Inc by Draco 
**| 

| ***** Tweak this to your computer, if you get a lot of an item in the combine container, increase this number ***** | 
#define COMBINE_DELAY 5 

| ***** CHANGE THIS TO MATCH YOUR INI FILE NAME IF NECESSARY ***** | 
#define INIPATH "recipe.ini"


#event SkillTrivial "You can no longer advance your skill from making this item#*#" 
#event SkillUp "You have become better at #1#! (#2#)" 
#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!" 
#event HandsFull "You cannot combine items when your hands are full#*#" 

#chat tell 

#define COMBINE_SUCCESS 0 
#define COMBINE_FAILED 1 
#define COMBINE_ERROR 2 
#define COMBINE_INVENTORY_FULL 3 
#define COMBINE_TRIVIAL 4 

#include utils.inc 

| Main entry point 
Sub Main 
/echo 
/echo ***************************************** 
/echo khiTs: Tradeskills running : ${Time} 
/echo ***************************************** 
/echo 


| Check for no parameters or help 
/if (!${Defined[Param0]} || ${Param0.Equal[HELP]}) { 
/call displayHelp 
/call clearCursor ${iDestroyResults} 
/endmacro 
} 

| container in which the recipe will be made 
/declare containerName string local NOT_SET 

| The name of the current component we're getting 
/declare currentComp string local NOT_SET 

| Make sure we have that recipe in the ini file 
/declare recipeCheck string local NOT_SET 

| Settings (see end of this file for list of settings) 
| Stops the macro if someone sends you a tell 
/declare abortOnTell int local 0 

| How many itmes the user has requested be made 
/declare makeThisMany int local 0 

| Display when you succed, get skillups, fail, etc. 
/declare showStats int local 0 

| For looping through containers 
/declare slotNumber int local 1 


| Exit and Return Flags added by Draco 
/declare combineResult int outer 0 
/declare cleanUpAndExit int outer 0 
/declare combineErrorCounter int outer 0 

| Only declare outer variables once, this is in case you use this as an include 
/if (!${Defined[components]}) { 
| Array of components used to make the recipe 
/declare components[10] string outer 

| The name of the combination being done, this is used to look up the recipe in the recipe.ini file 
/declare recipeName string outer 

| Container in which the recipe will be made 
/declare containerNum string outer NOT_SET 

| The number of components in the recipe 
/declare iCompCount int outer 0 

| Flags 
/declare bCombineDone bool outer FALSE 
/declare bSkillTrivial bool outer FALSE 

| Destroys the results of a combine (but not any items used in the combine) 
/declare iDestroyResults int outer 0 

| Stops the macro when you can no longer get skillups from doing the combine 
/declare iEndOnTrivial int outer 0 

| How many times you've tried a combination 
/declare iSkillAttempts int outer 0 

| How many times it worked 
/declare iSkillSuccess int outer 0 

| How many times it didn't work 
/declare iSkillFailure int outer 0 

| How many skill points you have received 
/declare iSkillUps int outer 0 

| Skill level to stop at 
/declare iStopAtSkillLevel int outer 0 

| Keeps MQ window spam to a minimum 
/declare silentMode int outer 0 

| Output debugging information 
/declare debug int outer 0 

| Flag to close tradeskill container when finished 
/declare iCloseContainer int outer 1 

| The results of what we are making 
/declare sResults string outer 

| Skill we are using (i.e. Brewing, Smithing, etc) 
/declare sUsing string outer NOT_SET 
} else { 
| Clean out the last components used, this is in case we have not cleared the variables or are using this as an include 
/deletevar components 
/declare components[10] 
} 


|Get requested recipe's name 
/varset recipeName ${Param0} 

| If there is only one parameter, then there are no options 
/if (${Defined[Param1]}) { 
/declare tmp int local 
/declare parms int local ${Macro.Params} 
/declare parmString string local 
/varcalc parms ${parms}-1 

/for tmp 1 to ${parms} 
/varset parmString ${parmString} ${Param${tmp}} 
/next tmp 

/call parseArguments "abort-on-tell" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset abortOnTell ${Macro.Return} 
} 

/call parseArguments "destroy-results" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset iDestroyResults ${Macro.Return} 
} 

/call parseArguments "end-on-trivial" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset iEndOnTrivial ${Macro.Return} 
} 

/call parseArguments "make-this-many" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset makeThisMany ${Macro.Return} 
} 

/call parseArguments "show-stats" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset showStats ${Macro.Return} 
} 

/call parseArguments "stop-at-skill-level" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset iStopAtSkillLevel ${Macro.Return} 
} 

/call parseArguments "close-container" "${parmString}" 

/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset iCloseContainer ${Macro.Return} 
} 

/call parseArguments "debug" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset debug ${Macro.Return} 
} 

/if (!${debug}) { 
/call parseArguments "silent-mode" "${parmString}" 
/if (${Macro.Return.NotEqual[__NOT_FOUND__]}) { 
/varset silentMode ${Macro.Return} 
} 
} else { 
/echo ***** DEBUGGING ON ***** 
} 
} 

| Make sure the recipe file exists (the recipes thing is a fix for a bug in the Ini function) 
/varset recipeCheck ${Ini[INIPATH,recipes]} 
/if (${recipeCheck.Equal[NULL]}) { 
/echo khiTS Error: Recipe file not found 
/echo Path = INIPATH 
/goto :khiTSreset 
} 

| Make sure this recipe exists in the recipe.ini file 
/varset recipeCheck ${Ini[INIPATH,${recipeName}]} 
/if (${recipeCheck.Equal[NULL]}) { 
/echo khiTS Error: Recipe not found 
/echo Recipe name = ${recipeName} 
/goto :khiTSreset 
} 

| Get the container name 
/varset containerName ${Ini[INIPATH,${recipeName},Cont]} 
/if (${containerName.Equal[NULL]}) { 
/echo khiTS Error: Error in ini file for this recipe, no container is specified 
/echo khiTS : Recipe = ${RecipeName} 
/goto :khiTSreset 
} 

| Get the skill we are using 
/varset sUsing ${Ini[INIPATH,${recipeName},Skill]} 
/if (${sUsing.Equal[NULL]}) /varset sUsing NOT_SET 

| Get the item we are making 
/varset sResults ${Ini[INIPATH,${recipeName},LongName]} 
/if (${sResults.Equal[NULL]}) /varset sResults ${recipeName} 

| Find the combine container number 
/if (${containerName.Equal[Enviro]}) { 
/if (!${Window[Enviro].Open}) { 
/echo khiTS Error: You must have the enviromental container open to begin 
/goto :khiTSreset 
} 
/varset containerNum e 
} else { 
| Not an enviromental container so find the container's pack number, this is how we will refer to it from now on 
/varset containerNum ${FindItem[=${containerName}].InvSlot.ID} 
/if (${containerNum}) { 
/varcalc containerNum ${containerNum}-21 
/varset containerNum ${containerNum.Arg[0,.]} 
} else { 
| Didn't find the container 
/echo khiTS Error: Could not find container in your inventory 
/echo khiTS : Contanier name = ${containerName} 
/goto :khiTSreset 
} 
} 

| Read the ingredients for the recipe from the ini file 
:khiTSReadComponentsLoop 
/varset currentComp ${Ini[INIPATH,${recipeName},Comp${iCompCount}]} 
/if (${currentComp.NotEqual[NULL]}) { 
/varcalc iCompCount ${iCompCount}+1 
/varset components[${iCompCount}] ${currentComp} 
/goto :khiTSReadComponentsLoop 
} 

/call OpenPacks 

| Remove anything from the cursor if needed 
/call clearCursor ${iDestroyResults} 

| Clear the combine pack 
/call cleanPack ${containerNum} 
/if (${cleanUpAndExit}) /goto :khiTSreset 

| Let's just do this here rather than through every iteration of combines 
/declare MAIN_CONTAINER string local 
/if (${containerNum.Equal[e]}) { 
/varset MAIN_CONTAINER enviro 
} else { 
/varset MAIN_CONTAINER pack${containerNum} 
} 


:khiTSCombineLoop 
| Delete or Save items depending on settings 
/call clearCursor ${iDestroyResults} 

/if (!${silentMode}) /echo khiTS: Making ${sResults} - Count = ${iSkillSuccess} 

| Move ingredients to container 
/call addComponents 
/if (${cleanUpAndExit}) /goto :khiTSCleanUpMacro 

| Combine 
/varset bCombineDone FALSE 
/varcalc iSkillAttempts ${iSkillAttempts}+1 

:DoCombineLoop 
/combine ${MAIN_CONTAINER} 

| Need this delay here to make sure the combine is finished 
/delay COMBINE_DELAY 

| Call these events individually so they do not conflict with a parent macro if this macro is used as an included file 
/doevents SkillTrivial 
/doevents SkillUp 
/doevents SkillFailure 
/doevents SkillSuccess 
/doevents CombineError 
/doevents FullInventory 
/doevents tell 
/doevents HandsFull 

/if (${cleanUpAndExit}) /goto :khiTSCleanUpMacro 
/if (!${bCombineDone}) /goto :DoCombineLoop 

/varset combineErrorCounter 0 

| See if we have made enough 
/if (${makeThisMany} && ${makeThisMany} == ${iSkillSuccess}) /goto :khiTSCleanUpMacro 

/goto :khiTSCombineLoop 

| The macro is ending, clean up 
:khiTSCleanUpMacro 
| Delete or Save items depending on settings - Just in case 
/call clearCursor ${iDestroyResults} 
/call cleanPack ${containerNum} 
/call DisplayStats 

:khiTSreset 
/if (${iCloseContainer}) /notify ContainerWindow DoneButton leftmouseup 
/call resetKhits 

/return ${combineResult} 


Sub resetKhits 
/deletevar combineResult 
/deletevar cleanUpAndExit 
/deletevar combineErrorCounter 
/deletevar containerNum 
/deletevar iCompCount 
/deletevar bCombineDone 
/deletevar bSkillTrivial 
/deletevar iDestroyResults 
/deletevar iEndOnTrivial 
/deletevar iSkillAttempts 
/deletevar iSkillSuccess 
/deletevar iSkillFailure 
/deletevar iSkillUps 
/deletevar sResults 
/deletevar components 
/deletevar iStopAtSkillLevel 
/deletevar recipeName 
/deletevar iCloseContainer 
/return 



sub clearCursor(int DestroyResults) 
/declare saveCount int local 

:khiTSClearCursorLoop 
/delay 2 ${Cursor.ID} 

| Is there anything on the cursor? 
/if (${Cursor.ID}) { 
/if (${DestroyResults}) { 
| Make sure the item on the cursor is not something we want to save 
/for saveCount 1 to 10 
/if (${components[${saveCount}].Equal[${Cursor.Name}]}) { 
/if (!${silentMode}) /echo -- Saving ${components[${saveCount}]} to inventory 
/autoinv 
/goto :khiTSClearCursorLoop 
} 
/next saveCount 

| Whatever is on the cursor wasn't in the save list 
/if (!${silentMode}) /echo -- Destroying ${Cursor.Name} 
/destroy 
} else { 
/autoinv 
} 

/goto :khiTSClearCursorLoop 
} 
/return 



Sub DisplayStats 
/echo 
/echo khiTS: Stat display 
/echo ================================ 
/echo Attempts: ${iSkillAttempts} 
/echo Successes: ${iSkillSuccess} 
/echo Faliures: ${iSkillFailure} 
/echo Skill Ups: ${iSkillUps} 

/if (${Me.Skill[${sUsing}]}) { 
/echo Skill Level: ${Me.Skill[${sUsing}]} 
} else { 
/echo Skill Level: Unknown 
} 
/return 



Sub Event_Chat(string type, string sender, string text) 
/if (${String[${abt}].Equal[TRUE]} && ${type.Equal[tell]} ) { 
/echo khiTS Event_Chat: Got a tell, pausing. 
/if (!${Defined[pauseTimer]}) /declare pauseTimer timer outer 
/varset pauseTimer 600 
:TellPause 
/if (${Spawn[gm]}) { 
/if (!${Me.Sitting}) /docommand /sit 
/docommand /camp desktop 
/call mqout "GM in Zone! Logging out" 
/endmacro 
} 

/if (${pauseTimer<1}) /return 
/goto :TellPause 
/mqpause 
} 
/return 



Sub Event_HandsFull 
/echo khiTS Event_HandsFull Error: Unrecoverable error, ending macro 
/endmacro 
/return 



Sub Event_CombineError 
/varcalc combineErrorCounter ${combineErrorCounter}+1 
/if (!${silentMode}) /echo khiTS Event_CombineError: ${combineErrorCounter} 

/endmacro 

| *** FIXME *** | 
/if (${combineErrorCounter} < 3) { 
/call cleanPack ${containerNum} 
/call clearCursor ${iDestroyResults} 
/varset bCombineDone TRUE 
} else { 
/varset combineResult COMBINE_ERROR 
/varset cleanUpAndExit 1 
} 
/return 



Sub Event_FullInventory 
/echo khiTS Event_FullInventory Error: Your inventory is full, ending macro. 
/call DisplayStats 
/varset combineResult COMBINE_INVENTORY_FULL 
/varset cleanUpAndExit 1 
/return 



Sub Event_SkillFailure 
/varcalc iSkillFailure ${iSkillFailure}+1 
/varset bCombineDone TRUE 
/varset combineResult COMBINE_FAILED 
/return 



Sub Event_SkillSuccess 
/if (${sResults.Equal[${recipeName}]}) { 
/declare MaxWaitCount timer local 100 
:WaitForIt 
/delay 2 ${Cursor.ID} 
/if (!${Cursor.ID} && !${MaxWaitCount} == 0) /goto :WaitForIt 
/varset sResults ${Cursor.Name} 
} 

/varcalc iSkillSuccess ${iSkillSuccess}+1 
/varset bCombineDone TRUE 
/varset combineResult COMBINE_SUCCESS 
/return 



Sub Event_SkillUp 
/varset sUsing ${Param1} 
/varcalc iSkillUps ${iSkillUps}+1 

/if (${iStopAtSkillLevel} && ${iStopAtSkillLevel} == ${Param2}) { 
/call DisplayStats 
/call cleanPack ${containerNum} 
/call clearCursor ${iDestroyResults} 
/varset cleanUpAndExit 1 
} 
/return 



Sub Event_SkillTrivial 
/if (!${bSkillTrivial}) { 
/echo khiTS Event_SkillTrivial: Skill is trivial 
/varset bSkillTrivial TRUE 
} 

/if (${iEndOnTrivial}) { 
/call DisplayStats 
/call cleanPack ${containerNum} 
/call clearCursor ${iDestroyResults} 
/varset cleanUpAndExit 1 
} 

/varset combineResult COMBINE_TRIVIAL 
/return 



sub cleanPack(string PackNumber) 
/if (!${silentMode}) /echo khiTS cleanPack: Cleaning out pack: ${PackNumber} 

| Used for looping through pack slots 
/declare iSlot int local 

| How many freeslots are in the bag 
/declare iCount int local 

/if (${PackNumber.Equal[e]}) { 
/if (!${silentMode}) /echo khiTs cleanPack: Clearing enviro 

/for iSlot 1 to 10 
/if (${InvSlot[enviro${iSlot}].Item.ID}) { 
/shiftkey /itemnotify enviro${iSlot} leftmouseup 
/call clearCursor ${iDestroyResults} 
} 
/next iSlot 
} else { 
/if (!${silentMode}) /echo khiTs cleanPack: Cleaning out ${PackNumber} 
| Can't empty a non-pack duh! 
/if (!${Me.Inventory[Pack${PackNumber}].Container}) { 
/echo khiTs cleanPack Error: No pack in slot 
/varset cleanUpAndExit 1 
/return 
} 

/for iSlot 1 to ${Me.Inventory[Pack${PackNumber}].Container} 
| Quit if the pack is empty 
/if (!${Me.Inventory[Pack${PackNumber}].Container}) /return 

/if (${debug}) /echo khiTs cleanPack: Clearing Pack: Pack${PackNumber}, Slot:${iSlot}, Item: ${Me.Inventory[Pack${PackNumber}].Item[${iSlot}]} 

/if (${Me.Inventory[Pack${PackNumber}].Item[${iSlot}].ID}) { 
/varset iCount ${Me.Inventory[Pack${PackNumber}].Items} 

/shiftkey /itemnotify in pack${PackNumber} ${iSlot} leftmouseup 
/call clearCursor ${iDestroyResults} 

| Make sure we aren't just putting it back in the same bag 
/if (${Me.Inventory[Pack${PackNumber}].Items} == ${iCount}) { 
/echo khiTs cleanPack Error: Unable to empty pack 
/varset cleanUpAndExit 1 
/return 
} 
} 
/next iSlot 
} 

/if (!${silentMode}) /echo khiTs: Done Cleaning pack 
/return TRUE 



Sub addComponents 
/declare newLen int local 
/declare compNum int local 
/declare componentId int local 0 
/declare combineSlot int local 1 

/for compNum 1 to ${iCompCount} 
/if (!${silentMode}) /echo -- components[${compNum}] = ${components[${compNum}]} : Length = ${components[${compNum}].Length} 
/if (!${components[${compNum}].Length}) /return 

/varset componentId ${FindItem[=${components[${compNum}]}].InvSlot.ID} 

/if (${String[${componentId}].NotEqual[NULL]} && ${componentId} > 0) { 
/call addComponent ${combineSlot} ${componentId} 
} else { 
/echo khiTS addComponents Error: You are out of ${components[${compNum}]} 
/varset cleanUpAndExit 1 
/return 
} 
/next compNum 
/return 


Sub addComponent(int combineSlot, int packSlot) 
/declare failCount int local 0 

| Check container to see if it is full 
/if (${containerNum.Equal[e]}) { 
| No way I know of to check enviro containers for space - but I'm ignorant so... 
} else { 
/if (!${Me.Inventory[pack${containerNum}].Container} - ${Me.Inventory[pack${containerNum}].Items}) { 
/echo khiTS AddComp Error: Unable to add this item to the container, it is full 
/varset cleanUpAndExit 1 
/return 
} 
} 

:FindEmptySlot 
/if (${containerNum.Equal[e]}) { 
/if (${combineSlot} > 10) { 
/echo khiTS AddComp Error: No such slot ${combineSlot} in container 
/varset cleanUpAndExit 1 
/return 
} 
} else { 
/if (${combineSlot} > ${Me.Inventory[pack${combineSlot}].Container}) { 
/echo khiTS AddComp Error: No such slot ${combineSlot} in container 
/varset cleanUpAndExit 1 
/return 
} 
} 

| See if there's anything in the slot in which we are trying to put the combine component 
/if (${containerNum.Equal[e]}) { 
/itemnotify in enviro ${combineSlot} leftmouseup 

| Make sure the cursor is clear, otherwise something was in that slot 
/if (${Cursor.ID}) { 
/itemnotify in enviro ${combineSlot} leftmouseup 
/varcalc combineSlot ${combineSlot}+1 
/goto :FindEmptySlot 
} 
} else { 
/if (${Me.Inventory[pack${containerNum}].Item[${combineSlot}].ID}) { 
/varcalc combineSlot ${combineSlot}+1 
/varset combineSlot ${String[${combineSlot}].Arg[0,.]} 
/goto :FindEmptySlot 
} 
} 

:PickUpItem 
| Slot is empty, so go ahead and put item into it 
/ctrlkey /itemnotify ${packSlot} leftmouseup 

|Check to see if cursor has multiple a stack. 
/if (${Cursor.Stack} > 1 && ${failCount} < 3) { 
/autoinv 
/varcalc failCount ${failCount}+1 
/goto :PickUpItem 
} 

/if (${containerNum.Equal[e]}) { 
/itemnotify in enviro ${combineSlot} leftmouseup 
} else { 
/itemnotify in pack${containerNum} ${combineSlot} leftmouseup 
} 
/return 


sub displayHelp 
/echo Syntax: /macro khiTS "<recipe name>" "<options>" 
/echo Example: /macro khiTS "bits" "show-stats=0 destroy=0 abort-on-tell=0 end-on-trivial=0" 
/echo - 
/echo MAKE SURE THAT 
/echo * Recipe.ini is in your macro folder, or INIPATH points to your recipe.ini file 
/echo * Inventory is open. 
/echo * All your containers are open. 
/echo * Nothing crosses over each other, all windows (bags, inventory, buttons) must be free. 
/echo * Your windos positions are saved (by closing them and opening them again after they have been moved). 
/echo - 
/echo Options: 
/echo -------- 
/echo * show-stats 
/echo -- Syntax: show-stats=1|0 
/echo -- Example: show-stats=0 
/echo -- Shows combine statistics. 
/echo -- Set to 1 for show showing stats, 0 to leave out the stats. 
/echo -- Default set to 1 (show stats). 
/echo - 
/echo * destroy-results 
/echo -- Syntax: destroy-results=1|0 
/echo -- Example: destroy-results=1 
/echo -- Tells the macro wether end-result is destroyed or kept. 
/echo -- Set to 1 for destroying end-result, 1 to keep end-result. 
/echo -- Default set to 0 (keep end-result). 
/echo - 
/echo * abort-on-tell 
/echo -- Syntax: abort-on-tell=1|0 
/echo -- Example: abort-on-tell=1 
/echo -- Tell the macro wether it should /endmacro when recieving a tell. 
/echo -- Set to 1 for ending macro on tells, 0 to ignore tells. 
/echo -- Default set to 0 (ignore tells). 
/echo - 
/echo * end-on-trivial 
/echo -- Syntax: end-on-trivial=1|0 
/echo -- Example: end-on-trivial=1 
/echo -- Tell the macro wether it should stop when recieving a trivial message. 
/echo -- Set to 1 for ending macro on trivial, 0 to ignore trivial. 
/echo -- Default set to 0 (ignore trivial). 
/echo - 
/echo * make-this-many 
/echo -- Syntax: make-this-many=# 
/echo -- Example: make-this-many=100 
/echo -- The number of successfull combines you want made (or till no more components are available). 
/echo -- Set to 0 for unlimited combines (or till no more components are available), or to the wanted amount. 
/echo -- Default set to 0 (unlimited). 
/echo - 
/echo * stop-at-skill-level 
/echo -- Syntax: stop-at-skill-level=### 
/echo -- Example: stop-at-skill-level=123 
/echo -- Tell the macro to stop when a certain skill level is reached. 
/echo -- Default set to 0 (do not stop at any skill level) 
/echo - 
/echo * silent-mode 
/echo -- Syntax: silent-mode=1|0 
/echo -- Example: silent-mode=1 
/echo -- Tell the macro to only output errors 
/echo -- Default set to 0 (output everything) 
/echo - 
/echo * debug 
/echo -- Syntax: debug=1|0 
/echo -- Example: debug=1 
/echo -- Tell the macro to only everything. This also sets silent-mode=0 
/echo -- Default set to 0 (do not output debugging information) 
/echo - 
/echo * close-container 
/echo -- Syntax: close-container=1|0 
/echo -- Example: close-container=1 
/echo -- Tell the macro to close the tradeskill container when finished 
/echo -- Default set to 1 
/return 

Posted: Tue Sep 07, 2004 1:27 am
by advolente
omg must you cut/paste 500 lines of code that has nothing to do with your question?

if it can't find your recipes.ini file then it is either

A) Is in the wrong place

OR

B) Is named the wrong name

Try doing a Edit > Find on khits.mac for recipe.ini and INIPATH

adv

Posted: Wed Oct 20, 2004 6:29 pm
by Phony
1. Is the macro in the first post the newest and the best version?

2. I cant find Humming orb recepie in there.. wasnt that something combinging shrieking and veiling essence with metal rings or so?? can someone add this? or am I just blind and someone point out the name of recepie?

thanx alot in advance
Phony

containers in inventory

Posted: Thu Feb 24, 2005 12:15 pm
by Katzmeow
I've got this up and running fine with one exception. When using a tradeskill container that is in inventory (ie Medicine Bag) it cleans out whatever pack # the tradeskill container is in, places one of the components into it and then I get this error message:
kHIts AddComp Error: Unable to add this item to the container, it is full
and then it cleans out the pack again and ends the macro.
It is this way for ALL tradeskill containers in inventory.
Yes, the container was empty and open when I started the macro.
Yes, I have tried having the container open with both the old (just looks like the container) and the new tradeskill interface.
I am using the .mac version rather than the .inc version with sub Make renamed to sub Main and have tried tradeskills using Medicine Bag, Foldable Bearskin Potion Bag, and Planar Sewing Kit.
It runs as it should when using Enviro containers such as Kiln.
I'm stumped... any ideas to make inventory tradeskill containers work with this macro?

Also, to the person that was having trouble with it not finding recipes.ini...
there is a discrepancy between some of the versions as to whether it looks for recipe.ini without the 's' or recipes.ini Try renaming your ini file with and without the 's' and that should work for you.

you have to add recipes to your ini file

Posted: Thu Feb 24, 2005 12:27 pm
by Katzmeow
if you look in your recipe.ini (or recipes.ini depending on what it calls in your script) and the recipe is not in there you need to add it to the ini file yourself.

Humming Orb recipe would look like the following:
[HummingOrb]
Cont=Enviro
Comp0=Metal Rings
Comp1=Vah Shir Anvil
Comp2=Wailing Substance
Comp3=Shrieking Substance
Comp4=Luclinite Mallet
Note that Comp4 could also be Humming Luclinite Mallet so adjust your recipe to reflect what you have. Do this for ANY recipes you want to make that are not in your .ini file.

to begin making this item (assuming you are using this as a .mac file rather than .inc) you would open your forge or taanan forge to the old tradeskill container then type in
/macro KhiTS.mac "HummingOrb" "show-stats=1 destroy=0 abort-on-tell=0 end-on-trivial=0 silent-mode=0"

be sure to iinclude the " marks where indicated.

Re: containers in inventory

Posted: Fri Mar 25, 2005 4:02 pm
by ToonsRus
Katzmeow wrote:I've got this up and running fine with one exception. When using a tradeskill container that is in inventory (ie Medicine Bag) it cleans out whatever pack # the tradeskill container is in, places one of the components into it and then I get this error message:
kHIts AddComp Error: Unable to add this item to the container, it is full
and then it cleans out the pack again and ends the macro.
It is this way for ALL tradeskill containers in inventory.
Yes, the container was empty and open when I started the macro.
Yes, I have tried having the container open with both the old (just looks like the container) and the new tradeskill interface.
I am using the .mac version rather than the .inc version with sub Make renamed to sub Main and have tried tradeskills using Medicine Bag, Foldable Bearskin Potion Bag, and Planar Sewing Kit.
It runs as it should when using Enviro containers such as Kiln.
I'm stumped... any ideas to make inventory tradeskill containers work with this macro?
Having exact same issue with the inc version.

Posted: Fri Apr 01, 2005 11:56 pm
by Thugsytie2
i am getting the same error with trying to combine something that is in my inventory it wont allow me with a collapsable mixing bowl

Posted: Fri Apr 08, 2005 5:51 am
by Finch
same here :/

Posted: Fri Apr 08, 2005 4:01 pm
by ToonsRus
It's dead Jim.