• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

AHTools.inc <- Macro Safety Tools

AnonymousHero

Active member
Joined
Apr 22, 2011
RedCents
516¢
I've decided it's a good idea to build some tools that encourage people to write their macros with safety in mind. To do this I will be making my own tools I've been working on available to the NA community as an .inc file.

I've also added an SOS distress call that beeps out SOS (simple /call SOS). I use this in the CheckGMs subroutine if a GM is in the zone with you.

CheckZone: Updated. You can specify how many players you want in your area (like if you have 3 toons you play together you'd punch in 3. Also specifies how close people have to be for your macro to go into a holding pattern. I'd use 200-300 for most things like cskillup.mac or alctol.mac.

CheckGMs: Updated. Will also beep out SOS if it detects a GM presence in the zone. Should only do it once if your settings put your macro into a holding pattern but I havent been able to test because I dont run into many GMs :D

PluginCheck: Updated and tested. Works perfectly. /call PluginCheck MQ2Main as an example would not run the macro if the plugin MQ2Main was not loaded.

To use this in your macro.
Save the file to your /macro folder
Add the following text to the top your macro
#include AHTools.inc
Rich (BB code):
| ---------------------------------------------------------------------------
| AHTools.inc by AnonymousHero
| This is not actually a macro but a file that can be #included into other
| existing macros to do different checks.
| ---------------------------------------------------------------------------
| holding variable will be used primarily for things that should only be
| triggered once.

Sub SOS
| Used to beep out SOS in Morse code to get the attention of the person near
| the computer while the macro is running. Used in CheckGMs when a GM
| is detected in the zone.
	/beep
	/delay 1
	/beep
	/delay 1
	/beep
	/delay 5
	/beep
	/delay 5
	/beep
	/delay 5
	/beep
	/delay 5
	/beep
	/delay 1
	/beep
	/delay 1
	/beep
/return

Sub CheckZone(int MyPlayers, int MyRadius)
| If you have 3 toons in your group then you will set MyPlayers in your macro
| to 3. If it detects a 4th toon in your specified radius then it will put
| the macro on pause by continuing to check if players are in the radius and
| resume the macro when the player has left the area. If you want it to be
| zone wide just punch in MyRadius as like 10000 or 100000. A number of
| about 200-300 could be used in large zones if you are not worried.
/declare holding bool local
	:CZLockDown
	/if (${SpawnCount[PC radius ${MyRadius}]}>${MyPlayers}) {
		/if (!${holding}) {
			/echo [AHTools] Macro on hold due to player activity
			/varset holding 1
			}
		/delay 1s
		/goto :CZLockDown 
		} else { /varset holding 0 }
/return

Sub CheckGMs(int ECM, int ECM2)
| This Macro uses MQ2GMCheck. Example /call CheckGMs 3 1 would pause the
| macro if a GM is online and if a GM comes into the zone it will unload MQ2.
| If there are any GM's on it will effectively pause the macro (by going back
| to the MainLoop. Make sure the /call CheckGMs is the first thing in your loop.
/call PluginCheck MQ2GMCheck
/declare holding bool local
	:GMLockDown
	/if (${SpawnCount[GM]}>=1) {
			/if (${ECM}=1) {
				/if (!${holding}) /multiline ; /call SOS ; /echo [AHTools] Macro on hold due to GM Presence ; /varset holding 1
				/goto :GMLockDown
				} else {
				/varset holding 0
				}
			/if (${ECM}=2) /multiline ; /echo [AHTools] Ending Macro due to GM Presence ; /endmacro
			/if (${ECM}=3) /multiline ; /echo [AHTools] Unloading MQ2 due to GM Presence; /unload
			/if (${ECM}=4) /multiline ; /echo [AHTools] Quitting out of EQ due to GM Presence ; /quit
		}
	/if (${GMCheck}) {
		/if (${ECM2}=1) {
			/if (!${holding}) /multiline; /echo [AHTools] Macro on hold due to GM Activity
			/goto :GMLockDown
			}
		/if (${ECM2}=2) /multiline ; /echo [AHTools[ Ending Macro due to GM Activity ; /endmacro
	}
/return

Sub PluginCheck(string PluginName)
| /call PluginCheck MQ2Cast for example. Should be called before the main
| loop for peformance sake. Once you're running the macro you probably wont
| be unloading plugins.
	/if (!${Plugin[${PluginName}].Name.Equal[${PluginName}]}) {
		/echo This macro requires the ${PluginName} plugin!
		/echo You can enable this by typing /plugin ${PluginName}
		/echo To remove later on type /plugin ${PluginName} unload
		/endmacro
	}
/return
 

Attachments

Last edited by a moderator:
Checking for other players is key. Checking for GMs is almost worthless, unless your ultra unlucky and zones into your zone for something else, but all the macros I run are in REMOTE zones so its pointless for me.

I dig the SOS subroutine, and may use this some. Thanks for the upload redcent to you.
 
can you give me an example of where and how i would use checkzone? specifically in a macro that is in a low level zone warping around and killing stuff :)
 
can you give me an example of where and how i would use checkzone? specifically in a macro that is in a low level zone warping around and killing stuff :)

Rich (BB code):
target.mac

#include AHTools.inc

Sub Main

:MainLoop
	/call CheckGMs 1 1
	/call CheckZone 1 10000
	/target npc 1 20
	/warp t
	/goto :MainLoop
/return

That's the bare bones of macro that would warp to the nearest target that's level 1-20
 
Last edited:
Fyi this just saved me from getting banned/suspended today ty.
 
Yeah I dont know whats causing the varset thing it works fine for me...

Also for real it helped you not get banned. That's pretty cool. What happened a GM zone in on you :D
 
i had it quit from the gm check today too... but is it checking at the server level or zone level?
 
i had it quit from the gm check today too... but is it checking at the server level or zone level?

I believe it only checks at zone level... I was able to confirm this as ${CheckGM} returns false when there is a GM online but not in the zone but it returns TRUE when there is a GM online and in the zone with you (tested this in GL/PoK where GMs like to hang out)
 
I meant to make this a sticky a while back but forgot to. Great work
 
updated target.mac from Redguides ;-)


