@Param0

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

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

@Param0

Post by notadruid » Thu Dec 11, 2003 6:40 am

How do you differentiate between the param passed by
/mac whatever.mac param0

and the param passed by

Code: Select all

/call whatever param0
Is it a global vs local variable thing?

Drunkensloth
a lesser mummy
a lesser mummy
Posts: 67
Joined: Sat Oct 18, 2003 2:54 am

Post by Drunkensloth » Thu Dec 11, 2003 3:57 pm

be a little more specific


but the way i understand it and the way i have seen it work is

if in your macro you /call Subname Param0

it will use the parameters defined from the original /mac macname Param0

if you want it to do something different

just use
/call Subname whateveryouwant

hope that helps
And here I was clicking like a sucker!

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Dec 11, 2003 7:12 pm

You don't. The parameters passed on the /macro line are sent as Param0,1,2.. to the Main sub and local to that sub. If you are in a different sub it will have a different set of Param's.

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

Post by notadruid » Fri Dec 12, 2003 2:30 pm

Ok, so I'm making a macro that lets another character control you through tell (similar to controlling a pet through /pet) and I want the master's name to be the param when the mac is typed.

/mac pet.mac MasterName

Can I have something like

Code: Select all

#Event attack "@param0 tells you, 'attack'"
Sub Event_attack
  [color=red]/assist @param0[/color]
  [color=red]/tell @param0 Attacking $target(name)[/color]
  /call move
  /attack on
/return

Or do I have to do this in the beginning of main?

Code: Select all

/declare Mastername global
/varset Mastername @param0
and use @Mastername in the subs?

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Fri Dec 12, 2003 3:16 pm

You have to use the second version.

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 » Fri Dec 12, 2003 4:18 pm

Make sure you use @Param0 instead of @param0 also.