Problem with non-environment container combines.

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Problem with non-environment container combines.

Post by [40oz] » Sat Jun 14, 2003 4:04 am

I'm making a simple macro to combine celestial essences for me. Seems trivial, but I figured it was good practice, and that much less clicking. My problem, however, is it doesn't seem to find my Mortar & Pestle with /call FindCombiner.

Any insight would be appreciated. Here is my code:

Code: Select all

| - Celestial.mac -
|
| makes celestial essences with whatevers in your open bags.  go figure.  how cool.  yaaaaaay.
| get solvents and scents of mars off vendors and go at it.

#include routines.mac

Sub Main

   /call FindCombiner "Make Poison"
   /if $return==99 /endmacro
   /varset v80 $return

   :MakeEssence
      /if $pack($v80,empty)==FALSE /call CleanPack

      /delay 0
      /sendkey down ctrl

      /finditem "Celestial Solvent"
      /if $find()==FALSE /goto :Done
      /click left $v80 0
      /delay 3

      /finditem "The Scent of Marr"
      /if $find()==FALSE /goto :Done
      /click left $v80 1
      /delay 3

      /sendkey up ctrl
      /click left $v80 combine

      | it's a no fail combine, wait for the damn thing to be combined
      :WaitCombine
      /if "$cursor()"!="TRUE" /goto :WaitCombine
      /goto :WaitCombine

      | clear the cursor of shit
      :ClearCursor
      /click left auto
      /if "$cursor()"=="TRUE" /goto ClearCursor

   /goto :MakeEssence

   :Done
    /sendkey up ctrl
/return
And for reference, I pulled this out of teh tutorial:

Code: Select all

Sub FindCombiner
/varset p2 99
/for v99 0 to 7
/if "$pack($v99,combine)"=="$p0" /varset p2 $v99
/next v99
/return $p2

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 » Sat Jun 14, 2003 5:34 am

Replace

Code: Select all

   /call FindCombiner "Make Poison" 
with

Code: Select all

   /call FindCombiner "Mortar and Pestle" 

See if that works for you. It's what I use when I make these.

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Post by [40oz] » Sat Jun 14, 2003 12:55 pm

Well I believe it's finding the container, as it doesn't return a 99 anymore, but it still thinks it's in the upper left-hand corner and tries to drop all my shit on the ground.

I made my own function to find the bag because finding the right combine name wasn't working. Here it is:

Code: Select all

Sub FindMortar
/varset p2 99
/for v99 0 to 7
/if "$pack($v99,name)"=="$p0" /varset p2 $v99
/next v99
/return $p2
I call it with:

Code: Select all

/call FindMortar "Mortar and Pestle"
It returns a 3, which is where my mortar and pestle is, then fails to put the things in the right spots. I'm using the default bag ui

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

Compare with mine

Post by wassup » Sat Jun 14, 2003 2:50 pm

Well, here is my Celestial Essenc macro... compare it with yours...

I used the FindCombiner code from another macro, but the rest is my own code.

Code: Select all

| essence.mac
|
| Combines celestial solvent and The Scent of Marr.
|
| This macro will perform as many combines as you have components VERY quickly.
|

#define DelayValue v40
#define CombinePack v97

Sub Main

   /call FindCombiner "mortar and pestle"  

   |Set the delay value
   /varset DelayValue 1

   /sendkey down ctrl

   :CombineLoop
|Get celestial solvent
   /finditem "celestial solvent"
   /delay $DelayValue
   /if $cursor()!=True /goto :EndIt

   :ReClick1
|Place celestial solvent in mortar
   /click left pack $CombinePack 0
   /delay $DelayValue
   /if "$cursor(name)"=="celestial solvent" /goto :ReClick1

|Get Scent of Marr
   /finditem "the scent of marr"
   /delay $DelayValue
   /if $cursor()!=True /goto :Endit

   :ReClick2
|Place Scent of Marr in mortar
   /click left pack $CombinePack 1
   /delay $DelayValue
   /if "$cursor(name)"=="the scent of marr" /goto :ReClick2

|Click the Combine button
   /click left pack $CombinePack combine
   :WaitCombine
   /delay 1

   |Assume success and drop in auto equip
   /if $cursor()==True {
       /goto :AutoDrop
   } else /goto :WaitCombine

