• 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

Defense.INC

Warl0ck45

Well-known member
Joined
Jan 31, 2014
RedCents
8,554¢
Was updating some shared timing discipline issues with my tank defense include file, and figured"heck, you talk about it enough, might as well post it!" (this is currently set up for SK/War/Pal) Could not find it with search, and not sure if I posted it before. If this is a duplicate, feel free to wipe it =)

Basically the thinking behind this is that we have something to poke all the Melee buttons for attack, but nothing for defense. The aim of this file is to fire off defensive meausures in a preset order. It checks if the lowest rendition of X line of AA is available (For instance "${Me.CombatAbilityReady[${Spell[Defensive Discipline].RankName}") and if so (and other conditions met of course) then it checks for the highest rendition of that Disc line available and fires it off (which would be "Last Stand" to follow the example) In this manner I only need to update when there are new AA/Discs, and then only the one time... then the various tanks I abuse are all updated for X class.

Then when that is unavailable, and the combat window is empty (the disc has run it's course) , fires off the next one. Rinse and Repeat.

When there are no disc's available, starts in on AA/Items until everything is exhausted (provided the fight lasted that long of course)

If someone can find use in it, feel free. If you have suggestion, I am all ears.

Been using this for a while now. It ain't perfect, it ain't fancy or elegant, but it works for me most times. As you can see from the example I put a call for this in the "if the target is named... or if thee are 3+ mobs in camp" Elsewhere I also have it call defense if the tanks HP's drop too far.

What ever you can dream up as a reason for your tank to start popping defensive stuff, you can set up to call this. Or heck, edit it to do the order you prefer! =)

__________________________
Updated to latest version. Still under testing:

Paladin section tested and working. Updated changes to that section 9-23-16
SK section tested and working. Updated changes to that section 9-23-16
War section tentatively tested, no changes needed. 9-23-16.

Please let me know if you find any issues =)
----------------------------

Updated for RoS

Rich (BB code):
|	Defense.inc V2.1
|	Updated 17-12-17
|
|	 NecroGnomie:
|		This include is ment to help automate defensive measures for various classes. There is no INI file to go with this,
|			this is simply my version of what each class ought to be doing as each line of defense goes down. 
|			Currently set up for use with AA, disc's, and BP clicks up to level 110.
|			What this means is the include file should detect what disc/AA you have and click on it as "/call Defense" is activated. 
|			It checks if the lowest versionof X line is available (no timer) And then starts with the highest version and works it's
|			way down the list for that line, until it finds the highest rendition the toon has, and activates it.
|		
|
|	Someplace in your main loop put some sort of call, for example:
|		"/if (!${Me.ActiveDisc.ID} && ${Me.CombatState.Equal[COMBAT]} && ${Select[${Me.Class.ShortName},WAR,PAL,SHD]} && (${Target.Named} || ${Me.XTarget}>2 || ${Me.PctHPs}<60) || ${Target.Distance}<75) /call Defense"
|
|	Requires:
|	Spell_Routines.inc
|	
|
|	This is set up to work with RaidDruid.mac, so it utlizes a ${ChatChannel} to make announcements. It also uses a message sub similiar to:
|
|	Sub AnnounceMessage(Channel, EventTotal, Color1, Event1, Color2, Event2, Color3, Event3, Color4, Event4, Color5, Event5,)
|		/if (${Channel.Equal[BC]} && ${EventTotal.Equal[1]}) /BC [+${Color1}+] ${Event1}
|		/if (${Channel.Equal[BC]} && ${EventTotal.Equal[2]}) /BC [+${Color1}+] ${Event1} [+${Color2}+] ${Event2}
|		/if (${Channel.Equal[BC]} && ${EventTotal.Equal[3]}) /BC [+${Color1}+] ${Event1} [+${Color2}+] ${Event2} [+${Color3}+] ${Event3}
|		/if (${Channel.Equal[BC]} && ${EventTotal.Equal[4]}) /BC [+${Color1}+] ${Event1} [+${Color2}+] ${Event2} [+${Color3}+] ${Event3} [+${Color4}+] ${Event4}
|		/if (${Channel.Equal[BC]} && ${EventTotal.Equal[5]}) /BC [+${Color1}+] ${Event1} [+${Color2}+] ${Event2} [+${Color3}+] ${Event3} [+${Color4}+] ${Event4} ${Event5}
|		/if (${Channel.NotEqual[BC]} && ${EventTotal.Equal[1]}) /${Channel} ${Event1}
|		/if (${Channel.NotEqual[BC]} && ${EventTotal.Equal[2]}) /${Channel} ${Event1} ${Event2} 
|		/if (${Channel.NotEqual[BC]} && ${EventTotal.Equal[3]}) /${Channel} ${Event1} ${Event2} ${Event3} 
|		/if (${Channel.NotEqual[BC]} && ${EventTotal.Equal[4]}) /${Channel} ${Event1} ${Event2} ${Event3} ${Event4}
|		/if (${Channel.NotEqual[BC]} && ${EventTotal.Equal[5]}) /${Channel} ${Event1} ${Event2} ${Event3} ${Event4} ${Event5}
|		/return
|
|	In RD type in "/reportdefense" to toggle, else add the declare to your current macro.
|		EX: /declare ReportDefense 		bool 	outer
|
|		If Defense.inc finds no "ReportDefense" variable, it will make one and default it to FALSE
|		If Defense.inc finds no "ChatChannel" variable, it will make one and default it to Echo
|_________________________________________________
	
