My first macro...

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

Moderator: MacroQuest Developers

lpmko
orc pawn
orc pawn
Posts: 17
Joined: Thu Jun 20, 2002 11:00 pm

My first macro...

Post by lpmko » Mon Sep 01, 2003 4:43 pm

My first macro...was looking at arrows.mac while i made it for help. not sure why it doesnt work. at the bottom are the messages i got when running the macro.

Code: Select all

| Tinkering.mac
#turbo
#event CombineTrivial "You can no longer advance" 
#event CombineSuccess "You have fashioned" 
#event CombineFail "You lacked the skills" 
#event CombineError "You cannot combine" 

Sub Main
   /call FindCombiner tinkering
   /if $return==99 /endmacro
   /varset v80 $return

   /cleanup
   /click right inv $return
   :Make
      /send down ctrl
      /click right inv $v80
      /finditem similar "Water Flask"
      /delay 1

      /click left pack $v80 0
      /finditem similar "Gnomish"
      /click left pack $v80 1
      /delay 1

      /send up ctrl
      /return
      :Combine
      /click left pack $v80 combine
      /if $cursor()==TRUE /goto :Drop
      /if $cursor()==FALSE /goto :Make

      :Drop
      /click left auto
   /goto :Make
/return


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

Sub event_CombineError
   /endmacro
/return
Couldn't find a comparision operator in 'null /varset p2 1'
Couldn't find a comparision operator in 'null /varset p2 2'
Couldn't find a comparision operator in 'null /varset p2 4'
Couldn't find a comparision operator in 'null /varset p2 5'
You no longer have a target.
You no longer have a target.
You no longer have a target.
You no longer have a target.
down is not online at this time.
Cleared the following: Timers Vars Arrays
The current macro has ended.

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 » Mon Sep 01, 2003 6:20 pm

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
p2 is a parameter variable and if I am not mistaken you cannot use any commands to change it's value:

Code: Select all

/click right inv $return
What is $return?

lpmko
orc pawn
orc pawn
Posts: 17
Joined: Thu Jun 20, 2002 11:00 pm

Post by lpmko » Mon Sep 01, 2003 6:32 pm

not sure actually, took it from the arrows.mac

Code: Select all

   /cleanup
   /click right inv $return
   :MakeArrows
      /sendkey down ctrl
same thing with the find combiner

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 
the reason i took the find combiner part from the arrows was because i really wasnt sure what to do. im trying to find the delux toolbox so i can combine the water flask and the gnomish spirits in it.

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

Post by Zeus » Tue Sep 02, 2003 8:24 am

$return is what the last function returned it's buffered in that variable. Change the p vor a v in that macro and see if it works. Think it should that way :) And when you change it you can use that instead of the $return, easier to see that way.

chimaera
a lesser mummy
a lesser mummy
Posts: 37
Joined: Fri Aug 01, 2003 4:14 pm

Post by chimaera » Tue Sep 02, 2003 9:35 am

Code: Select all

      /send down ctrl 
      /send up ctrl 
this will try to send "ctrl" to someone named "down" and "up" like if you were writing "/tell down ctrl". try these instead.

Code: Select all

      /sendkey down ctrl 
      /sendkey up ctrl 

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

This is what my FindCombiner looks like in my macro's

Post by wassup » Tue Sep 02, 2003 10:00 am

Code: Select all

#define CombinePack v97

Sub Main
    /call FindCombiner "mortar and pestle"
    .
    (relevant code)
    .
/return

.
(other Subs)
.

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
Hope that helps you a bit.

Spectre
orc pawn
orc pawn
Posts: 21
Joined: Tue Sep 02, 2003 10:31 am

Re: My first macro...

Post by Spectre » Tue Sep 02, 2003 10:35 am

lpmko wrote:My first macro...was looking at arrows.mac while i made it for help. not sure why it doesnt work. at the bottom are the messages i got when running the macro.

[...]

Couldn't find a comparision operator in 'null /varset p2 1'
Couldn't find a comparision operator in 'null /varset p2 2'
Couldn't find a comparision operator in 'null /varset p2 4'
Couldn't find a comparision operator in 'null /varset p2 5'
$pack returns null when the item you're checking can't hold items (the distinction about being a container isn't valid anymore since the last patch).

The way the above code is written (both yours and wassup's, BTW), you now need bags in all slots or you will get this message.

lpmko
orc pawn
orc pawn
Posts: 17
Joined: Thu Jun 20, 2002 11:00 pm

ahh

Post by lpmko » Tue Sep 02, 2003 11:32 am

ah thanks....

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 » Tue Sep 02, 2003 11:34 am

Not a problem with me... I always have 8 bags when I tradeskill anyway.

I just use my summon bag tradeskill item.