Need a REAL quick explanation.

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

skysurf
a lesser mummy
a lesser mummy
Posts: 52
Joined: Fri Aug 15, 2003 1:54 am

Need a REAL quick explanation.

Post by skysurf » Fri Oct 10, 2003 9:55 pm

Im one of those smart guys who can't tie his own shoelaces.

Anyway, here's my problem. Im working on converting a script to the new syntax and I cannot for the life of me figure out when to put a @ in front of a variable or when not to.

Some place a variable will work fine without the @ in front of it, other times it needs it.

Explanation?

Thanks in advance :)

Sky

skysurf
a lesser mummy
a lesser mummy
Posts: 52
Joined: Fri Aug 15, 2003 1:54 am

Post by skysurf » Fri Oct 10, 2003 9:57 pm

Heres a couple lines that im talking about.

/varset Order_Amount $int(Temp_Var)

/varadd Temp_Var .99


Which needs an @ and which doesn't and more importantly why?

Sky

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

Post by MacroFiend » Fri Oct 10, 2003 10:06 pm

Quick explanation:
If you create the variable using /declare, then it needs an @. Otherwise, it stays a $.

Code conversion explanation: Any $v, $a, $t, $l and $p have to be changed.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Fri Oct 10, 2003 10:38 pm

@ retrieves the value of the variable

/varset Order_Amount $int(@Temp_Var)

A variable can point to another variable:

/declare count global
/declare ptr global
/varset ptr count
/varadd @ptr 1

would increment the variable count

skysurf
a lesser mummy
a lesser mummy
Posts: 52
Joined: Fri Aug 15, 2003 1:54 am

Need more help =/

Post by skysurf » Fri Oct 10, 2003 10:41 pm

The macro I have been using was from someone else and over months and months I had chopped it up so much it was gettin pretty unreadable. So anyway I decide tonight while to trying to convert it that I would try to finally write my own.

Well, even though I copied the openpacks subroutine exactly from the old macro it wont work.

I am approaching severe frustration. Here is what I have.

Code: Select all

Sub Main



/declare Index1 global


/call OpenPacks

/return

|=======================================================================================
Sub OpenPacks
   /press shift
   /press ctrl
   /press alt
   /press esc
   /press esc
   /press esc
/press esc
/press esc
/press esc
/press esc
/press esc
/press esc
   /press i
   /delay 2
   /for Index1 0 to 7
      /if $pack(@Index1,open)!=TRUE /click right inv @Index1
      /delay 5
   /next Index1
/return

Why would this work in once macro and not in another? /cry

/goes and buys beer crying all the way

Thanks, Sky

Edit: Valerian thinks code brackets are yummy.