another generic tradeskill macro updated

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

Moderator: MacroQuest Developers

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

another generic tradeskill macro updated

Post by Spectre » Fri Oct 10, 2003 5:36 pm

Here's a rewrite of another generic, easy to use and modify script. Props to Zeus and Wassup.

Code: Select all

|Tradeskill.mac 
| by Zeus 
| updated for new MQ by Spectre
| 
| *Based on Wassup combine routines 
| 
|  Adjust DelayValue according to the spped of your computer, 
| connection ad screen lag, minimun value is one 
| 
|  Components = Number of components the recipe uses 
|  SkillCap = Where the reciple trivializes or where you want to get 
|  Skill = Skill 
| 
|  Item Names in array 1 and quantity of matching items in array 2 
|   Example: Recipe uses 3 water flasks 
|   /varset a(1,1) "Water Flask" 
|   /varset a(2,1) 3 
| 
|  Byproducs that you want to destroy after the combine go in array 3 
| 
| Remember to have all your bags and the enviroemtnal container if any open 
| 
| Todo: Find text command to turn fast item destroy on 
| 
| **Example for Heady Koila** 

#turbo

#event Fail "You lacked the skills" 
#event Hands "Your hands" 
#event Full "There was no place to put that" 

Sub Main

|Statistics variables 
/declare StartValue global
/declare EndValue global 
/declare AttemptsCount global 
/declare SuccessCount global 
/declare FailureCount global
/declare SuccessRate global
/declare SkillUps global 
/declare CombinesPerSkill global

|Program Variables  
/declare DelayValue global
/declare Components global
/declare DestroyedItemsCount global
/declare SkillCap global
/declare SkillName global
/declare ContainerSlot global
/declare CombineBag global

/declare a array2

/declare v5 local


   |Initialize Program variables 
   /varset Components 3 
   /varset DelayValue 1 
   /varset SkillName "Brewing" 
| if using this macro for skillups, put the trivial for this combine on the next line
   /varset SkillCap 999 
   /varset CombineBag "enviro" 
    
   |Initialize Statistical variables 
   /varset StartValue $char(skill,"@SkillName") 
   /varset AttemptsCount 0 
   /varset SuccessCount 0 
   /varset FailureCount 0 
   /varset SuccessRate 0 
   /varset SkillUps 0 
   /varset CombinesPerSkill 0 

            
   |Set Item Names 
   /varset a(1,1) "Bottle" 
   /varset a(1,2) "Water Flask" 
   /varset a(1,3) "Packet of Kiola Sap" 
   /varset a(1,4) " " 
   /varset a(1,5) " " 
   /varset a(1,6) " " 
   /varset a(1,7) " " 
   /varset a(1,8) " " 
   /varset a(1,9) " " 
   /varset a(1,10)  " " 
    
   |Set Item Quantities 
   /varset a(2,1) 1 
   /varset a(2,2) 1 
   /varset a(2,3) 2 
   /varset a(2,4) 0 
   /varset a(2,5) 0 
   /varset a(2,6) 0 
   /varset a(2,7) 0 
   /varset a(2,8) 0 
   /varset a(2,9) 0 
   /varset a(2,10) 0 
    
   |Set Items to Destroy 
   |/varset a(3,1) "Unfired Opal Encrusted Stein" 
   /varset DestroyedItemsCount 0 
    

   /sendkey down ctrl 
   |Turn fast item destroy on 

   |Clean container before starting 
   /call CleanContainer 
    
   :CombineLoop    
    
   |check if at skill cap 
   /if n $char(skill,"@Skillname")==@SkillCap { 
          /echo "Skill Maxed" 
          /return 
   } 
    
   |Set Slot to first 
   /varset ContainerSlot 0 
    
   |Put Components in container 
   /for v5 1 to @Components-1 
      /call GetItem "@a(1,@v5)" "@a(2,@v5)" "@CombineBag" 
      /doevents Hands 
      /if n $return==0 /call End 
   /next v5 
    
   |Click the Combine button 
   /click left @CombineBag combine 
   /delay 10 
    
   /varadd AttemptsCount 1 
   /doevents Fail    
    
   /call ClearCursor        
   /goto :CombineLoop 