Sub Defense
	/if (!${Defined[ReportDefense]}) /declare ReportDefense bool outer FALSE
	/if (!${Defined[ChatChannel]}) /declare ChatChannel string outer echo
	/if (${Me.Class.ShortName.Equal[WAR]}) /call WarDefense
	/if (${Me.Class.ShortName.Equal[PAL]}) /call PalDefense
	/if (${Me.Class.ShortName.Equal[SHD]}) /call SKDefense
	/return

Sub WarDefense
	/if (!${Me.ActiveDisc.ID}) {
		/if (${Me.PctEndurance}>5) {
			/if (${Me.CombatAbilityReady[${Spell[Dichotomic Shield].RankName}]}) {
				/disc ${Spell[${Spell[Dichotomic Shield].RankName}].ID}
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Dichotomic Shield" r "Active"
				/return		
				}
			/if (!${Me.CombatAbilityReady[${Spell[Dichotomic Shield].RankName}]}) {
				/if (${Me.CombatAbilityReady[${Spell[Defensive Discipline].RankName}]}) {
					/if (${Spell[${Spell[Culminating Stand Discipline].RankName}].ID}) {
						/disc ${Spell[Culminating Stand Discipline].RankName}
						/goto :WARStandEnd
						}
					/if (${Spell[${Spell[Last Stand Discipline].RankName}].ID}) {
						/disc ${Spell[Last Stand Discipline].RankName}
						/goto :WARStandEnd
						}
					/if (${Spell[${Spell[Final Stand Discipline].RankName}].ID}) {
						/disc ${Spell[Final Stand Discipline].RankName}
						/goto :WARStandEnd
						}
					/if (${Spell[${Spell[Defensive Discipline].RankName}].ID}) {
						/disc ${Spell[Defensive Discipline].RankName}
						/goto :WARStandEnd
						}						
					:WARStandEnd
					/if (${ReportDefense}) /call AnnounceMessage 2 y "Stand Discipline" r "Active"
					/return
					}
				}
			}
		/if (${Cast.Ready[${Me.Inventory[chest]}]}) {
			/call Cast "${Me.Inventory[chest]}" Item		
			/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Clicking BP" r "Active"!
			/return
			}
		/if (${Me.CombatAbilityReady[${Spell[No Time To Bleed].RankName}]} && !${Me.CombatAbilityReady[${Spell[Defensive Discipline].RankName}]} && !${Me.CombatAbilityReady[${Spell[Dichotomic Shield].RankName}]}) {
			/if (${Me.CombatAbilityReady[${Spell[Pain Doesn't Hurt].RankName}]}) {
				/disc ${Spell[${Spell[Pain Doesn't Hurt].RankName}].ID}
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Pain Doesn't Hurt" r "Active"
				/return
				}
			/if (${Me.CombatAbilityReady[${Spell[No Time To Bleed].RankName}]}) {
				/disc ${Spell[${Spell[No Time To Bleed].RankName}].ID}
				/if (${ReportDefense}) /call AnnounceMessage 2 y "No Time To Bleed" r "Active"
				/return
				}
			}
		/if (!${Me.CombatAbilityReady[${Spell[No Time To Bleed].RankName}]} && !${Me.CombatAbilityReady[${Spell[Defensive Discipline].RankName}]} && ${Me.CombatAbilityReady[${Spell[Armor of Draconic Runes].RankName}]} && ${Me.PctEndurance}>5) {
			/if (${Spell[${Spell[Armor of Tenacious Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Tenacious Runes].RankName}
				/goto :WARRuneEnd
				}
			/if (${Spell[${Spell[Armor of Darkened Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Darkened Runes].RankName}
				/goto :WARRuneEnd
				}
			/if (${Spell[${Spell[Armor of Stalwart Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Stalwart Runes].RankName}
				/goto :WARRuneEnd
				}
			/if (${Spell[${Spell[Armor of Mystical Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Mystical Runes].RankName}
				/goto :WARRuneEnd
				}
			/if (${Spell[${Spell[Armor of Phantasmic Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Phantasmic Runes].RankName}
				/goto :WARRuneEnd
				}
			/if (${Spell[${Spell[Armor of Timeworn Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Timeworn Runes].RankName}
				/goto :WARRuneEnd
				}
			/if (${Spell[${Spell[Armor of Draconic Runes].RankName}].ID}) {
				/disc ${Spell[Armor of Draconic Runes].RankName}
				/goto :WARRuneEnd
				}				
			:WARRuneEnd
			/if (${ReportDefense}) /call AnnounceMessage 2 y "Runes Discipline" r "Active"
			/return
			}			
		/if (!${Me.CombatAbilityReady[${Spell[No Time To Bleed].RankName}]} && !${Me.CombatAbilityReady[${Spell[Defensive Discipline].RankName}]} && ${Window[CombatAbilityWnd].Child[CAW_CombatEffectLabel].Text.Equal[No Effect]}) {
			/if (${Me.AltAbilityReady[Warlord's Bravery]}) {
				/call Cast "Warlord's Bravery" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Warlord's_Bravery" r "Active"
				/return	
				}
			/if (${Me.AltAbilityReady[Warlord's Tenacity]}) {
				/call Cast "Warlord's Tenacity" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Warlords_Tenacity" r "Active"
				/return	
				}				
			/if (${Me.AltAbilityReady[Brace for Impact]}) {
				/call Cast "Brace for Impact" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Brace_For_Impact" r "Active"		
				/return	
				}				
			/if (${Me.AltAbilityReady[Armor of Experience]}) {
				/call Cast "Armor of Experience" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Armor_of_Experience" r "Active"
				/return			
				}				
			/if (${Me.AltAbilityReady[Fundament: Third Spire of the Warlord]}) {
				/call Cast "Fundament: Third Spire of the Warlord" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Third_Spire" r "Active"
				/return			
				}				
			}			
		/if (${Me.AltAbilityReady[Blade Guardian]}) {
			/call Cast "Blade Guardian" ALT
			/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Blade Guardian" r "Active"
			/return
			}	
		/if (${Me.AltAbilityReady[Hold the Line]}) {
			/call Cast "Hold the Line" ALT
			/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Hold_the_Line" r "Active"
			/return		
			} else {
			/if (${Me.AltAbilityReady[Resplendent Glory]}) {
				/call Cast "Resplendant Glory" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Respendant_Glory" r "Active"
				/return
				}
			}	
		/if (${Me.AltAbilityReady[Warlord's Resurgence]}) {
			/call Cast "Warlord's Resurgence" ALT
			/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Warlord's_Resurgence" r "Active"
			/return
			}
		}
	/return	

Sub PalDefense
	/if (!${Me.ActiveDisc.ID}) {
		/if (${Me.AltAbilityReady[Group Armor of the Inquisitor]}) {
			/call Cast "Group Armor of the Inquisitor" ALT
			/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Group Armor of the Inquisiton" r "Active"
			/return				
			}
		/if (${Me.PctEndurance}>5) {
			/if (${Me.CombatAbilityReady[${Spell[Holy Guardian Discipline].RankName}]}) {
				/if (${Spell[${Spell[Blessed Guardian Discipline].RankName}].ID}) {
					/disc ${Spell[${Spell[Blessed Guardian Discipline].RankName}].ID}
					} Else {
					/disc ${Spell[${Spell[Holy Guardian Discipline].RankName}].ID}
					}
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Guardian Discipline, Defense line 1" r "Active"
				/return				
				}
			/if (!${Me.CombatAbilityReady[${Spell[Holy Guardian Discipline].RankName}]} && ${Me.CombatAbilityReady[${Spell[Honorific Mantle].RankName}]}) {
				/if (${Spell[${Spell[Kar'Zok Mantle].RankName}].ID}) {
					/disc ${Spell[Kar'Zok Mantle].RankName}
					/goto :PALMantleEnd
					}
				/if (${Spell[${Spell[Skalber Mantle].RankName}].ID}) {
					/disc ${Spell[Skalber Mantle].RankName}
					/goto :PALMantleEnd
					}
				/if (${Spell[${Spell[Brightwing Mantle].RankName}].ID}) {
					/disc ${Spell[Brightwing Mantle].RankName}
					/goto :PALMantleEnd
					}
				/if (${Spell[${Spell[Prominent Mantle].RankName}].ID}) {
					/disc ${Spell[Prominent Mantle].RankName}
					/goto :PALMantleEnd
					}
				/if (${Spell[${Spell[Honorific Mantle].RankName}].ID}) {
					/disc ${Spell[Honorific Mantle].RankName}
					/goto :PALMantleEnd
					}
				/if (${Spell[${Spell[Armor of Endless Honor].RankName}].ID}) {
					/disc ${Spell[Armor of Endless Honor].RankName}
					/goto :PALMantleEnd
					}					
				:PALMantleEnd
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Mantle Discipline, Defense line 2" r "Active"	
				/return
				}
			/if (!${Me.CombatAbilityReady[${Spell[Honorific Mantle].RankName}]} && ${Me.CombatAbilityReady[${Spell[Armor of Courage].RankName}]}) {	
				/if (${Spell[${Spell[Armor of Mercy].RankName}].ID}) {
					/disc ${Spell[Armor of Mercy].RankName}
					/goto :PALArmorEnd
					}		
				/if (${Spell[${Spell[Devout Penitence].RankName}].ID}) {
					/disc ${Spell[Devout Penitence].RankName}
					/goto :PALArmorEnd
					}
				/if (${Spell[${Spell[Reverent Penitence].RankName}].ID}) {
					/disc ${Spell[Reverent Penitence].RankName}
					/goto :PALArmorEnd
					}
				/if (${Spell[${Spell[Armor of Zeal].RankName}].ID}) {
					/disc ${Spell[Armor of Zeal].RankName}
					/goto :PALArmorEnd
					}
				/if (${Spell[${Spell[Armor of Courage].RankName}].ID}) {
					/disc ${Spell[Armor of Courage].RankName}
					/goto :PALArmorEnd
					}		
				:PALArmorEnd
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Penitence Discipline, Defense line 3" r "Active"
				/return 		
				}
			}
		/if (!${Me.CombatAbilityReady[${Spell[Armor of Courage].RankName}]}) {
			/if (${Me.AltAbilityReady[Armor of Experience]}) {
				/call Cast "Armor of Experience" ALT
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Armor of Experience" r "Active"
				/return				
				}
			/if (${Me.AltAbilityReady[Fundament: Third Spire of Holiness]}) {
				/call Cast "Fundament: Third Spire of Holiness" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "First Spire" r "Active"
				/return			
				}
			}
	}
	/return

Sub SKDefense
	/if (!${Me.ActiveDisc.ID}) {
		/if (${Me.PctEndurance}>5) {
			/if (${Me.CombatAbilityReady[${Spell[Unholy Guardian Discipline].RankName}]}) {
				/if (${Spell[${Spell[Cursed Guardian Discipline].RankName}].ID}) {
					/disc ${Spell[${Spell[Cursed Guardian Discipline].RankName}].ID}
					} Else {
					/disc ${Spell[${Spell[Unholy Guardian Discipline].RankName}].ID}
					}
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Guardian Discipline, Defense line 1" r "Active"
				/return				
				}
			/if (!${Me.CombatAbilityReady[${Spell[Unholy Guardian Discipline].RankName}]} && ${Me.CombatAbilityReady[${Spell[Ichor Guard].RankName}]}) {
				/if (${Spell[${Spell[Krellnakor Mantle].RankName}].ID}) {
					/disc ${Spell[Krellnakor Mantle].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Doomscale Mantle].RankName}].ID}) {
					/disc ${Spell[Doomscale Mantle].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Bonebrood Mantle].RankName}].ID}) {
					/disc ${Spell[Bonebrood Mantle].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Gorgon Mantle].RankName}].ID}) {
					/disc ${Spell[Gorgon Mantle].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Malarian Mantle].RankName}].ID}) {
					/disc ${Spell[Malarian Mantle].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Umbral Carapace].RankName}].ID}) {
					/disc ${Spell[Umbral Carapace].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Soul Carapace].RankName}].ID}) {
					/disc ${Spell[Soul Carapace].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Soul Shield].RankName}].ID}) {
					/disc ${Spell[Soul Shield].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Soul Guard].RankName}].ID}) {
					/disc ${Spell[Soul Guard].RankName}
					/goto :SKMantleEnd
					}
				/if (${Spell[${Spell[Ichor Guard].RankName}].ID}) {
					/disc ${Spell[Ichor Guard].RankName}
					/goto :SKMantleEnd
					}					
				:SKMantleEnd
				/if (${ReportDefense}) /call AnnounceMessage 2 y "SK Mantle Defense, Defense line 2 r "Active"
				/return
				}
			/if (!${Me.CombatAbilityReady[${Spell[Ichor Guard].RankName}]} && ${Me.CombatAbilityReady[${Spell[Gorgon Carapace].RankName}]}) {	
				/if (${Spell[${Spell[Tylix's Carapace].RankName}].ID}) {
					/disc ${Spell[Tylix's Carapace].RankName}
					/goto :SKArmorEnd
					}
				/if (${Spell[${Spell[Vizat's Carapace].RankName}].ID}) {
					/disc ${Spell[Vizat's Carapace].RankName}
					/goto :SKArmorEnd
					}
				/if (${Spell[${Spell[Grelleth's Carapace].RankName}].ID}) {
					/disc ${Spell[Grelleth's Carapace].RankName}
					/goto :SKArmorEnd
					}
				/if (${Spell[${Spell[Sholothian Carapace].RankName}].ID}) {
					/disc ${Spell[Sholothian Carapace].RankName}
					/goto :SKArmorEnd
					}
				/if (${Spell[${Spell[Gorgon Carapace].RankName}].ID}) {
					/disc ${Spell[Gorgon Carapace].RankName}
					/goto :SKArmorEnd
					}					
				:SKArmorEnd
				/if (${ReportDefense}) /call AnnounceMessage 2 y "Carapace Discipline, Defense line 3" r "Active"
				/return				
				}
			}
		/if (!${Me.CombatAbilityReady[${Spell[Gorgon Mantle].RankName}]}) {
			/if (${Me.AltAbilityReady[Fundament: Third Spire of the Reaver]}) {
				/call Cast "Fundament: Third Spire of the Reaver" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Third Spire" r "Active"
				/return			
				}
			/if (!${Me.AltAbilityReady[Fundament: Third Spire of the Reaver]} && ${Me.AltAbilityReady[Armor of Experience]}) {
				/call Cast "Armor of Experience" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Armor of Experience"  r "Active"
				/return			
				}	
		}
	}
/return
 
Last edited:
So, for the novice, am I to assume that this is a macro, and I would create a file in my macro's file, aka /mac defense, and this will run? or is it something I would put in my toon's server.ini file? I am a player you usually plays my Sk while my bots do their job, but would be cool to run this in case I have an oh shit moment and cant fire off my disks fast enough
 
nice macro and will try when back after work but ... Etheric Legionnaire Breastplate : 2 N at legioNNaire !! :)
 
So, for the novice, am I to assume that this is a macro, and I would create a file in my macro's file, aka /mac defense, and this will run? or is it something I would put in my toon's server.ini file? I am a player you usually plays my Sk while my bots do their job, but would be cool to run this in case I have an oh shit moment and cant fire off my disks fast enough

No, this is an include file.

Think of it as an extension or plugin for macro files.

For instance if you open up say KissAssist, at the top you will see it has the entry "#include ninjadvloot.inc" which extends KA's abilities to include what is in the include file. This way you can have basic shared functions shared by multiple macros, with out having to re-write the entries every time there is a change to it inside every macro. There are a number of common include files floating around IE:

#include AAPurchase.inc
#include Ninjadvloot.inc
#include Spell_Routines.inc
#include wait4rez.inc
#include QuickBeg.inc

This is more for the folks who write the macros.

You will find a lot of the plugins have their roots in either macros or include files (for instance MQ2Cast, which is a plugin version of Spell_Routines.inc) After having to edit MQ2Melee a few times, and seeing it basically checked if you had X ability, then started at the top and worked it's way down to the highest level of X ability the toon had... figured it would make things easier to duplicate that in a defensive measure.

This way I just have the 1 file to update as needed, then the other macros I use that include this file, are subsequently updated when they next load up.
 
Last edited:
So, for the novice, am I to assume that this is a macro, and I would create a file in my macro's file, aka /mac defense, and this will run? or is it something I would put in my toon's server.ini file? I am a player you usually plays my Sk while my bots do their job, but would be cool to run this in case I have an oh shit moment and cant fire off my disks fast enough


They are like little containers that have specific function's inside so when called by macros the file knows what container to grab from :)
 
The Question then comes, for us computer illiterate moronic cave men that attempt to play and seem like we know something, HOW do we add this to our macros?
 
The Question then comes, for us computer illiterate moronic cave men that attempt to play and seem like we know something, HOW do we add this to our macros?

This is... one of those scary moments. You have to do some editing to your existing macro, which always has the possibility of borking something. If you are uncomfortable with that, better to get someone else to set it up. As noted, this is more for macro writers... but if you are comfortable giving this a go, feel free.

That said, this is relatively easy to set up. Will give it a try at explaining it, though the coffee ain't kicked in yet.

1.Make a back up of your macro! if all else fails, can always start fresh with the back up =D
2.Someplace at the top of your macro, before the Sub Main, you will want to add this as an include. Chances are there is already some there, just add this to the list , IE

Rich (BB code):
#include AAPurchase.inc
#include Ninjadvloot.inc
#include Spell_Routines.inc
#include wait4rez.inc
#include QuickBeg.inc
#include Defense.inc
#turbo 100
#CHAT BC
#CHAT CHAT
#chat RAIDSAY

#Event AddCombatSong  	"[MQ2] AddCombatSong #1#"
#Event AddAlert       	"[MQ2] AddAlert #1#"


this makes sure the file is loaded with the rest of the macro.

3. Add a call for the Sub routine where ever you want it (the main loop, the combat loop, what ever). Example:

Rich (BB code):
/if (${DoDefense} && ${Me.CombatState.Equal[COMBAT]} && ${Select[${Me.Class.ShortName},WAR,PAL,SHD]} && (${Target.Named} || ${Me.XTarget}>2 || (${Spawn[id ${MATarget}].Level}>=(${Me.Level}+2))) && ${Target.Distance}<75) /call Defense

this is the call I have in my main loop. You can put what ever kind of condition you want into the IF statement to justify calling the sub routine. In this case I have it set up as follows:

Rich (BB code):
${DoDefense}
= flag I made to turn calling the defense subroutine on and off (for times like when I am in a fight that will last longer then then 1 tank's defensives, so I bring 2-3 tanks.. and turn off defenseon the back ups... as tank1 exhausts his usefulness, I tell tank2 to activate his, and fade on tank 1... rinse and repeat)

Rich (BB code):
${Me.CombatState.Equal[COMBAT]}
= am I in a fight

Rich (BB code):
${Select[${Me.Class.ShortName},WAR,PAL,SHD]}
= am I a tank/one of the 3 classes

Rich (BB code):
(${Target.Named} || ${Me.XTarget}>2 || (${Spawn[id ${MATarget}].Level}>=(${Me.Level}+2))
enclosed section that only requires 1 part to be be true. A break down of it is:

Rich (BB code):
${Target.Named}
= is the target flagged as Named
Rich (BB code):
${Me.XTarget}>2
= are there more then 2 mobs on the extended target window
Rich (BB code):
(${Spawn[id ${MATarget}].Level}>=(${Me.Level}+2)
= The macro I am using for this example saves a Main Assist Target known as MATarget, this is checking that the main assist's target level is equal to or greater then the toons level
Rich (BB code):
${Target.Distance}<75
= is the target closer then 75 feet.

Rich (BB code):
/call Defense
And finally , if the IF statement equals true, then it calls the Defense subroutine.

4. This file makes announcements when activating stuff.
The file looks for a "ReportDefense" variable, if it doesn't find one defined, it will automatically declare one and make it false.

If you wish to turn it on, at the top of your macro you will want to look for the section that probably already has declare's listed and add:
Rich (BB code):
/declare ReportDefense bool 	outer TRUE

----------------------------------

Now you can set up your call to be what ever. This is entirely up to you, especially since you are the one doing the editing of your macro! For instance in a different part of the macro I have it set to call defense if my tanks go below a certain HP%. Defense.INC is just set up to fire off defensive stuff when it is called. And like I said above, this is nothing fancy or elegant, it is just something I have been tinkering with and seems to work for me. I though other folks might get some use out of it so --shrugs--

Bear in mind, as noted in the top of the file, this is set up to spam messages to a ${ChatChannel}, if you turn on the reporting. you will want to set that up. The file is set up to look for a declared ChatChannel, if it doesn't find one, it will default to echo.

___________________

This is all done in the spirit of helping folks learn. Again, if you are uncomfortable with editing your macro, ask someone else for help! I tend to gab a lot and would be happy to help folks, but I also don't suddenly want a ton of macro writers upset they are getting bombarded with folks screwing up X macro and expecting them to fix it....
 
Last edited:
great explanation how it works (even for a dumb one like me), redcented! thanks
 
Its NP there hoss. I have wiped and re-written this a few times, working out how to get it the way I envisioned it.

On the one hand, can always just make holyshits for MQ2Melee to fire off defensives (this is how I had it initially) but I have some...4-5 Pally/5-6 SK, and 3 warrior INI to maintain.... and nothing gets more annoying then X thing got upgraded so the holyflag gets stuck trying to fire off something that wont work, or you are using lower level stuff then the toon has. That and ... in the case of SK/Pally, thier regular macro can keep them casting enough that MQ2Melee doesn't get a chance to fire off anything at times (ick!) So I wanted something that went out of it's way to make sure defensive stuff got attended to.

The inclusion of BP's might be a bit much, been thinking of just having it click which ever one the toon is currently wearing --shrugs-- but I don't often have fights that drag out that long so it has not been a real issue.

Either way though, it has saved my bacon when I get adds midfight or unexpectedly long fights.
 
Updated first post to latest version, still testing though =)

Been busy lately and have not fully run this through all it's paces. If it is causing issues, the older version is still working and has been tested.

https://drive.google.com/file/d/0BxTGRVEV87-5bWxlN0VjWGVvWEE/view?usp=sharing

--------------------

Made it a point of testing this better when I got home from work today. Corrected some issues with Pal/SK section, warrior seems to work fine. Tested on 105 toons only so far. updated the first post.

Added in checks for ChatChannel and ReportDefense... if the include doesn't find them it will make a declare for them (echo and FALSE, respectively )
 
Last edited:
oh, Thank You btw Incog for the code lesson that enabled me to condense this down considerably!
 
Red cented ... when I actually start doing real content (SOON) I am absolutely going to use this. (or try to anyways... I think I can add a line or two to a .mac) :)
 
You dont need to use ${Window[CombatAbilityWnd].Child[CAW_CombatEffectLabel].Text.Equal[No Effect]} btw ${Melee.DiscID} will report 0 if no disc is running and the # if one is.
 
So if I add this #include defense.inc to my KA.mac file and then add this to my main loop
Rich (BB code):
/if (${DoDefense} && ${Me.CombatState.Equal[COMBAT]} && ${Select[${Me.Class.ShortName},WAR,PAL,SHD]} && (${Target.Named} || ${Me.XTarget}>2 || (${Spawn[id ${MATarget}].Level}>=(${Me.Level}+2))) && ${Target.Distance}<75) /call Defense

I'm done right? Obviously I have to have a file called defense.inc which is called out above.
 
So if I add this #include defense.inc to my KA.mac file and then add this to my main loop
Rich (BB code):
/if (${DoDefense} && ${Me.CombatState.Equal[COMBAT]} && ${Select[${Me.Class.ShortName},WAR,PAL,SHD]} && (${Target.Named} || ${Me.XTarget}>2 || (${Spawn[id ${MATarget}].Level}>=(${Me.Level}+2))) && ${Target.Distance}<75) /call Defense

I'm done right? Obviously I have to have a file called defense.inc which is called out above.

Rich (BB code):
(${Spawn[id ${MATarget}].Level}>=(${Me.Level}+2)

You will want to change or remove that part. It is specific to the macro I use.

Other then that, I imagine so yes. I have not opened KA to peruse it, so there may be better places to put the call (if I recall correctly Maskoi was going to write his own combat routine to avoid using MQ2Melee, which should be an ideal place to put a "/call defense" to insure you are in combat) but it ought to work in the mainloop with a little tweaking. Those folks more familiar with KS may speak up to help =)

Rich (BB code):
/if (!${Me.ActiveDisc.ID} && ${Target.Distance}<75 && ${Me.PctEndurance}>5 && ${Target.Type.Equal[NPC]} && (${Target.Named} || ${Me.XTarget}>2 || ${Target.Level}>=${Math.Calc[${Me.Level}+3]}|| ${Me.PctHPs}<75)) /call Defense

you may try this

The include file has been updated to look for "ReportDefense" if it finds none, it will not report. (thus should be no errors if not set up)
If report defense is set up and made TRUE, then the include will look for a "ChatChannel". If none is setup, it will default to echo (thus no errors)
 
Fixed a pairing error in the Runes line for warrior defense. Updated original post.
 
Warlock, Great work, any chance you will be doing a 2.0 for EoK stuff! Pretty Please...
 
Looked over the EoK stuff for Pally/Sk... there is not really anything defense specific with their new spells and ability.

Warriors seem to get a shield slam that protects from the next 2 incoming attacks (upgrade to shield topple) ... and a "generate hate when a heal lands" or "generate hate when a heal lands.. and addition healing for warrior"

- - - Updated - - -

I can see adding the Shield Break for warrior, cutting 2 attacks out of the equation every 15 seconds may help if it doesn't drain endurance to fast to keep it up on hard fights. Warriors are not something I regularly use though.... so someone would have to speak up on if it is a good idea or hooey =)

The Harmonious Precision/Expanse thing I can see as helping in hard fights... depending on how wide an area the AE hate does. It appears to put a buff on the warrior good for 3.5m, and has some 48 charges, with a 3 minute reuse.

I literally have not seen these till I logged on my warrior and ran to get em so...input? Happy to help here but, it will be some time before I finish gearing out and AAing my pally before shifting to warrior.
______________________________________
The pal/SK stuff doesn't appear defensive in nature... am I missing anything for those classes?
 
Last edited:
Updated discs for RoS

Redid the infinite ${If[,,]} to exit the sub faster
changed Warrior BP to simply click which ever the warrior has.
 
Rich (BB code):
/if (${Me.AltAbilityReady[Resplendent Glory]}) {
				/call Cast "Resplendant Glory" ALT
				/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Respendant_Glory" r "Active"
				/return
				}
			}
Are to /ifs allowed in one line? Is so, whats the benefit?
 
Yes it is allowed.

But is there a benifit? That's probably a matter of preference. MQ2 macro's are read a line at a time. So the entire line gets parsed all at once regardless of how you do it.

Rich (BB code):
/if (${castReturn.Equal[CAST_SUCCESS]}) /if (${ReportDefense}) /call AnnounceMessage 2 y "Respendant_Glory" r "Active"

Would be like saying....

Rich (BB code):
/if (${castReturn.Equal[CAST_SUCCESS]} && ${ReportDefense}) /call AnnounceMessage 2 y "Respendant_Glory" r "Active"

If the entire line of code wasn't read all at once then I could see a benefit to it as it would parse one less thing.

The same reason it parses it all in this particular case is the same reason you can't use multiple /next in a for statement. Because in a /for x loop it reads each line, even if it doesn't pass all cases, MQ2 still sees the /next x and considers that the end of the for statement. Thus if you have multiple /next x you will end up getting an error of /next x used without a matching /for statement.

I can't pretend to say I understand how it all works. I don't feel this has any benefit based on the above understanding of MQ2. I would actually see more benefit in making it part of a block in that if the first check isn't passed it would skip the block and not parse anything inside of it like below.

Rich (BB code):
/if (${castReturn.Equal[CAST_SUCCESS]}) {
    /if (${ReportDefense}) /call AnnounceMessage 2 y "Respendant_Glory" r "Active" 
}
In this case if the cast return is anything other than success it would skip the block of code inside the bracket and not parse anything inside of the block. So it would in that case parse one less thing if the first statement is false. It uses more lines, but produces a faster response. Not very noticeable on small macros but the information builds up on macros that run 10k+ lines. Eventually "optimization" like that would improve the overall response time and reduce the overall strain on the computer running it.

If you want to test that you can make an if statement that always returns false and then put an undeclared variable inside of a block of code, then make an inline if statement which uses an undeclared variable on the same line as the if statement. If you put the inline statement after the block statement then your undeclared variable would appear at the inline if statement and not the block if statement.

IE:

Rich (BB code):
#warning

Sub Main()
	/if (FALSE) {
		/echo ${UndeclaredVariable}
	}
	/if (FALSE) /echo ${UndeclaredVariable}
/return

if you were to run the above then your undeclared would be on line 7 where
Rich (BB code):
/if (FALSE) /echo ${UndeclaredVariable}
 
Defense.INC

Users who are viewing this thread

Back
Top
Cart