New generic tradeskill combiner -- uses new TS interface

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

Moderator: MacroQuest Developers

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

New generic tradeskill combiner -- uses new TS interface

Post by Glasscoin » Wed Mar 10, 2004 8:23 pm

Ah, here's a lil' macro I've been using to take advantage of the new tradeskill interface in my macros. It really is a very basic script, but if someone out there finds it useful, then karma++ for the ol' Glass Man.

Code: Select all

| GPurp.mac

| General purpose macro for automating tradeskills with the new TS interface.
| Usage:  /macro gpurp [action on success] [action on failure] [end on trivial]
| Specified actions can be 0 (to destroy) and 1 {to keep) created items.
| If end on trivial is 1, the macro will end when the items trivial.  (Defaults to 0)
| This macro will /autoinventory by default, if no switches are provided.

| Example usage:
| /macro gpurp 1 0 0
| This would keep successful combines, destroy unsuccessful combines, and continue
| running when the items trivial.

| Be sure to have selected your recipe and put the mouse over the combine button
| before running the macro!

#event NOITEM  "Sorry, but you don't have everything you need for this recipe in your general inventory."
#event SUCC    "You have fashioned the items together to create something new!"
#event FAIL    "You lacked the skills to fashion the items together."
#event TRIV    "You can no longer advance your skill from making this item."
#event SKILLUP "You have become better at"

Sub Main
        
   /declare SKILLUP      global
   /declare COMBINEATTM  global
   /declare COMBINESUCC  global
   /declare COMBINETRIV  global
   /declare COMBINESKIL  global
    
   /declare SUCCACTION   global
   /declare FAILACTION   global
   /declare ENDONTRIV    global
   /declare MOUSECOORD   array
   
   /varset MOUSECOORD(0) $mouse(x)
   /varset MOUSECOORD(1) $mouse(y)
   
   /if @Param0=="" {
      /varset SUCCACTION 1
      /varset FAILACTION 1
      /varset ENDONTRIV 0
   } else {
      /varset SUCCACTION @Param0
      /varset FAILACTION @Param1
      /varset ENDONTRIV @Param2
   }
   
   :doloop
      /click left @MOUSECOORD(0) @MOUSECOORD(1)
      /delay 5
      /doevents   
   /goto :doloop
/return

Sub Event_NOITEM
   /echo Missing one of the required items for this recipe; aborting.
   /call EndMacro
/return

Sub Event_FAIL
   /varadd COMBINEATTM 1
   /call SortItems @FAILACTION
/return

Sub Event_SUCC
   /varadd COMBINEATTM 1
   /call SortItems @SUCCACTION
/return

Sub Event_SKILLUP
   /varadd COMBINESKIL 1
/return

Sub Event_TRIV
   /if @ENDONTRIV==1 {
      /echo Item is now trivial; aborting.
      /call EndMacro
   }
/return

Sub SortItems
   :itemloop
   /if $cursor()!="NULL" {
      /if @Param0==1 {
         /autoinventory
      } else {
         /click left destroy
      }
      /delay 5
      /goto :itemloop
   }
/return

Sub EndMacro
   /echo Total time running:     $running
   /echo Number of combines:     @COMBINEATTM
   /echo Success rate (%):       $int($calc(@COMBINESUCC/@COMBINEATTM))
   /echo Combines per skillup:   $int($calc(@COMBINEATTM/@COMBINESKIL))
   /cleanup
   /endmacro
/return

User avatar
N0ne
decaying skeleton
decaying skeleton
Posts: 4
Joined: Tue Nov 04, 2003 6:36 pm

Post by N0ne » Sun Mar 14, 2004 8:05 pm

Nice and simple.
Maybe a few more verbose in code should be nice.
When you start the macro default setting can be listing.

Code: Select all

   /if @Param0=="" { 
      /varset SUCCACTION 1 
      /varset FAILACTION 1 
      /varset ENDONTRIV 0 
   } else { 
      /varset SUCCACTION @Param0 
      /varset FAILACTION @Param1 
      /varset ENDONTRIV @Param2 
      [color=red]/echo Default setting : Success SAVE, Failure SAVE, Trivial CONTINUE.[/color]
   }
