RHBackstab.inc - Backstab Tracking Module for Rogues

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

RHBackstab.inc - Backstab Tracking Module for Rogues

Post by GD » Fri Nov 26, 2004 3:24 pm

Originally designed for the Rogue Helper macro, but can now be used in any macro.

Notifiers can be used alone or together, such as echo+popup+speak to get all 3 alerts, or just speak to only have it spoken.

To use spoken notifiers, you must have the speech plugin compiled and loaded.

Tracks Backstabs, Doubles, and Triples, but does not track FB/Assassination as max backstabs, as they don't really count as a regular backstab.

Code: Select all

|**----------------------------------------------------------
	RHBackStab.inc, a backstab tracking module for Rogues

	Usage:
	add the following to your main script

	(Just before sub main)
	#include RHBackstab.inc

	(Inside of Sub Main, before the main loop)
	/echo Loading Includes...

GD
----------------------------------------------------------**|

#Event InitRHBackStab	"[MQ2] Loading Includes..."
#Event TogBSAnnounce	"[MQ2] BSAnnounce#*#"
#Event SetBSNotifier	"[MQ2] BSNotifier#*#"
#Event TogBSTrack		"[MQ2] BSTrack#*#"
#Event RHBSStatus		"[MQ2] BSRH Status#*#"
#Event BackStab			"You backstab #1# for #2# points of damage."

Sub Event_InitRHBackStab
	/declare BSAnnounce bool outer TRUE
	/declare BSNotifier string outer echo
	/declare BSTrack bool outer TRUE
	/declare MaxBS int outer 0
	/declare Max2xBS int outer 0
	/declare Max3xBS int outer 0
	/declare iBSCount int outer 0
	/declare iBSTotal int outer 0
	/declare iLastBS int outer 0

	/if (${Ini[RHBackstab.ini,General,BSAnnounce].NotEqual[NULL]}) /goto :Ini
	/squelch /alias /bstrack /echo BSTrack
	/squelch /alias /bsannounce /echo BSAnnounce
	/squelch /alias /bsnotifier /echo BSNotifier

	:Ini
	/if (${Ini[RHBackstab.ini,General,BSAnnounce].NotEqual[NULL]}) /varset BSAnnounce ${Ini[RHBackstab.ini,General,BSAnnounce]}
	/if (${Ini[RHBackstab.ini,General,BSNotifier].NotEqual[NULL]}) /varset BSNotifier ${Ini[RHBackstab.ini,General,BSNotifier]}
	/if (${Ini[RHBackstab.ini,General,BSTrack].NotEqual[NULL]}) /varset BSTrack ${Ini[RHBackstab.ini,General,BSTrack]}
	/if (${Ini[RHBackstab.ini,General,MaxBS].NotEqual[NULL]}) /varset MaxBS ${Ini[RHBackstab.ini,General,MaxBS]}
	/if (${Ini[RHBackstab.ini,General,Max2xBS].NotEqual[NULL]}) /varset Max2xBS ${Ini[RHBackstab.ini,General,Max2xBS]}
	/if (${Ini[RHBackstab.ini,General,Max3xBS].NotEqual[NULL]}) /varset Max3xBS ${Ini[RHBackstab.ini,General,Max3xBS]}

	/echo ** Announce Backstabs: ${BSAnnounce}, Notifier: ${BSNotifier}
	/echo ** Track Max Backstabs: ${BSTrack}, Current Max: ${MaxBS}, 2x: ${Max2xBS}, 3x: ${Max3xBS}
/return