/return 

|Clear enviromental container routine 
Sub CleanContainer 
   /declare v1 local
   /sendkey down shift 
   /for v1 0 to 9 
      /click left @CombineBag @v1 
      /delay @DelayValue 
      /click left auto 
   /next v1 
   /sendkey up shift 
/return 


Sub GetItem(ItemType, ItemCount, ItemContainer)
   /declare v1 local
   /for v1 1 to @ItemCount 
      /finditem "@ItemType" 
      /delay @DelayValue 
      /if $cursor()!=True { 
         /echo Out of @ItemType
         /return 0 
       } 
      :ReClick 
      /click left @ItemContainer @ContainerSlot 
      /delay @DelayValue 
      /if "$cursor(name)"=="@ItemType" /goto :ReClick 
      /varadd ContainerSlot 1 
   /next v1 
/return 10 

Sub ClearCursor 
/declare v3 local
|Drop everything in auto equip 
   :AutoDrop 
   /if $cursor()==True { 
      /for v3 1 to @DestroyedItemsCount 
         /if "@a(3,@v3)"=="@cursor(name)" { 
            /click left destroy 
            /goto :AutoDrop 
         } 
      /next v3 
       
   /click left auto 
   /delay @DelayValue 
      /goto :AutoDrop 
   } 
/return 

Sub End 
   /sendkey up ctrl 
   |Turn fast item destroy off 
   /call CleanContainer 
   /call Stats |Comment this line if you dont want statistics 
   /cleanup 
   /zapvars 
   /endmacro 
/return 

Sub Stats 
   /if n @AttemptsCount>0 { 
      /varset EndValue $char(skill,"@SkillName") 
      /varcalc SuccessCount @AttemptsCount - @FailureCount 
      /varcalc SuccessRate @SuccessCount/@AttemptsCount * 100 
      /varcalc SkillUps @EndValue - @StartValue 
      /if n @SkillUps>0 /varcalc CombinesPerSkill @AttemptsCount/@SkillUps 
    
    
      /echo @SkillName Report 
      /echo Skill Range:  @StartValue - @EndValue, @SkillUps skill increases 
      /echo @AttemptsCount Attempts: @SuccessCount Success, @FailureCount Failures 
      /echo Success Rate of @SuccessRate% 
      /if n @SkillUps>0 /echo Average of @CombinesPerSkill Combines per skill increase 
       
   } /else { 
      /echo No attempts made 
   } 
       
/return 

Sub Event_Fail 
   /varadd FailureCount 1 
   /delay @DelayValue 
   /doevents flush 
/return 

Sub Event_Hands 
   /call ClearCursor 
   /call CleanContainer 
   /doevents flush 
/return 

Sub Event_Full 
   /call End    
/return 
Edited by DKAA: turned off smilies.
Last edited by Spectre on Fri Oct 10, 2003 10:49 pm, edited 1 time in total.

User avatar
psychotik
a ghoul
a ghoul
Posts: 112
Joined: Mon Oct 06, 2003 3:48 am

Post by psychotik » Fri Oct 10, 2003 5:45 pm

Code: Select all

   /varset SkillName "Brewing" 
| if using this macro for skillups, put the trivial for this combine on the next line 
   /varset SkillCap 999 
   /varset CombineBag "enviro" 

what would i change here for a tradeskill that uses a bag

Furiousness
a lesser mummy
a lesser mummy
Posts: 62
Joined: Tue Aug 26, 2003 3:48 pm

Post by Furiousness » Fri Oct 10, 2003 6:29 pm

Depending on what you are doing, for example:

Code: Select all

   /varset SkillName "Tailoring" 
| if using this macro for skillups, put the trivial for this combine on the next line 
   /varset SkillCap 999 
   /varset CombineBag "Large Sewing Kit" 
Good luck.

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

