Guide New AFK SAFETY Snippet, fast clean and powerful!!

KingArthur

AutoBots
Joined
Dec 15, 2009
Messages
525
Reaction score
31
Points
28
I'm going to share the snippet I wrote in my own macros that does the AFK SAFETY for me.

You can use this snippet wisely then easily incorporated the code into your own PULLER MACROS.

You will need a little macro knowledge to get this work(1-2mins), I will explain how it works too.

The basic desire for these is the existing AFK SAFETY plugin in both sides though support Friends List/ Guild (but not a guild list)/Radius(of course)/Command/TLO.

But once you end a macro or even pause it by /mqp on, you will need other method(downshit/holyshit/MQ2Events) to make it RESUME to work once the stranger leaves.

With my code, you can:

1. Make your own friends list
2. Make your own friendly guild list
3. Make your own PCCheck Radius
4. Make your own Method to handle what you will do when Stranger is near, you can either:
(1) Pause but not by /mqp on(that will pause all your macro code been processed)
(2) Change your PullOrder to Guard/Assist/MinPull, which if you incorporated this with your macro correctly, it will:
(i) Guard mode will grab anything in your XTarget(ie, anything you got aggro), so you won't wipe if you suddenly pause your move when some stranger near
(ii) Assist mode will assist your MA.
(iii) MinPull mode you will still pull but with a different(usually much smaller but can set by you) MobRadius/ZRadius.
(3) Right After the stranger leaves, your PullOrder will back the normal setting, your puller will automatic GET BACK TO WORK immediately.


How to use it:
(1) In the very top of your puller macro, add this line:
Code:
   #include PigAfkTool.inc
(2) In the beginning of your puller macro, where you should declare bunches of stuff, you add this line:
Code:
   /call PigAFKDeclare
   /call FriendsLoad
(3) This step is essential.
BEFORE your pull routine, add this line:
Code:
   /call FriendsCheck
  /if (${PullOrder.Equal[NORMAL]}) {
  [B]
     HERE PUT IN YOUR WHOLE PULL ROUTINE[/B]

     }

Voila, now you are using these pure passive but extremely fast and powerful AFK TOOLS to protect your crews.

Pro tips: Still, Do not afk in open zones, use instance flipping macros which only the coolest PRO do.

Enough for the shit talk, here is the code:

Don't Forget to change the YourMacroName in the INC file to your actual marco name so the ${iniName} is right~
Then check ini and setup whatever you like!


Code:
#event SetVar  "[MQ2] set: #1# #2# #3#"

Sub PigAFKDeclare
|===Change YourMacroName!!===|
/declare iniName string outer YourMacroName_${Me.Name}.ini
|====General Declares, you don't need these if you already declared in your own macro====|
/declare PullOrder string outer
/declare MobRadius int outer
/declare ZRadius int outer
/declare MaMode int outer
/declare DPSMode int outer
/declare AssistAt int outer
|======Friend List=====|
/declare StrangerOn int outer 0
/declare FCBCAnnouncedEnter int outer 0
/declare FCBCAnnouncedLeave int outer 0
/declare PCTotal int outer
/Call DeclareIniVar2 PauseOnStrangerCorpse int FriendsCheck 1
/Call DeclareIniVar2 DoCorpseCheck int FriendsCheck 1
/Call DeclareIniVar2 CorpseCheckRadius int FriendsCheck 200
/Call DeclareIniVar2 DoFriendsCheck int FriendsCheck 0 /dofriendscheck
/Call DeclareIniVar2 IgnoreSafeGuild int FriendsCheck 1
/Call DeclareIniVar2 FriendsList string FriendsCheck
/Call DeclareIniVar2 SafeGuildList string FriendsCheck
/varset FriendsList ${Ini[${iniName},"FriendsCheck","FriendsList"]}
/varset SafeGuildList ${Ini[${iniName},"FriendsCheck","SafeGuildList"]}
/Call DeclareIniVar2 PCCheckRadius int FriendsCheck 600 /pccheckradius
/Call DeclareIniVar2 PCCheckZRadius int FriendsCheck 50
/Call DeclareIniVar2 CheckPCTimer timer FriendsCheck
/Call DeclareIniVar2 WaitPcLeaveTime int FriendsCheck 30
|==============PCSafety Option===|
 /declare OriginPullOrder string outer
 /declare OriginMobRadius string outer
 /declare OriginMobZRadius string outer
 /declare SafePC int outer
 /call  DeclareIniVar2 PCSafetyMode string PCSafety "Guard" /pcmode
 /call  DeclareIniVar2 MinPullRadius int PCSafety 100 /mpradius
 /call  DeclareIniVar2 MinPullZRadius int PCSafety 20 /mpzraidus
/return

Sub FriendsLoad
/declare FriendsTotal int local
/declare SafeGuildTotal int local
/declare fi int local
/declare sfg int local
/varset fi 1
/varset sfg 1
:filoop
/if (${FriendsList.Arg[${fi},,].Length}) {
     /varcalc fi ${fi}+1
     /goto :filoop
       }
/if (!${FriendsList.Arg[${fi},,].Length}) {
        /varcalc FriendsTotal ${fi}-1
        /echo Now ${FriendsTotal} friends been add to friends list!
       }
:sfgloop
/if (${SafeGuildList.Arg[${sfg},,].Length}) {
     /varcalc sfg ${sfg}+1
     /goto :sfgloop
       }
/if (!${SafeGuildList.Arg[${sfg},,].Length}) {
        /varcalc SafeGuildTotal ${sfg}-1
        /echo Now ${SafeGuildTotal} guilds been add to safe guild list!
       }
/return

