Help with Event and more... a continuing saga

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Help with Event and more... a continuing saga

Post by aChallenged1 » Tue Jul 06, 2004 11:40 pm

This is not expected, by me, to work at all, yet. I'm trying to get a feel for this. It's pretty self explainitory (sp?). What I want to know is if I'm on the right track.

From what I have read so far, the first line will watch for "Event Assist" which is 1 name of the person telling 2(raid/group) to assist. When this is seen, I believe what it should do is run the event by echoing "Assisting Meatshield" followed by doing an actual /assist Meatshield, delaying 1 second and sending in pet. Then starting to watch for the next assist.

Is that what I have written, or have I screwed it up?

Thank you in advance, your help is appriciated.

Code: Select all

#Event Assist "#1# tells the #*# Assist #*#"

Sub Event_Assist
  /echo Assisting #1#!
  /assist #1#
  /delay 1s
  /pet attack
/return
Last edited by aChallenged1 on Thu Jul 08, 2004 1:31 pm, edited 1 time in total.

Rusty~
a hill giant
a hill giant
Posts: 244
Joined: Wed Apr 14, 2004 2:55 pm

Post by Rusty~ » Wed Jul 07, 2004 12:02 am

what you have should work, but you need a sub main and inside you need to have this at minimum:

Code: Select all

Sub Main
:loop
   /doevents
   /delay 1
/goto :loop
to process all events in your macro you use

Code: Select all

/doevents
to do just one, you put the name of the event after it:

Code: Select all

/doevents Assist

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 » Wed Jul 07, 2004 12:47 am


User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 07, 2004 5:58 am

Thank you DKAA.

I'd seen that, but it didn't register in my head at the time.

Thanks Rusty, I knew I was missing a lot of stuff. I was just wanting to see if my understanding was at least rudimentary. :D

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 07, 2004 6:41 am

Code: Select all

| - myfirst.mac -
|
| Just to prove I have a basic understanding of Event usage
| Subroutine usage and return and paramaters for catching chat sequences.
|


#Event Assist "#1# tells the #*#Assist#*#"
#Event UnderAttack "#1# has #2# you for#*#"

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

Sub Event_Assist 
  /echo Assisting #1#! 
  /assist #1# 
  /delay 1s 
  /pet attack 
/return

Sub Event_UnderAttack
  /popup "You are under attack!"
  /face
  /attack on
/return
Ok that is what I have now. From looking at the page DKAA gave me, the info Rusty~ gave me and looking at a few macros, I believe that is a working macro. How good it, not very. But it's a start.

Now I understand /doevent and /doevent XYZ but could someone tell me the importance of /doevent flush please? Is the "flush" option something you would do to clear buffers after an event has passed so as to ignore anything between the last event you ran and the end of it, so you don't suddenly start to do something you should not be?

EG running my above script, I get attacked it goes to the UnderAttack event. While killing the mob an assist is called. My mob goes down and the assist mob has been down. Event /return's' at this point to main.

Now, since I don't /doevent FLUSH does that mean that it will attempt to assist the assist caller, who now may be tanking a new/different mob building agro, and should not be assisted yet, is going to be assisted by my macro, even though I wouldn't want it to?

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Wed Jul 07, 2004 7:14 am

*burp*
/doevents [flush | specificevent]
Runs any events that have queued up or flushes queued events
If specificevent is used, only those events will run

Examples

/doevents chat
/doevents will only react to chat events

/doevents flush
Cears all events in the /doevents queue

/doevents SpellFizzle
doevents will only react to SpellFizzle events
Need some more soda =/

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 07, 2004 7:33 am

Yep, saw that. Even sent a PM about the typo "cear" in there.

But, it doesn't really tell me what you would use it for. Which is why I was quite specific in how I asked the question.

/hands drumstix a fresh Mountaindew(tm)

edit: starting to wake up more and think I may be way off on my thinking...

Do events queue up? Is there a buffer that holds "chat" info?

I need to sleep more. < 5 hours sleep is just not enough.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 07, 2004 7:38 am

Damn it Drumstix, now you have me confused.

I'm going to bed for 30min and I'll be back; still confused but maybe more awake.

I think my question was valid in the post previous to Drumstix's with the info from the manual in it. That question has not been answered in a way that makes sense to me, yet.

User avatar
nosaj969
a lesser mummy
a lesser mummy
Posts: 33
Joined: Wed Apr 28, 2004 3:39 pm
Location: Hagerstown, MD

/doevents flush

Post by nosaj969 » Wed Jul 07, 2004 8:44 am

Code: Select all

| - myfirst.mac - 
| 
| Just to prove I have a basic understanding of Event usage 
| Subroutine usage and return and paramaters for catching chat sequences. 
| 


#Event Assist "#1# tells the #*#Assist#*#" 
#Event UnderAttack "#1# has #2# you for#*#" 