Re: another generic tradeskill macro updated

Post by Spectre » Fri Oct 10, 2003 7:30 pm

Edited by DKAA: turned off smilies.
heh. thanks.

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

Post by Spectre » Fri Oct 10, 2003 7:33 pm

psychotik wrote:

Code: Select all

   /varset SkillName "Brewing" 
| if using this macro for skillups, put the trivial for this combine on the next line 
   /varset SkillCap 999 
   /varset CombineBag "enviro" 

what would i change here for a tradeskill that uses a bag
Just change CombineBag to exactly match what bag you're using.

i.e.

Code: Select all

/varset CombineBag "Deluxe Toolbox"
/varset CombineBag "Coldain Tanners Kit"
/varset CombineBag "Mortar and Pestle"
...and so on.

cerberuss
orc pawn
orc pawn
Posts: 16
Joined: Tue Oct 07, 2003 4:19 pm

Post by cerberuss » Sat Oct 11, 2003 8:26 pm

cant get this macro to work with jc'n i changed the container type and the items to put in and combine all it does is pick up the first item and just stays there. please help.

Code: Select all

|Tradeskill.mac 
| by Zeus 
| updated for new MQ by Spectre 
| 
| *Based on Wassup combine routines 
| 
|  Adjust DelayValue according to the spped of your computer, 
| connection ad screen lag, minimun value is one 
| 
|  Components = Number of components the recipe uses 
|  SkillCap = Where the reciple trivializes or where you want to get 
|  Skill = Skill 
| 
|  Item Names in array 1 and quantity of matching items in array 2 
|   Example: Recipe uses 3 water flasks 
|   /varset a(1,1) "Water Flask" 
|   /varset a(2,1) 3 
| 
|  Byproducs that you want to destroy after the combine go in array 3 
| 
| Remember to have all your bags and the enviroemtnal container if any open 
| 
| Todo: Find text command to turn fast item destroy on 
| 
| **Example for Heady Koila** 
#turbo
#event Fail "You lacked the skills" 
#event Hands "Your hands" 
#event Full "There was no place to put that" 

Sub Main 

|Statistics variables 
/declare StartValue global 
/declare EndValue global 
/declare AttemptsCount global 
/declare SuccessCount global 
/declare FailureCount global 
/declare SuccessRate global 
/declare SkillUps global 
/declare CombinesPerSkill global 

|Program Variables  
/declare DelayValue global 
/declare Components global 
/declare DestroyedItemsCount global 
/declare SkillCap global 
/declare SkillName global 
/declare ContainerSlot global 
/declare CombineBag global 

/declare a array2 

/declare v5 local 


   |Initialize Program variables 
   /varset Components 2 
   /varset DelayValue 1 
   /varset SkillName "Jewel Craft" 
| if using this macro for skillups, put the trivial for this combine on the next line 
   /varset SkillCap 999 
   /varset CombineBag "Planar jewellers kit" 
    
   |Initialize Statistical variables 
   /varset StartValue $char(skill,"@SkillName") 
   /varset AttemptsCount 0 
   /varset SuccessCount 0 
   /varset FailureCount 0 
   /varset SuccessRate 0 
   /varset SkillUps 0 
   /varset CombinesPerSkill 0 

            
   |Set Item Names 
   /varset a(1,1) "Cat's Eye Agate" 
   /varset a(1,2) "Enchanted Silver Bar" 
   /varset a(1,3) " " 
   /varset a(1,4) " " 
   /varset a(1,5) " " 
   /varset a(1,6) " " 
   /varset a(1,7) " " 
   /varset a(1,8) " " 
   /varset a(1,9) " " 
   /varset a(1,10)  " " 
    
   |Set Item Quantities 
   /varset a(2,1) 1 
   /varset a(2,2) 1 
   /varset a(2,3) 0 
   /varset a(2,4) 0 
   /varset a(2,5) 0 
   /varset a(2,6) 0 
   /varset a(2,7) 0 
   /varset a(2,8) 0 
   /varset a(2,9) 0 
   /varset a(2,10) 0 
    
   |Set Items to Destroy 
   |/varset a(3,1) "Unfired Opal Encrusted Stein" 
   /varset DestroyedItemsCount 0 
    

   /sendkey down ctrl 
   |Turn fast item destroy on 

   |Clean container before starting 
   /call CleanContainer 
    
   :CombineLoop    
    
   |check if at skill cap 
   /if n $char(skill,"@Skillname")==@SkillCap { 
          /echo "Skill Maxed" 
          /return 
   } 
    
   |Set Slot to first 
   /varset ContainerSlot 0 
    
   |Put Components in container 
   /for v5 1 to @Components-1 
      /call GetItem "@a(1,@v5)" "@a(2,@v5)" "@CombineBag" 
      /doevents Hands 
      /if n $return==0 /call End 
   /next v5 
    
   |Click the Combine button 
   /click left @CombineBag combine 
   /delay 10 
    
   /varadd AttemptsCount 1 
   /doevents Fail    
    
   /call ClearCursor        
   /goto :CombineLoop 

