All around tradeskill macro

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

All around tradeskill macro

Post by Zeus » Sat Jun 21, 2003 12:26 pm

Any suggestions?

Code: Select all

|Tradeskill.mac
| by Zeus
|
| *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 Minotaur Hero Brew** 


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


|Statistics variables
#define StartValue v21
#define EndValue v22
#define AttemptsCount v23
#define SuccessCount v24
#define FailureCount v25
#define SuccessRate v26
#define SkillUps v27
#define CombinesPerSkill v28

|Program Variables  
#define DelayValue v30
#define Components v40
#define DestroyedItemsCount v41
#define SkillCap v70
#define SkillName v71
#define ContainerSlot v80
#define CombineBag v91

Sub Main

   |Initialize Program variables
   /varset Components 5
   /varset DelayValue 1
   /varset SkillName "Brewing"
   /varset SkillCap 248
   /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) "Water Flask"
   /varset a(1,2) "Short Beer"
   /varset a(1,3) "Malt"
   /varset a(1,4) "Yeast"
   /varset a(1,5) "Cask"
   /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) 2
   /varset a(2,2) 2
   /varset a(2,3) 3
   /varset a(2,4) 1
   /varset a(2,5) 1
   /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) "Bottle"
   /varset DestroyedItemsCount 1
   

   /sendkey down ctrl
   |Turn fast item destroy on

   |Clean container before starting
   /call CleanContainer
   
   :CombineLoop   
   
   |check if at skill cap
   /if n $char(skill,$Skill)==$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
   /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 
   /for v1 1 to $p1
   	/finditem "$p0"
   	/delay $DelayValue
   	/if $cursor()!=True {
   		/echo Out of $p0
   		/return 0
   	 }
   	:ReClick
   	/click left $p2 $ContainerSlot
   	/delay $DelayValue
   	/if "$cursor(name)"=="p0" /goto :ReClick
   	/varadd ContainerSlot 1
   /next v1
/return 10

Sub ClearCursor
|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 Sucess 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

Ps: Anyone know how to turn fast item destroy on/off by text?
EDIT: Smileys fixed :P
Last edited by Zeus on Sun Jun 22, 2003 12:04 pm, edited 2 times in total.

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sat Jun 21, 2003 9:29 pm

hrm... just a note, when submitting code of any kind, remember to disable smilies. heh

kagonis
a hill giant
a hill giant
Posts: 228
Joined: Sat May 24, 2003 8:48 pm

Post by kagonis » Sat Jun 21, 2003 10:33 pm

Perhaps I should post the tradeskill macro I put together. Ideas from various other macros, tidbits from other macros.

Optimized macro and new ideas by myself ;)

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

Post by Zeus » Sat Jun 21, 2003 11:44 pm

Oops this is what happens when you post with little to no sleep hehe can someone move this to the Depot?

xzjn9p
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Jul 14, 2003 4:06 pm

success counter

Post by xzjn9p » Mon Jul 14, 2003 4:17 pm

First of all, nice job Zeus. This script looks great. I was wondering if there was a way to make the script kickout to the end subroutine when a user defined max number of successes is reached. For example if I wanted to combine heady kiolas until I reached 10 stacks (200) and then it would quit.

something like define a success event and have that count the success variable like the failures are counted and then put a if statement in the combine loop. That would check if the counted successes is = to the desired quantity.

Though I've never worked in this language I think I could figure it out myself given a few iterations but my EQ box is down and I'd like to get some suggestions on the syntax.

cheers

Zeus
a hill giant
a hill giant
Posts: 180
Joined: Wed Feb 19, 2003 10:03 am
Contact:

Post by Zeus » Wed Jul 16, 2003 7:36 am

Hmm something like this

Code: Select all

#define MaxSuccess

then at the end of the loop

Code: Select all

/if n $SuccessCount>=$MaxSuccess /call End

Rember to add a /varset for the max var to set your max

Ps: Got a "better" version of the script but waiting for the Plaz fixes to add some things :)

xzjn9p
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Jul 14, 2003 4:06 pm

Post by xzjn9p » Thu Jul 17, 2003 12:18 pm

Looking forward to it zeus. I've been using this script a lot lately. :D

nico
decaying skeleton
decaying skeleton
Posts: 3
Joined: Wed Jul 23, 2003 3:48 pm

Post by nico » Wed Jul 23, 2003 6:58 pm

hi =) i have testing this macro but i have i litlle probleme , after having to place item in the contenaire, it click not on combines , why?

thx for help

noob01
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon Jun 16, 2003 4:29 pm

Little question

Post by noob01 » Sun Aug 10, 2003 3:43 pm

What should I change if I am not using a 10 slots container plz? Like Jewellry kit or spit etc.

This macro is great btw. It helped me a lot :)

Consilium
Contributing Member
Contributing Member
Posts: 100
Joined: Wed Oct 02, 2002 10:42 pm

Post by Consilium » Wed Aug 20, 2003 6:09 am

nico wrote:hi =) i have testing this macro but i have i litlle probleme , after having to place item in the contenaire, it click not on combines , why?

thx for help
Nico.. you might want to check your resolutions... make sure none of your bags are overlapping and last but not least make sure you have the latest version of MQ as I am newly back but someone was telling me that click was recently disabled and is now back.
-SH
+Student
digitalsavior.com