|Drop everything in auto equip
   :AutoDrop
   /if $cursor()==True {
       /click left auto
       /delay 1
       /goto :AutoDrop
   }

   |Start a new Combine
   /goto :CombineLoop

   :EndIt
   /zapvars
   /sendkey up ctrl
   /endmacro

/return

Sub FindCombiner 
    /varset CombinerPack 99 
    /for v99 0 to 7 
        /if "$pack($v99,name)"=="$p0" {
            /varset CombinePack $v99
        } 
    /next v99 

    /if $CombinePack==99 { 
        /echo No container named "$p0" found. 
        /endmacro 
    } 
/return $CombinerPack

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

Re: Problem with non-environment container combines.

Post by wassup » Sat Jun 14, 2003 3:05 pm

[40oz] wrote:I'm making a simple macro to combine celestial essences for me. Seems trivial, but I figured it was good practice, and that much less clicking. My problem, however, is it doesn't seem to find my Mortar & Pestle with /call FindCombiner.

Any insight would be appreciated. Here is my code:

Code: Select all

| - Celestial.mac -
|
| makes celestial essences with whatevers in your open bags.  go figure.  how cool.  yaaaaaay.
| get solvents and scents of mars off vendors and go at it.

#include routines.mac

Sub Main

   /call FindCombiner "Make Poison"
   /if $return==99 /endmacro
   /varset v80 $return

   :MakeEssence
      /if $pack($v80,empty)==FALSE /call CleanPack

      /delay 0
      /sendkey down ctrl

      /finditem "Celestial Solvent"
      /if $find()==FALSE /goto :Done
      /click left $v80 0
      /delay 3

      /finditem "The Scent of Marr"
      /if $find()==FALSE /goto :Done
      /click left $v80 1
      /delay 3

      /sendkey up ctrl
      /click left $v80 combine

      | it's a no fail combine, wait for the damn thing to be combined
      :WaitCombine
      /if "$cursor()"!="TRUE" /goto :WaitCombine
      /goto :WaitCombine

      | clear the cursor of shit
      :ClearCursor
      /click left auto
      /if "$cursor()"=="TRUE" /goto ClearCursor

   /goto :MakeEssence

   :Done
    /sendkey up ctrl
/return
And for reference, I pulled this out of teh tutorial:

Code: Select all

Sub FindCombiner
/varset p2 99
/for v99 0 to 7
/if "$pack($v99,combine)"=="$p0" /varset p2 $v99
/next v99
/return $p2
I see one problem... after looking closer...

Code: Select all

      /click left $v80 0
and

Code: Select all

      /click left $v80 combine
should be

Code: Select all

/click left pack $v80 0
and

Code: Select all

/click left pack $v80 combine
You can still compare yours to mine though for hints/help.

User avatar
Imperfect
Macro Author
Macro Author
Posts: 319
Joined: Fri Jun 14, 2002 1:52 am

Post by Imperfect » Sun Jun 15, 2003 12:04 am

This was a bug that was brought up by me and Amadeus fixed it in the forums and from the sync I did today it looks as if it is in CVS now also. One issue you are still going to have is that right click still doesn't seem to work.

[40oz]
a hill giant
a hill giant
Posts: 156
Joined: Tue Nov 12, 2002 12:14 pm

Post by [40oz] » Sun Jun 15, 2003 12:32 pm

i like the way you make sure you get it in the mortar before moving to next item instead of blindly relying on delays.

i do believe i shall use your idea, good sir.