/return 

|Clear enviromental container routine 
Sub CleanContainer 
   /declare v1 local 
   /for v1 0 to 9 
      /click left @CombineBag @v1 
      /delay @DelayValue 
      /click left auto 
   /next v1  
/return 


Sub GetItem(ItemType, ItemCount, ItemContainer) 
   /declare v1 local 
   /for v1 1 to @ItemCount 
      /finditem "@ItemType" 
      /delay @DelayValue 
      /if $cursor()!=True { 
         /echo Out of @ItemType 
         /return 0 
       } 
      :ReClick 
      /click left @ItemContainer @ContainerSlot 
      /delay @DelayValue 
      /if "$cursor(name)"=="@ItemType" /goto :ReClick 
      /varadd ContainerSlot 1 
   /next v1 
/return 10 

Sub ClearCursor 
/declare v3 local 
|Drop everything in auto equip 
   :AutoDrop 
   /if $cursor()==True { 
      /for v3 1 to @DestroyedItemsCount 
         /if "@a(3,@v3)"=="@cursor(name)" { 
            /click left destroy 
            /goto :AutoDrop 
         } 
      /next v3 
        
   /click left auto 
   /delay @DelayValue 
      /goto :AutoDrop 
   } 
/return 

Sub End 
   /sendkey up ctrl 
   |Turn fast item destroy off 
   /call CleanContainer 
   /call Stats |Comment this line if you dont want statistics 
   /cleanup 
   /zapvars 
   /endmacro 
/return 

Sub Stats 
   /if n @AttemptsCount>0 { 
      /varset EndValue $char(skill,"@SkillName") 
      /varcalc SuccessCount @AttemptsCount - @FailureCount 
      /varcalc SuccessRate @SuccessCount/@AttemptsCount * 100 
      /varcalc SkillUps @EndValue - @StartValue 
      /if n @SkillUps>0 /varcalc CombinesPerSkill @AttemptsCount/@SkillUps 
    
    
      /echo @SkillName Report 
      /echo Skill Range:  @StartValue - @EndValue, @SkillUps skill increases 
      /echo @AttemptsCount Attempts: @SuccessCount Success, @FailureCount Failures 
      /echo Success Rate of @SuccessRate% 
      /if n @SkillUps>0 /echo Average of @CombinesPerSkill Combines per skill increase 
        
   } /else { 
      /echo No attempts made 
   } 
        
/return 

Sub Event_Fail 
   /varadd FailureCount 1 
   /delay @DelayValue 
   /doevents flush 
/return 

Sub Event_Hands 
   /call ClearCursor 
   /call CleanContainer 
   /doevents flush 
/return 

Sub Event_Full 
   /call End    
/return 

desnts
RTFM, then ask again
Posts: 58
Joined: Wed Apr 30, 2003 4:40 pm

Post by desnts » Wed Nov 19, 2003 9:51 am

i have the exact same problem he has, i tried it with brewing and JC.