Page 1 of 2

Combine.mac

Posted: Sun May 23, 2004 10:44 am
by Chill
Assuming you have bought your materials, opened the appropriate container, and highlighted the correct recipie, it will combine that recipie until you run out of materials or reach [combines] if specified. It will then tell you how many combines succeeded and how many failed out of your total attempts, with percentages for both.

I have added a few variables to allow you to:
-stop combining when an item becomes trivial
-specify if you want the success report at the end

Once I figure out how to handle tools differently from the combined items, I also am planning to add support to:
-drop items if you dont wish to keep them (i.e. unfired pottery items)
-sell items to a vendor as you combine them

I will most likely be adding paramater support for these variables in the near future as well so you dont have to edit the variables each time.

Code: Select all

| combine.mac : A Simple Combine macro
| Author      : Chill 
| Version     : v1.2 23-Feb-2007 2:00AM EST 
| Useage      : /macro combine [combines] -- have tradeskill window open with recipie highlighted.
|               /target yourself to pause the macro, target anything else (or nothing) to resume.
| Description : This macro will do the selected recipie until you run out of components or reach
                [combines], pausing whenever you are targeted, and report success/fail rates when done.

#event done "Sorry, but you don't have everything you need for this recipe in your general inventory."
#event success "You have fashioned the items together to create something new:#*#"
#event failure "You lacked the skills to fashion the items together."
#event trivial "You can no longer advance your skill from making this item."
#event skillup "You have become better at#*#"

Sub Main(int max)

/declare triv int outer 0
/declare stats int outer 1
/declare dropit int outer 0
/declare sellit int outer 0
/declare skills int outer 0
/declare wins int outer 0
/declare fails int outer 0
/declare total int outer 0
/declare rate float outer 0

/doevents flush

   :Loop
   /if (${Target.ID}==${Me.ID}) {
     /delay 60m ${Target.ID}!=${Me.ID}
   }
   /if (${Cursor.ID}) {
      /if (${dropit}) /drop
      /autoinventory
      /goto :Loop
   }
   /if (${Defined[max]} && ${total} >= ${max}) /call Event_done
   /nomodkey /notify TradeskillWnd CombineButton leftmouseup 
   /delay 2s ${Cursor.ID}
   /doevents
   /doevents trivial
   /goto :Loop
/return

Sub ShowRate
   /varcalc rate 100*${wins}/${total}
   /echo (${wins}) of (${total}) combines succeeded (${rate}%).
   /if (${fails}) {
      /varcalc rate 100*${fails}/${total}
      /echo (${fails}) of (${total}) combines failed (${rate}%).
   }
/return

Sub Event_trivial
   /if (${triv}) /call Event_done
/return

Sub Event_done
   /if (${stats}) /call ShowRate
   /endmacro
/return

Sub Event_success
   /varcalc wins ${wins}+1
   /varcalc total ${total}+1
/return

Sub Event_failure
   /varcalc fails ${fails}+1
   /varcalc total ${total}+1
   /delay 5s
/return

Sub Event_skillup
   /varcalc skills ${skills}+1
/return

Posted: Mon May 24, 2004 9:38 am
by topgun
Could you add the Target Self Pause thingie ???

That is, when your target is yourself, the maro pauses ?

Else this is also excactly what i need in a TS macro :)

Posted: Mon May 24, 2004 7:55 pm
by eqaussie
Could you add a paramater for attempts?

ie /macro combine 20 just tries combines 20 times.

Would be handy for when combines share components.

Otherwise, its working nicely for me

Posted: Mon May 24, 2004 8:24 pm
by bob_the_builder
Could you add a parameter for attempts?
This should work, add these into the macro. Place the :Loop in the macro between the /for and /if and the /var to the /fo at the top below Sub main

Code: Select all

/varset Attempt  int
/varset NumAttempts ${Param0}

/if (!${Defined[Param0]}) { 
   /varset Attempt 1 
   /echo Useage: /mac combine <# of Attempts> 
   /echo Using default combine attempt of ${NumAttempts} 
} 
.
.
.
/for Attempt 1 to ${NumAttempts}
   :Loop
   .
   .
   .
   /if (${Attempt}==${NumAttempts}) /endmacro
   }