Sub Main 
  :Loop 
    /if ( ${Target.State.Equal[DEAD]} ) /call MobDead
    /doevents 
    /delay 1 
    /goto :Loop 
  /return 

Sub Event_Assist 
  /echo Assisting #1#! 
  /assist #1# 
  /delay 1s 
  /pet attack 
/return 

Sub Event_UnderAttack 
  /popup "You are under attack!" 
  /face 
  /attack on 
/return

Sub MobDead
  /echo The mob is now dead
  /target clear
  /attack off
  /doevents flush
/return
In the above example you would flush out all the events in the event queue when the mob you have trageted is dead. This would stop you from trying to attack a dead mob.

In my understanding the doevents flush has limited uses. The main idea behind it is to clear out all the events once a certian condition is meet. IE If you had a nuke event (#Event Nuke "#1# tells the #*#Nuke#*#") you don't want to do that event if the mob is already dead. So you would flush out the event queue when the mob is dead. (This is just my understanding of it, it could be wrong)

Also your logic of how the above code would work is slightly off. Here is how I would see it working(Not counting the code I added)... You are attacked so you start to attacking mobA. You would then exit the event sub right after you turned attack on. If an Assist event was recieved you would try to do that event reguardless if you where attacking a mob or not. So if you where on mob A and an assist call was given for mob B you should try to send your pet to attack mob B. You will exit the event sub after you sent your pet to attack mob B.

I know that I ramble a little but hopefully you slightly understand how events and the flush command work a little better. If not I don't blame you, I don't understand half the stuff I type either.

nosaj969

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 07, 2004 10:07 am

Thank you nosaj, that extra code you added, along with the explenation makes perfect sense.

Your additional comments make sense, too. I had not thought about it going from /doevent back to main Sub inspite of lack of "call" to tell it to exit. I could put in a subroutine within the UnderAttack event that watches for the mob I'm beating on to die, as an option.

I just typed out a bunch of stuff, and removed it. I looked again at the code nosaj added and answered my own question in part. I'll be messing around with this some more.

Thanks again.

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Wed Jul 07, 2004 10:31 pm

Hey, this Mountain Dew is warm :evil:

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 07, 2004 11:01 pm

Hey, I left it there for you unopened and cold. Not my fault you didn't grab it right away! :lol:

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jul 08, 2004 8:46 am

Ok, my first round of working with basic code taught me a couple things.
Thanks for the help everyone.

Now I'm looking to understand a few more things. Bear with me, you know someone else is also reading these and hoping to learn from what I'm posting, so you're helping more than just me here.

I've found 2 Snippets http://macroquest2.com/phpBB2/viewtopic.php?t=6962 the Exptracking.inc and http://macroquest2.com/phpBB2/viewtopic.php?t=6741 the autofight.inc that I would like to learn how to properly incorperate into a simple macro. In the case of exptracking.inc I'd like to know how to determine the best place to add it in any macro I might run, as well as how to change it to create an INI from charactername vs having to tell it in the script, if possible.

Anyway, I was able to figure out that the lines I would need to add for the exptracker.inc would be the following; I'm not going to get into the autoattack one this round.

Code: Select all

#include exptracking.inc //this sets the inc as a part of the macro

/declare IniFileName string outer myinifilename.ini  //change the last to character_server.ini or whatever

call  StartExpTrack
I know the #include needs to be at top before the Sub Main.
I also know that the /declare goes with the others at top right after Sub Main; if there are others, otherwise it stands alone.
What I am not sure of is when and where to place the call.
The example I'm using to get this far was a very basic mac that does one thing, and that is run the exptracker. Within it is also a loop that continually /doevents.

So, to recap, I know where the include and declare statements go. I am not sure where the call goes and if I need to make a loop for it or not as is in the post where I got all this from.

Anyway, putting up my practical exercise in next post.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jul 08, 2004 8:47 am

Code: Select all

| - myfirst_continued.mac - 
| 
| Just to prove I have a basic understanding of Event usage 
| Subroutine usage and return and paramaters for catching chat sequences. 
| Now adding in #include, declare, and call

#include exptracking.inc 

/declare IniFileName string outer aChallenged1.ini  

#Event Assist "#1# tells the #*#Assist#*#" 
#Event UnderAttack "#1# has #2# you for#*#" 

Sub Main 
  :Loop
    /call StartExpTrack
    /doevents 
    /delay 1 
    /goto :Loop 
  /return 

Sub Event_Assist 
  /echo Assisting #1#! 
  /assist #1# 
  /delay 1s 
  /pet attack 
/return 

Sub Event_UnderAttack 
  /popup "You are under attack!" 
  /face 
  /attack on 
/return

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jul 08, 2004 2:37 pm

Continuing this in Macro Help forum.

http://macroquest2.com/phpBB2/viewtopic ... 7974#57974