Sub Event_Zone questions

Need help running MacroQuest 1? Too bad! Use MQ2.

Moderator: MacroQuest Developers

User avatar
Goge
Macro Author
Macro Author
Posts: 71
Joined: Sat Jun 15, 2002 11:55 am
Location: Terra

Sub Event_Zone questions

Post by Goge » Sun Jun 16, 2002 8:00 pm

okay, i'm an idiot and i'm not in computer programing classes till next year (collage)

i can't seem to figure out how to use the Event_Zone thing, when i try to use like a normal sub "/call" it crashes, when i use a goto {are goto's inter-sub-able?} it crashes, i know / think the sub main needs to be there but i can't fiqure this thing out :(

i suck
He who sleep with Itchy arse wake with Smelly finger.

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Look at eventtest.mac

Post by Plazmic » Sun Jun 16, 2002 8:06 pm

If it crashes, that's bad... make sure you have the 22002-06-15 build.
If it still crashes... download Sym-2002-06-15 and PM me and I'll help figure it out...

As far as how it works...

Code: Select all

Sub Main
   :Loop
      /doevents
   /goto :Loop
/return

Sub Event_Zone
   /echo You zoned into $q0
/return
- Plazmic

User avatar
Goge
Macro Author
Macro Author
Posts: 71
Joined: Sat Jun 15, 2002 11:55 am
Location: Terra

Post by Goge » Mon Jun 17, 2002 12:15 am

sorry it's too late now and i didn't see it before because of a father's day party. I'll talk to you on tuesday seeing as tomorow (or rather today here; 12:30am) is your day off :)

Thanks.
He who sleep with Itchy arse wake with Smelly finger.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Mon Jun 17, 2002 12:25 am

Salutations,
Event_Zone is a callback subroutine, one that isn't called by the macro, but by MacroQuest when a /doevents command is called and the player has zoned. This could be put into your macro with something like (locs are made up)

Code: Select all

#include routines.mac

sub main
 /varset v1 0
 /call gotoloc 300,300
 /call gotoloc 300,500
 /face loc 400,500
 /sendkey down up
 :zoneloop
  /doevents
  /if n $v1!=1 /goto :zoneloop
 /sendkey up up
 /call gototarg "Plazmic"
/return

sub Event_Zone
 /varset v1 1
/return
This code is pretty simple. Now the only time that Event_Zone will be called in this macro is when the player has zoned since the begining of the macro (or last call of /doevents depending on how fast it runs) and /doevents is called. When it is called it goes through the list of all the callback functions, (listed on macroquest2.com/?=sub when looking at this one must remember sub main isn't a callback function) and checks if the event they are for is true since the last call of /doevents or the begining of the macro if it hasn't been called yet. If the event has happened, the subroutine is called, otherwise it is not. One ccan get a pretty good idea for how this works by looking at the code contained in eventtest.mac and following the stuff in the macro (create a level 1 enc and kill it, cast a spell, fizzle a spell, raise a skill etc.)
I hope this helps...

(Edit by Plazmic: corrected spelling of my name ;)