Help on a simple Tradeskill Macro

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

User avatar
Dentist
*insert drilling noises here*
Posts: 52
Joined: Mon Jan 26, 2004 2:48 pm

Help on a simple Tradeskill Macro

Post by Dentist » Mon Jan 26, 2004 3:02 pm

Hiya guys
I am trying to write myself a simple tradeskill macro. I am using it for Jewelcraft at the moment, and intend to change the macro to change the ingrediants to combine.

My problem is that i seem to have a problem using routines.mac within my macro. Whenever i try to use these bits of code, it comes up objecting to the syntax that i am using in routines.mac. Could someone take a look and see what they think i am doing wrong? Thanks in advance

jc.mac

Code: Select all

#include routines.mac

Sub Main
   /call FindCombiner Jewelry Making
   /cleanup
   /click right inv $return

   /sendkey down ctrl
   :Make
      /click left auto
      /finditem "Platinum Bar"
      /if $find()==FALSE /goto :Done
      /click left pack $return 0
      /finditem "Malachite"
      /if $find()==FALSE /goto :Done
      /click left pack $return 1
      /click left pack $return combine
      :Wait
         /delay 1
      /if $pack($return,empty)==FALSE /goto :Wait
      /delay 1
      /click left auto
   /goto :Make

  :Done
  /sendkey up ctrl
/return
routines.mac

Code: Select all

Sub FindCombiner 
   /for p1 7 downto 0 
      /if "$pack($p1,combine)"=="$p0" /return $p1 
   /next p1 
   /echo You do not appear to have a valid $p0 container. 
/return 99 

smelly wang
a lesser mummy
a lesser mummy
Posts: 54
Joined: Mon Jan 19, 2004 6:04 pm

Post by smelly wang » Mon Jan 26, 2004 5:19 pm

Variables in mq2 were changed, but the routines.mac hasnt been updated since so it doesnt work anymore. you need to change all the things like p1, v12, t3 etc to normal variable names and declare them at the start of macros. this worked for me:

Code: Select all

Sub Main

   /declare loop global
   /call FindCombiner "Jewelry Making" 
   /cleanup 
   /click right inv $return 

   /sendkey down ctrl 
   :Make 
      /click left auto 
      /finditem "Platinum Bar" 
      /if $find()==FALSE /goto :Done 
      /click left pack $return 0 
      /finditem "Malachite" 
      /if $find()==FALSE /goto :Done 
      /click left pack $return 1 
      /click left pack $return combine 
      :Wait 
         /delay 1 
      /if $pack($return,empty)==FALSE /goto :Wait 
      /delay 1 
      /click left auto 
   /goto :Make 

  :Done 
  /sendkey up ctrl 
/return

Sub FindCombiner(Container)
   /for loop 7 downto 0 
      /if $pack(@loop,combine)==@Container /return @loop
   /next loop 
   /echo You do not appear to have a valid @Container container. 
/return 99 

bltracer
decaying skeleton
decaying skeleton
Posts: 5
Joined: Wed Nov 26, 2003 2:04 pm
Location: Hayward, CA

Post by bltracer » Wed Jan 28, 2004 12:47 am

tried to modify a bit for my needs... Celestial Essence...

in doesn't work

Code: Select all

Sub Main 

   /declare loop global 
 [color=red]  /call FindCombiner "Mortar and Pestle" [/color]   /cleanup 
   /click right inv $return 

   /sendkey down ctrl 
   :Make 
      /click left auto 
      /finditem "Celestial Solvent" 
      /if $find()==FALSE /goto :Done 
      /click left pack $return 0 
      /finditem "The Scent of Marr" 
      /if $find()==FALSE /goto :Done 
      /click left pack $return 1 
      /click left pack $return combine 
      :Wait 
         /delay 1 
      /if $pack($return,empty)==FALSE /goto :Wait 
      /delay 1 
      /click left auto 
   /goto :Make 

  :Done 
  /sendkey up ctrl 
/return 

Sub FindCombiner(Container) 
   /for loop 7 downto 0 
    [color=red]  /if $pack(@loop,combine)==@Container /return @loop [/color]   /next loop 
   /echo You do not appear to have a valid @Container container. 
/return 99 
I think the problems are in the red lines... ??? Any Ideas?

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Jan 28, 2004 3:21 am

Try this:

Code: Select all

Sub Main 

   /declare loop global 
   /call FindCombiner "Mortar and Pestle"
   /cleanup 
   /click right inv $return 

   /sendkey down ctrl 
   :Make 
      /click left auto 
      /finditem "Celestial Solvent" 
      /if $find()==FALSE /goto :Done 
      /click left pack $return 0 
      /finditem "The Scent of Marr" 
      /if $find()==FALSE /goto :Done 
      /click left pack $return 1 
      /click left pack $return combine 
      :Wait 
         /delay 1 
      /if $pack($return,empty)==FALSE /goto :Wait 
      /delay 1 
      /click left auto 
   /goto :Make 

  :Done 
  /sendkey up ctrl 
/return 

Sub FindCombiner(Container) 
/for loop 7 downto 0 
     /if "$pack(@loop,combine)"=="@Container" /return @loop
     /next loop 
     /echo You do not appear to have a valid @Container container. 
/return 99 


bltracer
decaying skeleton
decaying skeleton
Posts: 5
Joined: Wed Nov 26, 2003 2:04 pm
Location: Hayward, CA

Post by bltracer » Wed Jan 28, 2004 9:53 am

now it is echoing the "You do not have a valid Mortar and Pestle container line...

and yes, I do have one...


:?: :?: :?:

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Wed Jan 28, 2004 1:49 pm

Not sure what to tell you, I was just fixing the obvious problem of doing string comparisons without quotes when you have items with spaces in their names.

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Thu Jan 29, 2004 1:57 am

I never understood why people want the macro to open the bag for them. I always just open them myself to make the macro shorter.

You can give this a try. I modified it a little and added some comments to it. I am sure you will run into some problems with the click of the combine button so quickly after trying to place an item in the container:

Code: Select all

|Have the packs opened that you need opened, including the combiner in slot 7
|0 4
|1 5
|2 6
|3 7
|You might want to to some checks of the cursor to make sure the item was
|placed before continuing to the next item/combine click
Sub Main 
   /sendkey down ctrl 
   :Make 
      /autoinv
      /finditem "Celestial Solvent" 
      /if $find()==FALSE /goto :Done 
      /click left pack 7 0 
      /finditem "The Scent of Marr" 
      /if $find()==FALSE /goto :Done 
      /click left pack 7 1 
      /click left pack 7 combine 
      :Wait 
         /delay 1 
      /if $pack(7,empty)==FALSE /goto :Wait 
      /delay 1 
      /autoinv
   /goto :Make 
  :Done 
  /sendkey up ctrl
/endmacro