and add someting like that just after.
Any case statement in mq2 ?

Code: Select all

|-- Verbose Setting
   /if @Param0=="1" {
   	  /echo Success SAVE
   } else {
	  /echo Success DESTROY
   }

   /if @Param1=="1" {
   	  /echo Failure SAVE
   } else {
	  /echo Failure DESTROY
   }

   /if @Param2=="1" {
      /echo Trivial CONTINUE
   } else {
   	  /echo Trivial END
   }
|-- Verbose Setting
As a add-in, a advance controle on the item to save and destroy.
When you combine the "Minotaur Hero's Brew" on Failure you got bottle(2) and a cask. I want to destroy the first but keep the second. it's possible ?
N0ne

inthrall
orc pawn
orc pawn
Posts: 13
Joined: Sun Mar 14, 2004 3:57 pm

Post by inthrall » Sun Mar 21, 2004 6:14 pm

I expaned on this code to fit my needs and fix a few problems, sharing changes with community.

for example:

Code: Select all

   /if @ENDONTRIV==1 { 
      /echo Item is now trivial; aborting. 
      /call EndMacro 
   } 

Code: Select all

   /if [color=red]n[/color] @ENDONTRIV==1 { 
      /echo Item is now trivial; aborting. 
      /call EndMacro 
   } 
most numerical comparisons were not working, also the % was not actually being calculated

now on to the good part

Code: Select all

| ts.mac 

| General purpose macro for automating tradeskills with the new TS interface. 
| Usage:  /macro ts [action on success] [action on failure] [end on trivial] [combines to attempt]
| Specified actions can be 0 (to destroy) and 1 {to keep) created items. 
| If end on trivial is 1, the macro will end when the items trivial.  (Defaults to 0) 
| This macro will /autoinventory by default, if no switches are provided. 

| Example usage: 
| /macro ts 1 0 1 
| This would keep successful combines, destroy unsuccessful combines, and stop 
| running when the items trivial. 

| Be sure to have selected your recipe and put the mouse over the combine button 
| before running the macro! 

#event NOITEM  "Sorry, but you don't have everything you need for this recipe in your general inventory." 
#event SUCC    "You have fashioned the items together to create something new!" 
#event FAIL    "You lacked the skills to fashion the items together." 
#event TRIV    "You can no longer advance your skill from making this item." 
#event SKILLUP "You have become better at" 

Sub Main 
        
   /declare SKILLUP      global 

   /declare COMBINEATTM  global 
   /declare COMBINESUCC  global 
   /declare COMBINETRIV  global 
   /declare COMBINESKIL  global 
   /declare COMBINETRY   global
    
   /declare SUCCACTION   global 
   /declare FAILACTION   global 
   /declare ENDONTRIV    global 
   /declare MOUSECOORD   array 
    
   /varset MOUSECOORD(0) $mouse(x) 
   /varset MOUSECOORD(1) $mouse(y) 

   /varset COMBINEATTM 0
   /varset COMBINESUCC 0
   /varset COMBINESKIL 0
   /varset COMBINETRY  0
    
   /if n @Param0=="" { 
      /varset SUCCACTION 1 
      /varset FAILACTION 1 
      /varset ENDONTRIV 0
      /varset COMBINETRY -5
	/echo /macro ts [action on success] [action on failure] [end on trivial] [combines to attempt](optional)
        /echo Example usage: 
        /echo /macro ts 1 0 1 
	/echo This would keep successful combines, destroy unsuccessful combines, and stop running when the items trivial. 
	/delay 30
	/echo For skillups: /macro ts 1 0 1 
	/echo For mass production: /macro ts 1 1 0
	/echo For 20 combines: /macro ts 1 1 0 20
	/delay 5
	/echo waiting for 260, stop me now or I mass produce
	/delay 260
   } else { 
      /varset SUCCACTION @Param0 
      /varset FAILACTION @Param1 
      /varset ENDONTRIV @Param2 
      /if n @Param3=="" {
	/varset COMBINETRY -5
      } else {
	/varset COMBINETRY @Param3
      }
   } 