and I got it working, was missing that stupid pack in the /click statement =(

Thanks for the help!

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 » Sun Jun 15, 2003 1:42 pm

[40oz] wrote:i like the way you make sure you get it in the mortar before moving to next item instead of blindly relying on delays.

i do believe i shall use your idea, good sir.

and I got it working, was missing that stupid pack in the /click statement =(

Thanks for the help!
No problem, I'm a novice but I try :)

I quit relying on delays because of my having to restart macro's because of lag or whatever causing the occasional missed clicks. I just came up with a simple way to make sure the item was placed before moving on.

Glad it was of help to you.

PS: Found a small typo in my macro, and noticed a few other things that could be streamlined a bit. I'm goign to test my macro out with the changes to see how it works.

1. Why return $CombinePack when the /varset CombinePack $v99 sets the variable value. I think you can just use /return instead.

One fix I am using:

Code: Select all

Sub FindCombiner 
    /varset CombinePack 99 
    /for v99 0 to 7 
        /if "$pack($v99,name)"=="$p0" { 
            /varset CombinePack $v99 
        } 
    /next v99 

    /if n $CombinePack==99 { 
        /echo No container named "$p0" found. 
        /endmacro 
    } 
/return

Waxxedazz
a lesser mummy
a lesser mummy
Posts: 47
Joined: Sat May 31, 2003 7:09 pm

makeover

Post by Waxxedazz » Sat Aug 02, 2003 11:43 pm

I changed this to a JC tradeskill macro but it seems to want me to manually click on the next item after a fail... im guessin its something to do with cel essence being no fail. if someone could help me make it work after a fail I would appreciate. I cant get the other JC macros to work the all boot me to desktop.

Code: Select all

#define DelayValue v40 
#define CombinePack v97 

Sub Main 

   /call FindCombiner "Planar Jeweller's Kit"  

   |Set the delay value 
   /varset DelayValue 1

   /sendkey down ctrl 

   :CombineLoop 
|Get celestial solvent 
   /finditem "Electrum Bar" 
   /delay $DelayValue 
   /if $cursor()!=True /goto :EndIt 

   :ReClick1 
|Place celestial solvent in mortar 
   /click left pack $CombinePack 0 
   /delay $DelayValue 
   /if "$cursor(name)"=="Electrum Bar" /goto :ReClick1 

|Get Scent of Marr 
   /finditem "Turquoise" 
   /delay $DelayValue 
   /if $cursor()!=True /goto :Endit 

   :ReClick2 
|Place Scent of Marr in mortar 
   /click left pack $CombinePack 1 
   /delay $DelayValue 
   /if "$cursor(name)"=="Turquoise" /goto :ReClick2 

|Click the Combine button 
   /click left pack $CombinePack combine 
   :WaitCombine 
   /delay 3

  |Assume success and drop in auto equip 
  /if $cursor()==True { 
       /goto :AutoDrop 
  } else /goto :WaitCombine 
  

|Drop everything in auto equip 
   :AutoDrop 
   /if $cursor()==True { 
       /click left auto 
       /delay 2
       /goto :AutoDrop 
   } 

   |Start a new Combine 
   /goto :CombineLoop 

   :EndIt 
   /zapvars 
   /sendkey up ctrl 
   /endmacro 

/return 

Sub FindCombiner 
    /varset CombinerPack 99 
    /for v99 0 to 7 
        /if "$pack($v99,name)"=="$p0" { 
            /varset CombinePack $v99 
        } 
    /next v99 

    /if $CombinePack==99 { 
        /echo No container named "$p0" found. 
        /endmacro 
    } 
/return $CombinerPack 

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Additions to make it work ...

Post by MacroFiend » Sun Aug 03, 2003 12:09 am

Add the following to the top of your macro ...

Code: Select all

#event CombFail "You lacked the skill"

#define Failed v90
Add the following just after :CombineLoop

Code: Select all

   | Reset the Failed variable
   /varset Failed 0
Then change the following:

Code: Select all

  |Assume success and drop in auto equip 
  /if $cursor()==True { 
       /goto :AutoDrop 
  } else {
      /if n $Failed==1 /goto :CombineLoop
      /goto :WaitCombine 
  }
If you want the macro to run faster, you can change the /delay 3 just after :WaitCombine to be a /doevents since you are looping for either something to appear on the cursor or now, an event to fire.

And Finally, add the following at the bottom of the macro:

Code: Select all

Sub Event_CombFail
  /setvar $Failed 1
/return
That should fix your script to account for failures. You may want to look at the TS.mac or SITS.mac posted elsewhere. They are both pretty robust scripts.

Waxxedazz
a lesser mummy
a lesser mummy
Posts: 47
Joined: Sat May 31, 2003 7:09 pm

Post by Waxxedazz » Sun Aug 03, 2003 10:56 pm

Thanks for the help Ill toss those in and hopefully be on my way. I did try a few of the JC macros I found in search but every one of em drops me to desktop when I start it... not sure if its my routine.mac or maybe something else. Also happens with all the fletching ones I have tried. Maybe yall have some advice but I figure I just do it the hard way and use a generic type tradeskill mac and change the names to the JC items I need to combine... basically does the same just a little more manual labor which I dont mind since I dont afk macro anyways.