Help With Macro

BuffBot

Once You Go Hack, You Never Go Back
Joined
Oct 14, 2006
Messages
417
Reaction score
0
Points
16
Im working on my first macro but i'm trying to figure something out. When it says "you have entered <zone>" I want it to /camp. what would I have to have for sub and event?
 
You have entered a zone no longer is read in MQ I don't think.

Store your Zone.ID then do a comparison. if (${Zone.ID}!=${StroredID}) /dowhatever
 
declare > /declare CurZone int outer ${Zone.ID}
for your loop > /if (${Zone.ID}!=${CurZone}) /endmacro
 
Just so you know where to place them in the macro

I use this below.
Code:
Sub Main

[COLOR="Red"]/declare StartZone int outer 0
/varset StartZone ${Zone.ID}[/COLOR]

:MainLoop
[COLOR="Red"]/call ZoneCheck[/COLOR]

Whatever you are doing goes here

/goto :MainLoop
/return

[COLOR="Red"]Sub ZoneCheck
/if (${Zone.ID}!=${StartZone} 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return[/COLOR]

First off, each zone has its own specific ID number. you can see the ID for your current zone with /echo ${Zone.ID} that will kick it up to the MQ2 window. You want to make sure that you are always in that zone so you just keep checking that the ID of where you are is still = to the Zone.ID you started with.
First you create your variable within the macro with the /declare XXXX int outer 0
then you store it, like JJ said above with /varset XXXXX ${Zone.ID} That sets the new int you created to = the zone ID where you are now
the /call checks it and if you are in a zone where ${Zone.ID} does not equal the one you stored as StartZone then it camps you out, or ends the macro, or zones you back to the zone you wanted.. whatever you want it to do under the sub. That exclamation mark is the NOT part in the line. NotEqual is !=. Sorry if I dubmed it down too much. when I was teaching myself to write them It helped me to look at why it was working instead of just trying to take pieces from old macros and putting them together.

Hope it helps,

VP
 
Thanks, i will mess with it a bit tonight and see if it works. You have helped greatly!
 
Code:
Sub ZoneCheck
/if (${Zone.ID}!=${StartZone} 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
I know this probably isn't a big deal but as I read ${Zone.ID}!=${StartZone} this will have your character camp as soon as you leave the zone you start in. So the macro would need to be set up to leave the start zone before making this check and the check would need to replace != with == or make it an /if Else statement.
Code:
Sub ZoneCheck
/if (${Zone.ID}!=${StartZone}) {
  /return
 } Else { 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
Code:
Sub ZoneCheck
/if (${Zone.ID}==${StartZone}) 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
Just my 2cp.
 
When it says "you have entered <zone>" I want it to /camp.

I know this probably isn't a big deal but as I read ${Zone.ID}!=${StartZone} this will have your character camp as soon as you leave the zone you start in. So the macro would need to be set up to leave the start zone before making this check and the check would need to replace != with == or make it an /if Else statement.

He wants it to camp when he leaves the zone he was in. Instance ran out of time or he died. It is just easier to camp out then stay sitting in game. Also the macro is not set up to leave the zone. It is set up to check you have not changed zones, if you have then take this step and camp yourself out.
 
Code:
Sub ZoneCheck
/if (${Zone.ID}==${StartZone}) 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return

Your code doesn't make sense magic, even if you put in the starting bracket, it would camp in the same zone you are suppose to be in, VP had it right.

Code:
Sub ZoneCheck
/if (${Zone.ID}==${StartZone}) [COLOR="Red"]{[/COLOR]
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
 
DISCLAIMER: MY SOLUTION IS A BAD WAY TO DO IT. IT MAY NOT EVEN WORK. I will leave it here, however, so people have a simple example of how events work, even though this example doesn't work as EQ sends the zone text before the zone is ready.

He wants it to camp when he leaves the zone he was in. Instance ran out of time or he died. It is just easier to camp out then stay sitting in game. Also the macro is not set up to leave the zone. It is set up to check you have not changed zones, if you have then take this step and camp yourself out.

If all he wants to do is camp whenever he leaves the zone he starts in, that's the same thing as camping when you enter a new zone. You can eliminate variables entirely by doing this:

Code:
#Event Zoned "#*#You have entered#*#"

Sub Main
   :mainloop
      |do things, but make sure you have a doevents check in there somewhere
      /doevents
   /goto :mainloop
/return

Sub Event_Zoned
   /camp
   /endmacro
/return

Not necessarily more correct than any other solution here, but in my mind simpler.

Disclaimer: I typed this off the top of my head, idea is right but I make no guarantees on syntax.
 
Last edited:
They could have fixed it I dont remember ever seeing a fix posted but the chat you have entered was not being picked up by MQ2.
 
They could have fixed it I dont remember ever seeing a fix posted but the chat you have entered was not being picked up by MQ2.

Thanks for letting me know. As I said I just thought about it off the top of my head and it made sense to do it my way. Guess the only way to be sure is to log in and test it.
 
Like I said it could have been fixed I stopped keeping up with updates for a few months and might have missed it being fixed. Even if it was fixed I would probably still set my Zone.ID with a declare/varset.
 
if what I remember is correct, do not use that event. it won't be picked up in mq2 as JJ said for the exact reason being the text is received before the zone is ready and thus using it is wrong.
 
add a second acceptable zone id to the ZoneCheck

Code:
Sub ZoneCheck
/if (${Zone.ID}!=${StartZone} [COLOR="Red"]{[/COLOR]
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
I know this probably isn't a big deal but as I read ${Zone.ID}!=${StartZone} this will have your character camp as soon as you leave the zone you start in. So the macro would need to be set up to leave the start zone before making this check and the check would need to replace != with == or make it an /if Else statement.
Code:
Sub ZoneCheck
/if (${Zone.ID}!=${StartZone}) {
  /return
 } Else { 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
Code:
Sub ZoneCheck
/if (${Zone.ID}==${StartZone}) 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return
Just my 2cp.

this would almost make sense, if you wanted it to start in one zone, then move into another you could just add a second zone id to the declares. say getting an instance, then zoneing in.. you want both to be accepted.

/declare StartZone int outer 0
/declare HuntZone int outer 0

/varset StartZone ${Zone.ID}
/varset HuntZone XXX - just find that ID manually and put it in there

then on the ZoneCheck add it to the check

Code:
/if (${Zone.ID}!=${StartZone} && ${Zone.ID}!=${HuntZone} {
 
Code:
Sub ZoneCheck
/if (${Zone.ID}==${StartZone}) 
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return

Your code doesn't make sense magic, even if you put in the starting bracket, it would camp in the same zone you are suppose to be in, VP had it right.

Code:
Sub ZoneCheck
/if (${Zone.ID}==${StartZone}) [COLOR="Red"]{[/COLOR]
  /camp desktop
  /delay 1 m
  /camp desktop
  /delay 1m
  /camp desktop
  /endmac
 }
/return

If you look at VP's code one of his first lines is /varset StartZone ${Zone.ID} this sets the variable StartZone to the ID of the zone you are currently in. My thinking was he starts the macro in say the Guild Lobby the macro moves them to PoK and were ever he wants his group to go, when he is done he moves his toons back to the GL and they would camp out. I did not glean from the OP that he was starting the mac in an instanced zone and wanted it to camp him out when he was kicked from the instanced zone. So yes if you want to camp if you are NOT in the zone you started in then VP's has it right.