/echo 
/echo --------------------------------------------------------------------------------------
/echo TradeSkill Macro activated 
/if n @Param0=="" /echo I will Keep all and not stop
/if n @Param0==1 /echo I will keep combines
/if n @Param1==1 /echo I will keep failures
/if n @Param2==1 /echo I will stop at trivial
/if n @Param3!="" /echo I will attempt @Param3 combines
/echo --------------------------------------------------------------------------------------
/echo  
/echo WARNING: Containter needs to be open, item 
/echo selected and cursor on the combine button
    
   :doloop 
      /if n @COMBINETRY!=0 {
        /click left @MOUSECOORD(0) @MOUSECOORD(1) 
        /delay 15
        /doevents    
        /varset COMBINETRY $int($calc(@COMBINETRY-1))
        /goto :doloop
      } 
    /call EndMacro
/return 

Sub Event_NOITEM 
   /echo 
   /echo 
   /echo Missing one of the required items for this recipe; aborting. 
   /call EndMacro 
/return 

Sub Event_FAIL 
   /varadd COMBINEATTM 1 
   /call SortItems @FAILACTION 
/return 

Sub Event_SUCC 
   /varadd COMBINEATTM 1 
   /varadd COMBINESUCC 1 
   /call SortItems @SUCCACTION 
/return 

Sub Event_SKILLUP 
   /varadd COMBINESKIL 1 
/return 

Sub Event_TRIV 
   /if @ENDONTRIV==1 { 
      /echo 
      /echo 
      /echo Item is now trivial: Congratulations!
      /call EndMacro 
   } 
/return 

Sub SortItems 
   :itemloop 
   /if $cursor()!="NULL" { 
      /if n @Param0==1 { 
         /autoinventory 
      } else { 
         /destroy 
      } 
      /delay 5 
      /goto :itemloop 
   } 
/return 

Sub EndMacro 
   /echo 
   /echo 
   /echo 
   /echo 
   /echo --------------------------------------------------------------------------------------
   /echo Total time running:     $running
   /echo Combines Attempted:     @COMBINEATTM
   /echo Combines Successfull:   @COMBINESUCC
   /echo Success rate:           $int($calc(@COMBINESUCC/@COMBINEATTM*100))%
   /if n @COMBINESKIL>0 /echo Combines per skillup:   $int($calc(@COMBINEATTM/@COMBINESKIL)) 
   /echo --------------------------------------------------------------------------------------
   /endmacro 
/return 
hope this helps someone else.. enjoy

bheathrow
orc pawn
orc pawn
Posts: 14
Joined: Sun Dec 21, 2003 9:27 am

Post by bheathrow » Sat Apr 03, 2004 10:39 pm

I found this VERY helpful. My friggin hand was breaking off doing combines prior to combines for skillup.

bartab
a grimling bloodguard
a grimling bloodguard
Posts: 715
Joined: Wed Oct 15, 2003 8:12 am

Post by bartab » Tue Apr 06, 2004 9:19 am

I find this macro is great, but it has one major thing I'd like to change in it :

Code: Select all

/click left @MOUSECOORD(0) @MOUSECOORD(1) 
it prevents you from making anything while the macro is running, especially chatting with you friends.
Is there a way to press combine without clicking and moving the mouse ?
Don't know if it is possible...maybe the /notify but I'm not sure, could someone help on that ?

amml
a lesser mummy
a lesser mummy
Posts: 68
Joined: Thu Apr 22, 2004 4:55 pm

Post by amml » Fri Apr 23, 2004 11:26 am

could someone please translate this to the /newif etc?

Married
decaying skeleton
decaying skeleton
Posts: 4
Joined: Sun Dec 21, 2003 12:31 am

Post by Married » Fri Apr 23, 2004 12:20 pm

I really love this macro. It worked wonders for me - until the upgrade was done a couple days ago.
I have tried to go in and fix the para's but I am not having any luck.

If some attention could be done to this, to get it to work (since I am lacking the brain department atm) - I would be most grateful.

User avatar
Fuergrissa
a grimling bloodguard
a grimling bloodguard
Posts: 607
Joined: Mon Dec 08, 2003 3:46 pm
Location: UK

Post by Fuergrissa » Fri Apr 23, 2004 1:34 pm