Backstab Stats

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

guest_01
a ghoul
a ghoul
Posts: 115
Joined: Thu Apr 22, 2004 5:15 am

Backstab Stats

Post by guest_01 » Fri Apr 15, 2005 3:24 pm

This is a self contained inc file. The only modifications you need to do to your main mac is to add the line

#include bsstats.inc

This will keep track of backstab hits, misses, damage, and give you a comprehensive idea of accuracy, DPS, double (tripple) attacks, and your highest backstab that session.

To have the stats printed to screen, use the command

/bsstats

Following is a description of what each stat means.

High Backstab: Highest backstab this session

Total Damage: Total damage done this session

Successful Hits: Number of backstabs that have hit

Total Unique BS Attempts: How many times the backstab key was pressed

Total BS Attempts w/Dbl Atk: How many backstabs have been attempted so far - will be >= Unique BS Attacks due to double attack.

Avg BS's per unique attempt: How often does double attack work? Average of number of backstabs attempted per pressing of the BS key.

Total Misses: How many times you missed.

Avg Dmg/hit: Average damage per backstab hit (doesn't include misses)

Avg Dmg/attempt: Average damage per attempt (includes misses)

Avg Dmg/unique attempt: Average damage per pressing of the backstab key.

Accuracy %: Overall accuracy percentage of hits vs attempts.

Extrapolated BS DPS: Theoretical Damage Per Second of backstab only, assuming you press backstab immediately every time it refreshs.

Code: Select all



#Event BackstabDamage  "You backstab #1# for #2# points of damage."
#Event BackstabMiss  "You try to backstab #1# but#*#"


#Event DamageInfo        "[MQ2] Backstab stats:#*#"



Sub DefineVars

	/squelch /declare BSStatsVarsDeclared int global 1
	/squelch /declare highDamage int global 0
	/squelch /declare totalDamage int global 0
	/squelch /declare totalHits int global 0
	/squelch /declare totalMisses int global 0
	/squelch /declare totalUniqueAttempts int global 0
	/squelch /declare BSTimer timer global 0

	/squelch /alias /BSStats /echo Backstab stats:

/return




Sub Event_DamageInfo

	/if (!${Defined[BSStatsVarsDeclared]}) /call DefineVars

	/echo High Backstab:                            ${highDamage}
	/echo Total Damage:                             ${totalDamage} 
	/echo Successful Hits:                          ${totalHits} 
	/echo Total Unique BS Attempts:        ${totalUniqueAttempts}
	/echo Total BS Attempts w/Dbl Atk:     ${Math.Calc[${totalHits}+${totalMisses}]}
	/echo Avg BS's per unique attempt:    ${Math.Calc[${Math.Calc[${totalHits}+${totalMisses}]}/${totalUniqueAttempts}]}
	/echo Total Misses:                                ${totalMisses}
	/echo Avg Dmg/hit:                                  ${Math.Calc[${totalDamage}/${totalHits}]}
	/echo Avg Dmg/attempt:                         ${Math.Calc[${totalDamage}/${Math.Calc[${totalHits}+${totalMisses}]}]}
	/echo Avg Dmg/unique attempt:           ${Math.Calc[${totalDamage}/${totalUniqueAttempts}]}
	/echo Accuracy %:                                   ${Math.Calc[${Math.Calc[${totalHits}*100]}/${Math.Calc[${totalHits}+${totalMisses}]}]}%
	/echo Extrapolated BS DPS:                 ${Math.Calc[${Math.Calc[${totalDamage}/${totalUniqueAttempts}]}/6]}
	
/return

Sub Event_BackstabDamage(string line,string name,int damage) 

	/if (!${Defined[BSStatsVarsDeclared]}) /call DefineVars

	/if (${BSTimer} <= 0) {
		/varcalc totalUniqueAttempts ${totalUniqueAttempts}+1
	}

	/varcalc totalDamage ${totalDamage}+${damage}
	/varcalc totalHits ${totalHits}+1

	/if (${damage} > ${highDamage}) {
		/varset highDamage ${damage}
		/echo New high backstab for ${highDamage}!
	}

	/varset BSTimer 20

/return


Sub Event_BackstabMiss(string line,string name) 

	/if (!${Defined[BSStatsVarsDeclared]}) /call DefineVars

	/if (${BSTimer} <= 0) {
		/varcalc totalUniqueAttempts ${totalUniqueAttempts}+1
	}

	/varcalc totalMisses ${totalMisses}+1

	/varset BSTimer 20

/return