Rich (BB code):
| This macro made for www.Redguides.com
| Don't steal it or we'll punch your fase!
#turbo  
#event camp "personingroup tells the group, 'lets roll'  
#event dzadd "personyouwanttoadd tells you, 'add me'  
#event invite "#*#invites you to join#*#"  
#Event Zoned "#*#You have entered#*#"  
#include AHTools.inc
  
Sub Main  
  
    
:loopstart 
/doevents  
/call CheckGMs 1 1
/call CheckZone 3 10000
/if (${Target.Level}>67) /tar npc next 
/if (${Target.Distance}>220) /keypress esc  
/if (${Target.ID}==FALSE) /tar NPC radius 220  
/delay 10
/pet attack  
/goto :loopstart  
/return  
  
  
 Sub event_camp  
 /sit  
 /camp desk  
 /return  
  
 sub event_zoned  
 /delay 5s  
 /sit  
 /camp desk  
 /endmac 
 /return  

 sub event_dzadd 
 /dzadd personyouwanttoadd 
 /return

I have three toons in the zone so thats why
/call CheckZone 3 1000

I still need to zone in another toon to check it out, but you get the idea. Great inc file!

Tested and works but get Chatwindow spam about holding var.
 
What if the GM is using GM invis / not showing up on /who etc? can these still detect them?
 
yeah, it doens't do any harm to have the check, but it's not in anyway reliable. The PC detection kicks ass though.
 
I just noticed that the inc file isn't checking for the plugin. I think the command below needs be somewhere in Sub CheckGMs(int ECM, int ECM2) so it checks the plugin if you use the GM checking feature.

Rich (BB code):
/call PluginCheck MQ2GMCheck