Sub Event_Backstab
	/declare sMSG string

	/if (${Math.Calc[${MacroQuest.Running}-${iLastBS}]} < 2000) {
		/varcalc iBSCount ${iBSCount}+1
		/varcalc iBSTotal ${iBSTotal}+${Param2}
	} else {
		/varset iBSCount 1
		/varset iBSTotal ${Param2}
	}
	/varset iLastBS ${MacroQuest.Running}

	/if (${iBSCount} == 1) {
		/varset sMSG You Backstab ${Param1} for ${Param2}
	} else /if (${iBSCount} == 2) {
		/varset sMSG You Double Backstab ${Param1} for ${iBSTotal}
	} else /if (${iBSCount} >= 3) {
		/varset sMSG You Triple Backstab ${Param1} for ${iBSTotal}
	}

	/if (${BSAnnounce}) {
		/if (${BSNotifier.Find[echo]}) /echo ${sMSG}
		/if (${BSNotifier.Find[popup]}) /popup ${sMSG}
		/if (${BSNotifier.Find[speak]}) /speak ${sMSG}
		/if (${iBSCount}==1 && ${Param2}>${MaxBS} && ${Param2}<32000 && ${BSTrack}) {
			/if (${BSNotifier.Find[echo]}) /echo New max Backstab of ${Param2}
			/if (${BSNotifier.Find[popup]}) /popup New max Backstab of ${Param2}
			/if (${BSNotifier.Find[speak]}) /speak New max Backstab of ${Param2}
			/ini "RHBackstab.ini" "General" "MaxBS" "${Param2}"
			/varset MaxBS ${Param2}
		} else /if (${iBSCount}==2 && ${iBSTotal}>${Max2xBS} && ${iBSTotal}<32000 && ${BSTrack}) {
			/if (${BSNotifier.Find[echo]}) /echo New max Double Backstab of ${iBSTotal}
			/if (${BSNotifier.Find[popup]}) /popup New max Double Backstab of ${iBSTotal}
			/if (${BSNotifier.Find[speak]}) /speak New max Double Backstab of ${iBSTotal}
			/ini "RHBackstab.ini" "General" "Max2xBS" "${iBSTotal}"
			/varset Max2xBS ${iBSTotal}
		} else /if (${iBSCount}>=3 && ${iBSTotal}>${Max3xBS} && ${iBSTotal}<32000 && ${BSTrack}) {
			/if (${BSNotifier.Find[echo]}) /echo New max Triple Backstab of ${iBSTotal}
			/if (${BSNotifier.Find[popup]}) /popup New max Triple Backstab of ${iBSTotal}
			/if (${BSNotifier.Find[speak]}) /speak New max Triple Backstab of ${iBSTotal}
			/ini "RHBackstab.ini" "General" "Max3xBS" "${iBSTotal}"
			/varset Max3xBS ${iBSTotal}
		}
	}
/return

Sub Event_TogBSAnnounce
	/if (${BSAnnounce}) {
		/varset BSAnnounce FALSE
		/echo ** Backstab Announcing is now OFF!
	} else {
		/varset BSAnnounce TRUE
		/echo ** Backstab Announcing is now ON!
	}
	/ini "RHBackstab.ini" "General" "BSAnnounce" "${BSAnnounce}"
/return

Sub Event_TogBSTrack
	/if (${BSTrack}) {
		/varset BSTrack FALSE
		/echo ** Backstab Tracking is now OFF!
	} else {
		/varset BSTrack TRUE
		/echo ** Backstab Tracking is now ON!
	}
	/ini "RHBackstab.ini" "General" "BSTrack" "${BSTrack}"
/return

Sub Event_SetBSNotifier(string Line)
	/if (${Line.Arg[3].Length}) /varset BSNotifier ${Line.Arg[3]}
	/echo ** Backstab Notifier set to: "${BSNotifier}"
	/ini "RHBackstab.ini" "General" "BSNotifier" "${BSNotifier}"
/return

Sub Event_RHBSStatus
	/if (${verbosity}>=0) /${channel} -------=======(Backstab Tracking Status)=======--------
	/if (${verbosity}>=0) /${channel} ** Announce Backstabs: ${BSAnnounce}, Notifier: ${BSNotifier}
	/if (${verbosity}>=0) /${channel} ** Track Max Backstabs: ${BSTrack}, Current Max: ${MaxBS}, 2x: ${Max2xBS}, 3x: ${Max3xBS}