/next
Bob

Posted: Tue May 25, 2004 4:14 pm
by Chill
May 25, 2004
-Added an optional parameter to end the macro after the specified number of [combines] is reached.
-Added the self-target pause feature.
-Added an extra line to the results Sub to failure stats, if any combines failed.

Only other thing I kinda wanted to add was the name of the recipie that I was doing, and echo that in the results (for later cost tracking). If I can figure out how to capture that from the tradeskill window or someplace, then I will change:

Code: Select all

/echo (${wins}) of (${total}) combines succeeded (${rate}%).
to

Code: Select all

/echo (${wins}) of (${total}) ${recipie} attempts succeeded (${rate}%).
Anyone know how to get the name of the Recipie I have highlighted or just clicked?

Posted: Fri Jul 09, 2004 7:12 am
by Chill
9 July 2004
-changed ;&gt crap back to < signs

Closer to finding the recipie name...

Code: Select all

${Window[TradeSkillWnd].Child[RecipeList].List[n]}
Gives strings with recipe names, but I still cant figure out how to get the number of the highlighted recipe to put in there.

Anyone have any suggestions on this? thanks.

Posted: Mon Apr 03, 2006 8:54 pm
by nightvcd
this macro no longer works.. it was great cause it was so simple.

when you run it now it auto ends even though you have all the components and are standing in first person at the tradeskill device with your recipe selected and I didn't have myself on target.

wish I had the time and know how to learn how to make these myself but I don't. so any help would be great.

Posted: Mon Apr 03, 2006 11:20 pm
by newgamez88
Try this: change

Code: Select all

       /notify COMBW_CombineArea CombineButton leftmouseup
to

Code: Select all

      /notify TradeskillWnd CombineButton leftmouseup 

Posted: Tue Apr 04, 2006 7:24 pm
by eqsolro
To stop when Selftarget was

Code: Select all

/if (${Target.ID}) /mqpause
helpfull ... but maybe someone has a better one ...

Posted: Tue Apr 04, 2006 9:09 pm
by Dbick
This one worked for me today 4-4-2006

Code: Select all

#event OutOfStuff "Sorry, but you don't have everything you need for this recipe in your general inventory." 
  
Sub Main 
:Loop 
 
:ClearCursor 
/if (${Cursor.ID}) { 
/autoinventory 
/goto :ClearCursor 
} 
 
/notify TradeskillWnd CombineButton leftmouseup 
/doevents 
/delay 2
/notify TradeskillWnd AutoInvButton leftmouseup
/goto :Loop 
/return 
 
Sub Event_OutOfStuff 
/endmacro 
/return

Posted: Wed Apr 05, 2006 9:28 am
by armysoldier
there is another posted in the NEW TS macro thread also

army

updated

Posted: Fri Feb 23, 2007 1:56 am
by Chill
I updated this a while back, just forgot to post the update.

I've added a few more variables and events. I will be adding some paramaters eventually to make it more flexible for different uses (i.e. skilling up vs making trivial combines.

Posted: Fri Jul 27, 2007 5:41 am
by aamlord
I'd like to add a post. I use this a lot mainly for huge combine run like making 2,000 celestial essence. Without the script, I'd have carpal tunnel syndrome long ago.

However once in a while I get the wrong recipe selected when I run the script and I got tired of divide by zero error so I revised my copy to include an extra if statement:

Code: Select all


Sub Event_done
   /if (${total}) {
      /if (${stats}) /call ShowRate
   } else {
      /echo You had no combines made!  Maybe you have the wrong recipe selected or didn't have everything?
      }
   /endmacro
/return
Now spits out a message if you have the wrong recipe selected or missing something and did zero combine as a result. Less spam this way than divide by zero error message.

EDIT: used quote tag instead of code tag... bleh

Posted: Tue Jun 24, 2008 12:37 am
by vladd
Anyone able to tell me if this macro still works with all the changes to MQ?

Posted: Tue Jun 24, 2008 8:50 am
by MQWatcher
not sure if this one does but I know the one from the VIP trade skill post does.