Rich (BB code):
Sub CheckGMs(int ECM, int ECM2)
| This Macro uses MQ2GMCheck. Example /call CheckGMs 3 1 would pause the
| macro if a GM is online and if a GM comes into the zone it will unload MQ2.
| If there are any GM's on it will effectively pause the macro (by going back
| to the MainLoop. Make sure the /call CheckGMs is the first thing in your loop.
/call PluginCheck MQ2GMCheck
	:GMLockDown
	/if (${SpawnCount[GM]}>=1) {
			/if (${ECM}=1) {
				/if (!${holding}) /multiline ; /call SOS ; /echo [AHTools] Macro on hold due to GM Presence ; /varset holding 1
				/goto :GMLockDown
				} else {
				/varset holding 0
				}
			/if (${ECM}=2) /multiline ; /echo [AHTools] Ending Macro due to GM Presence ; /endmacro
			/if (${ECM}=3) /multiline ; /echo [AHTools] Unloading MQ2 due to GM Presence; /unload
			/if (${ECM}=4) /multiline ; /echo [AHTools] Quitting out of EQ due to GM Presence ; /quit
		}
	/if (${GMCheck}) {
		/if (${ECM2}=1) {
			/if (!${holding}) /multiline; /echo [AHTools] Macro on hold due to GM Activity
			/goto :GMLockDown
			}
		/if (${ECM2}=2) /multiline ; /echo [AHTools[ Ending Macro due to GM Activity ; /endmacro
	}
/return

This is a good a little inc file
 
Last edited:
Came across another error with /declare holding bool outer. Since an inc file is brought into the macro before the Sub Main you cannot /declare any variables out side of sub routines in the inc file.

Rich (BB code):
| ---------------------------------------------------------------------------
| AHTools.mac by AnonymousHero
| This is not actually a macro but a file that can be #include'd into other
| existing macros to do different checks.
| ---------------------------------------------------------------------------
/declare holding bool outer
| holding variable will be used primarily for things that should only be
| triggered once.

Causes an error /varset failed, variable 'holding' not found

To correct I just moved the declares inside the beginning each of the sub routines and made them local. So the macro invokes/forgets them on enter/exit of the sub routines

Rich (BB code):
/declare holding bool local
Here is the complete inc file with the minor changes.
Rich (BB code):
| ---------------------------------------------------------------------------
| AHTools.inc by AnonymousHero
| This is not actually a macro but a file that can be #included into other
| existing macros to do different checks.
| ---------------------------------------------------------------------------
| holding variable will be used primarily for things that should only be
| triggered once.

Sub SOS
| Used to beep out SOS in Morse code to get the attention of the person near
| the computer while the macro is running. Used in CheckGMs when a GM
| is detected in the zone.
	/beep
	/delay 1
	/beep
	/delay 1
	/beep
	/delay 5
	/beep
	/delay 5
	/beep
	/delay 5
	/beep
	/delay 5
	/beep
	/delay 1
	/beep
	/delay 1
	/beep
/return

Sub CheckZone(int MyPlayers, int MyRadius)
| If you have 3 toons in your group then you will set MyPlayers in your macro
| to 3. If it detects a 4th toon in your specified radius then it will put
| the macro on pause by continuing to check if players are in the radius and
| resume the macro when the player has left the area. If you want it to be
| zone wide just punch in MyRadius as like 10000 or 100000. A number of
| about 200-300 could be used in large zones if you are not worried.
/declare holding bool local
	:CZLockDown
	/if (${SpawnCount[PC radius ${MyRadius}]}>${MyPlayers}) {
		/if (!${holding}) {
			/echo [AHTools] Macro on hold due to player activity
			/varset holding 1
			}
		/delay 1s
		/goto :CZLockDown 
		} else { /varset holding 0 }
/return

Sub CheckGMs(int ECM, int ECM2)
| This Macro uses MQ2GMCheck. Example /call CheckGMs 3 1 would pause the
| macro if a GM is online and if a GM comes into the zone it will unload MQ2.
| If there are any GM's on it will effectively pause the macro (by going back
| to the MainLoop. Make sure the /call CheckGMs is the first thing in your loop.
/call PluginCheck MQ2GMCheck
/declare holding bool local
	:GMLockDown
	/if (${SpawnCount[GM]}>=1) {
			/if (${ECM}=1) {
				/if (!${holding}) /multiline ; /call SOS ; /echo [AHTools] Macro on hold due to GM Presence ; /varset holding 1
				/goto :GMLockDown
				} else {
				/varset holding 0
				}
			/if (${ECM}=2) /multiline ; /echo [AHTools] Ending Macro due to GM Presence ; /endmacro
			/if (${ECM}=3) /multiline ; /echo [AHTools] Unloading MQ2 due to GM Presence; /unload
			/if (${ECM}=4) /multiline ; /echo [AHTools] Quitting out of EQ due to GM Presence ; /quit
		}
	/if (${GMCheck}) {
		/if (${ECM2}=1) {
			/if (!${holding}) /multiline; /echo [AHTools] Macro on hold due to GM Activity
			/goto :GMLockDown
			}
		/if (${ECM2}=2) /multiline ; /echo [AHTools[ Ending Macro due to GM Activity ; /endmacro
	}
/return

Sub PluginCheck(string PluginName)
| /call PluginCheck MQ2Cast for example. Should be called before the main
| loop for peformance sake. Once you're running the macro you probably wont
| be unloading plugins.
	/if (!${Plugin[${PluginName}].Name.Equal[${PluginName}]}) {
		/echo This macro requires the ${PluginName} plugin!
		/echo You can enable this by typing /plugin ${PluginName}
		/echo To remove later on type /plugin ${PluginName} unload
		/endmacro
	}
/return
 
Thanks Maskoi for fixing the mistakes I made... It's been a while since I've been actively working on MQ2 stuff. If you want to just take it and throw it in the compile package go ahead :) consider it a contribution to Redguides :)
 
Can someone please explain how to make this work with KISS. I understand the part about adding "#include AHTools.inc " to the top of KISS but how/where do I set the "MyPlayers" variable? I tried to use AFKTools within KISS to do this but doesn't yet have a friends section for PCs outside the group. Thanks.
 
This was already integrated into Kiss. Also we have a new plugin that will be used in the next version of kiss as well that replaces the player detect version.
 
This was already integrated into Kiss.

I not following you. Are you referring to the AFKTools functionality in the existing KISS or that AHTools is there as well? I don't see the include line in KISS.

I added the AHTools.inc file to my macro directoy the added #include AHTools.inc to KISS. I then edited the AHTools.inc file and changed ..

Sub CheckZone(int MyPlayers, int MyRadius)

to

Sub CheckZone(int 1, int 300)

Did I do this correctly? Can I verify the include file is working from the console cli? Thanks for helping with my questions.
 
That won't work. You are screwing with parameters sent to the sub.

Rich (BB code):
Sub CheckZone(int MyPlayers, int MyRadius)

to

Sub CheckZone(int 1, int 300)
you want to send the info to the sub like so

Rich (BB code):
/call CheckZone 1 300
 
With the include in KISS, I enter /call CheckZone 1 300 on the cli and get "Flow ran into another subroutine" and KISS quits. Unless I'm doing something wrong, I'm going to just wait for when KISS includes these features.
 
I am adding a much better system based on mq2posse that allows you to create a list with all friends instead of just detecting pc out of group. I wil post it sometime next week.
 
For all intents and purposes AHTools is inferior to the new mq2posse that Maskoi is working on. I can already see the potential. I mean having the option to have global friends lists, check friends vs unknowns, etc... is a huge boost up from a check of x PC's in a given radius which was my method. Gives a whole lot more granularity to make your macros more safe.

I'm glad the idea of protecting your AFK macroing turned into something completely awesome.
 
MQ2Posse is working and in the latest compile. It was built to be completely integrated with macros.

You could easily update AFKtools to use it

MQ2Posse :: v1.01 :: by Sym for RedGuides.com
Rich (BB code):
/posse :: Lists command syntax
/posse on|off :: Toggles checking of new pc's. Default is OFF
/posse status :: Shows the current status and settings
/posse load :: Loads ini file.
/posse save :: Saves settings to ini. Changes DO NOT auto save.
/posse add NAME :: Adds NAME to friendly list.
/posse del NAME :: Deletes NAME from friendly list
/posse clear :: Clears all char names.
/posse radius # :: Sets check radius to # (ex: /posse radius 300).
/posse list :: Lists current names and commands.
/posse notify on|off :: Toggles notification alerts. Default is ON.
/posse friendnotify on|off :: Toggles notification alerts for friends. Default is ON.
/posse strangernotify on|off :: Toggles notification alerts for strangers. Default is ON.
/posse guild on|off :: Toggles ignoring guild members, meaning guild members are invisible to all checks. Default is OFF.
/posse audio on|off :: Toggles audio alerts for strangers. Default is OFF.
/posse testaudio :: Test plays the audio alert.
/posse cmdadd "COMMAND" :: Adds COMMAND that is executed when a stranger is near
/posse cmddel # :: Deletes a command that is executed when a stranger is near
 
TLOs
${Posse.Status} :: Returns enabled status as true/false
${Posse.Radius} :: Returns size of check radius
${Posse.Count} :: Returns how many total people in radius
${Posse.Friends} :: Returns how many friends are in radius
${Posse.Strangers} :: Returns how many strangers are in radius
 
Actually if you update AHTools to use MQ2Posse I will just incorporate it into Kiss. Save me the trouble of rewriting my gimp afk section
 
AHTools.inc <- Macro Safety Tools

Users who are viewing this thread

Back
Top
Cart