Sub FriendsCheck
/varset SafePC 0
/if (!${Defined[pi]}) /declare pi int outer
|/if ((!${SpawnCount[pccorpse radius ${CorpseCheckRadius}]}&&${SpawnCount[pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}]}<=${NumberOfBoxToons})||${SpawnCount[pccorpse radius ${CorpseCheckRadius}]}||${Me.XTarget}||${Me.CombatState.Equal[Combat]}) /return
/if (!${Me.XTarget} && !${Me.CombatState.Equal[Combat]}) {
:comparefriends
 /varset CurrentSub CompareFriends
 /varset PCTotal ${SpawnCount[pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}]}
 /for pi ${PCTotal} downto 1
   /if (!${StrangerOn}&&${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].ID}!=${Me.ID}&&(${Spawn[gm].ID}||(!${IgnoreSafeGuild} && !${FriendsList.Find[${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].Name}]})||(${IgnoreSafeGuild} && !${SafeGuildList.Find[${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].Guild}]} && !${FriendsList.Find[${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].Name}]}))) {
        /varset StrangerOn 1
        /varset FCBCAnnouncedLeave 0
        /varset CheckPCTimer ${CheckPCTimer.OriginalValue}
		/if (${StrangerOn}) {
		  /if (!${FCBCAnnouncedEnter}) /bc [+y+] We've found a stranger in ${PCCheckRadius}ft, Name is ${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].Name}.
		  /varset OriginPullOrder ${PullOrder}
		  /varset OriginMobRadius ${MobRadius}
		  /varset OriginMobZRadius ${ZRadius}
		  /if (${PCSafetyMode.Equal[Guard]}) {
		       /doevents
		       /varset PullOrder Guard
			   /if (!${FCBCAnnouncedEnter}) /bc Now Guard Mode on, will grab anything on XTarget if there is any.
			   |/call PigLeash
			   /varset FCBCAnnouncedEnter 1
			   /return
		     }
		  /if (${PCSafetyMode.Equal[MinPull]}) {
		      /doevents
			  /varset PullOrder MinPull
			  /varset MobRadius ${MinPullRadius}
			  /varset ZRadius ${MinPullZRadius}
			  |/call PigLeash
			  /if (!${FCBCAnnouncedEnter}) /bc Now Minor Pull Mode on, pull radius is ${MobRadius} Zradius is ${ZRadius}
			  /varset FCBCAnnouncedEnter 1
			  /return
		      }
		  /if (${PCSafetyMode.Equal[Assist]}) {
		      /doevents
			  /varset PullOrder Assist
			  /varst MaMode 0
			  /varset DPSMode 1
			  /varset AssistAt 101
			  |/call PigLeash
			  /if (!${FCBCAnnouncedEnter}) /bc Now Pure Assist Mode On, assist ${MainAssist} in ${AssistDistance}ft
			  /varset FCBCAnnouncedEnter 1
		      /return
		   }
		  /if (${PCSafetyMode.Equal[Pause]}) {
               /if (!${FCBCAnnouncedEnter}) /bc Pause Mode on, will delay ${Int[${CheckPCTimer}/10]} secs to check again!
		      :WaitPCLeave
              /varset CurrentSub WaitPCLeave
			  /doevents
              |/call PigLeash
              /if (${Me.XTarget} || ${Me.CombatState.Equal[Combat]}) /return
              /delay ${WaitPcLeaveTime}s
              /if (${CheckPCTimer}) /goto :WaitPCLeave
              /if (!${CheckPCTimer}) /goto :comparefriends
		  }
		}
        }
   /if (${StrangerOn}&&!${Spawn[gm].ID} && (${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].ID}==${Me.ID}||${FriendsList.Find[${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].Name}]}||(${IgnoreSafeGuild} && ${SafeGuildList.Find[${NearestSpawn[${pi},pc radius ${PCCheckRadius} zradius ${PCCheckZRadius}].Guild}]}))) {
          /doevents
		  /varcalc SafePC ${SafePC}+1
		  /if (${pi}==1&&${SafePC}==${PCTotal}) {
		   /echo  SafePC is ${SafePC}
		  /varset StrangerOn 0
		  /varset PullOrder ${OriginPullOrder}
		  /varset MobRadius ${OriginMobRadius}
		  /varset ZRadius ${OriginMobZRadius}
          /varset MaMode 1
	      /varset DpsMode 0
          /varset FCBCAnnouncedEnter 0
          /if (!${StrangerOn}&&!${FCBCAnnouncedLeave}) /bc No Strangers near in ${PCCheckRadius}ft, Let's get back to work!
          |/doevents FCBCAnnouncedLeave
          /varset FCBCAnnouncedLeave 1
          /break
		  }
          }
   /next pi
}
/return

Sub DeclareIniVar2(string name,string varType,string section,string value,string alias)
/if ( !${Defined[${name}]} ) /declare ${name} ${varType} outer
/varset ${name} ${Ini[${iniName},${section},${name.Left[1].Upper}${name.Right[-1]},"${value}"]}
/ini "${iniName}" "${section}" "${name.Left[1].Upper}${name.Right[-1]}" "${${name}}"
/if (${Defined[alias]}) /squelch /alias ${alias} /echo set: ${name} ${section}
/return

Sub Event_SetVar(string line,string varName,string section,string value) 
/if ( ${value.Equal[on]} ) /varset value 1
/if ( ${value.Equal[off]} ) /varset value 0
/if ( ${value.Equal[TRUE]} ) /varset value TRUE
/if ( ${value.Equal[FALSE]} ) /varset value FALSE
     /varset ${varName} ${value}
     /popup ${varName} in section ${section} set to ${value} now.
     /ini "${iniName}" ${section} "${varName.Left[1].Upper}${varName.Right[-1]}" "${value}"
/return

Here is the inc file you can direct download:
 

Attachments

  • PigAFKTool.inc
    7.3 KB · Views: 18
Last edited: