Difference betweeon @ and $

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

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

Difference betweeon @ and $

Post by [40oz] » Wed Oct 08, 2003 1:52 am

Plaz,

If you could explain, is their a difference between the @ and the $?

I used the $ in my macros where I thought @ should be applied and it seemed to work fine. Here is some example 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
   /declare combiner global

   /call FindMortar "Mortar and Pestle" 
   /if $return==99 /endmacro
   /varset combiner $return

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

      /delay 0
      /sendkey down ctrl

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

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

      /sendkey up ctrl
      /click left pack $combiner combine

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

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



   /goto :MakeEssence

   :Done
    /sendkey up ctrl
/return

Sub FindMortar
   /declare temp local
   /declare counter local
   /varset temp 99

   /for counter 0 to 7
      /if "$pack($counter,name)"=="$p0" /varset temp $counter
   /next counter
/return temp
Also, this is using the IRC-Latest downloaded a day or two ago. It couldn't find the right x/y coordinates for things in my Mortar & Pestle. Can anyone verify this problem, or point to where I'm wrong? Or does it have something to do with the difference between @ and $?

Thanks in advance!

[40oz]

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 » Wed Oct 08, 2003 2:33 am

You could give this a try. I think it will work.

One thing to remember on the new declared variables. When you try to get the value from a declared variable, it is preceded by the @.

MQ defined variables are preceded by a $.

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. 

Sub Main 
   /declare combiner local
   /call FindMortar "Mortar and Pestle" 
   
   |Since combiner is a local variable, use the value from $return
   /if $return==99 /endmacro 
   /varset combiner $return 

   :MakeEssence 
   |/if $pack(@combiner,empty)==FALSE /call CleanPack 

      /delay 0 
      /sendkey down ctrl 

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

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

      /sendkey up ctrl 
      /click left pack @combiner combine 

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

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

   /goto :MakeEssence 

   :Done 
    /sendkey up ctrl 
/return 

Sub FindMortar
   /declare temp local 
   /declare counter local 
   /varset temp 99 

   /for counter 0 to 7 
      /if "$pack(@counter,name)"=="@Param0" /varset temp @counter 
   /next counter 
/return @temp