Always on macros and their main loop?

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

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

Always on macros and their main loop?

Post by blueninja » Tue Oct 07, 2003 5:21 pm

I've written a small script that plays sound when someone sends me a tell with a specific text (use it so that friends can wake me up for flag mobs) and I've been wondering about the correct way to do infinite loops that wait for events. What I do now is I just loop around a /doevents with a /delay 1s, like the code below. Is this a good way to do it or do I risk any stack overflows or the like? The reason I'm asking is that I'm noticing a bit of client side lag when I break out of the macro with /end so I'm thinking this may build up something behind the scenes that I don't see.

Basically the question is, is this right or wrong:

Code: Select all

#event blah "blah blah'" 
Sub Main 
   :neverending 
       /delay 1s 
       /doevents 
   /goto :neverending 
/return 
TIA

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 » Tue Oct 07, 2003 6:18 pm

/end keep keys

Learn it. Live it. Love it.

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 » Tue Oct 07, 2003 7:17 pm

Ah, didn't know about 'keep keys' but after reading up on it I'd say I have my answer.. Thanks.