/return
Sample RHBackstab.ini settings:

Code: Select all

[General]
BSAnnounce=TRUE
BSNotifier=echo
BSTrack=TRUE
MaxBS=2517
Max2xBS=3214
Max3xBS=4132
Opinions are like assholes, everyone has one, but most of them stink.

r0tax
orc pawn
orc pawn
Posts: 10
Joined: Thu Feb 17, 2005 12:26 am

Post by r0tax » Thu Feb 17, 2005 12:33 am

I just wanted to add 1 more thing...

Make sure you have *hit modes* set to "normal" . .

Was having issues w/ it showing bs's . . until I thought about this...

aneqplayer
orc pawn
orc pawn
Posts: 16
Joined: Tue Apr 19, 2005 7:43 pm

Post by aneqplayer » Sun Jul 17, 2005 10:16 pm

broke since the last patch? Even with the 7-16 release fixing some else problems it still has errors about the vars, the iBSCount? is undefined, amoung others.

I run both this and RH6.0 stock.

skyler
a snow griffon
a snow griffon
Posts: 311
Joined: Wed May 11, 2005 9:22 am

Post by skyler » Mon Jul 18, 2005 7:30 am

aneqplayer wrote:broke since the last patch? Even with the 7-16 release fixing some else problems it still has errors about the vars, the iBSCount? is undefined, amoung others.

I run both this and RH6.0 stock.

Code: Select all

} else /if (${iBSCount} == 2) { 
      /varset sMSG You Double Backstab ${Param1} for ${iBSTotal} 
   } else /if (${iBSCount} >= 3) { 
      /varset sMSG You Triple Backstab ${Param1} for ${iBSTotal} 
   } 

   /if (${BSAnnounce}) { 
      /if (${BSNotifier.Find[echo]}) /echo ${sMSG} 
      /if (${BSNotifier.Find[popup]}) /popup ${sMSG} 
      /if (${BSNotifier.Find[speak]}) /speak ${sMSG} 
      /if (${iBSCount}==1 && ${Param2}>${MaxBS} && ${Param2}<32000 && ${BSTrack}) { 
         /if (${BSNotifier.Find[echo]}) /echo New max Backstab of ${Param2} 
         /if (${BSNotifier.Find[popup]}) /popup New max Backstab of ${Param2} 
         /if (${BSNotifier.Find[speak]}) /speak New max Backstab of ${Param2} 
         /ini "RHBackstab.ini" "General" "MaxBS" "${Param2}" 
         /varset MaxBS ${Param2} 
      } else /if (${iBSCount}==2 && ${iBSTotal}>${Max2xBS} && ${iBSTotal}<32000 && ${BSTrack}) { 
         /if (${BSNotifier.Find[echo]}) /echo New max Double Backstab of ${iBSTotal} 
         /if (${BSNotifier.Find[popup]}) /popup New max Double Backstab of ${iBSTotal} 
         /if (${BSNotifier.Find[speak]}) /speak New max Double Backstab of ${iBSTotal} 
         /ini "RHBackstab.ini" "General" "Max2xBS" "${iBSTotal}" 
         /varset Max2xBS ${iBSTotal} 
      } else /if (${iBSCount}>=3 && ${iBSTotal}>${Max3xBS} && ${iBSTotal}<32000 && ${BSTrack}) { 
         /if (${BSNotifier.Find[echo]}) /echo New max Triple Backstab of ${iBSTotal} 
         /if (${BSNotifier.Find[popup]}) /popup New max Triple Backstab of ${iBSTotal} 
         /if (${BSNotifier.Find[speak]}) /speak New max Triple Backstab of ${iBSTotal} 
         /ini "RHBackstab.ini" "General" "Max3xBS" "${iBSTotal}" 
         /varset Max3xBS ${iBSTotal} 
      }
Those are the only else statements I saw that would cause the problems. Just fix those ones in the backstab function and you are all set.