#CLASS {XpCounter}
#ALIAS xpinit {#VAR XpGained 0;settime XpStartTime;#T- {XpCounter|Compute};#T+ {XpCounter|Init};sc l}
#ALIAS resetxp {#VAR TotXpTime 0;#VAR XpGained 0;#VAR XpStart 0;#VAR TotXpStart 0;#VAR TotXpGained 0;xpinit;#SHOW {%char(10)%ansi(bold,cyan)XP Counters Reset.}} 
#ALIAS xphelp {#SHOW {%char(10)%ansi(bold,yellow)xpinit: %ansi(bold,green)Start counting your Exp gain};#SHOW {%ansi(bold,yellow)resetxp: %ansi(bold,green)Reset all of the Xp variables.%char(10)         This will zero out the total Xp gained.%char(10)         Generally, just use xpinit again to start counting again for a new zone%char(10)%ansi(bold,yellow)xp ~<channel~>: %ansi(bold,green)Send your current xp gain and xp/min to specified channel%char(10)%ansi(bold,yellow)xptot ~<channel~>: %ansi(bold,green)Send your total xp gain and xp/hour to specified channel%char(10)%ansi(bold,yellow)xpoff:%ansi(bold,green) Turn off xp tracking.  Use xpinit to reenable xp tracking.%char(10)~(c~)Kernighan's Scripts 2005 Version 1.9}}
#ALIAS xp {settime TempXpTime;getsecdiff TempTime @XpStartTime @TempXpTime;#MATH XpPerMin @XpGained/@TempTime*60;%-1 ~<XP Earned: %format("&.0n",@XpGained)~> at ~<%format("&.0n",@XpPerMin) XP/minute~> in ~<[@TempTime/3600]hr:%mod(@TempTime/60,60)min:%mod(@TempTime,60)sec~>}
#ALIAS xptot {settime TotXpTempTime;getsecdiff TotTempTime @TotXpTime @TotXpTempTime;#MATH TotXpPerHour @TotXpGained/@TotTempTime*3600;%-1 ~<Cummalative XP Earned: %format("&.0n",@TotXpGained)~> at ~<%format("&.0n",@TotXpPerHour) XP/hour~> in ~<[@TotTempTime/3600]hr:%mod(@TotTempTime/60,60)min:%mod(@TotTempTime,60)sec~>}
#ALIAS xpoff {#VAR TotXpTime 0;#VAR TotXpStart 0;#VAR TotXpGained 0;#T- {XpCounter|Init};#T- {XpCounter|Compute};#SHOW {%char(10)%ansi(bold,cyan)XP Counter disabled.}}
#VAR XpGained {0}
#VAR XpStart {0}
#VAR XpStartTime {0}
#VAR TotXpStart {0}
#VAR TotXpGained {0}
#VAR TotXpTime {0}
#VAR TempTime {0} {0}
#VAR TempXpTime {0} {0}
#VAR TotTempTime {0} {0}
#VAR TotXpTempTime {0} {0}
#VAR XpPerMin {0}
#VAR TotXpPerHour {0}
#VAR TotXpPerSec {0}
#VAR XpPerSec {0}
#VAR PlusIn {0} {0}
#VAR XpLeft {0} {0}
#T- {XpCounter|Init}
#T- {XpCounter|Compute}
#CLASS 0

#CLASS {XpCounter|Init}
#TRIGGER {^Experience Points: %1 To Level: %2} {#VAR XpStart {%replace("%1",",","")};#VAR XpStart {%replace(@XpStart," ","")};#IF (@TotXpStart=0) {#VAR TotXpStart {@XpStart}};#IF (@TotXpTime=0) {#VAR TotXpTime {@XpStartTime}};#T+ {XpCounter|Compute};#T- {XpCounter|Init}}
#CLASS 0

#CLASS {XpCounter|Compute}
#TRIGGER {^Experience Points: %1 To Level: %2} {#VAR PlusIn {%left(%2,1)};#IF (@PlusIn =~ "L") {#VAR XpLeft {%ansi(bold,green)%2}} {#VAR XpLeft {%ansi(bold,red)%2}};#VAR XpGained {%replace("%1",",","")};#VAR XpGained {%replace(@XpGained," ","")};#VAR TotXpGained {@XpGained};#MATH XpGained @XpGained-@XpStart;#MATH TotXpGained @TotXpGained-@TotXpStart;settime TempXpTime;getsecdiff TempTime @XpStartTime @TempXpTime;settime TotXpTempTime;getsecdiff TotTempTime @TotXpTime @TotXpTempTime;#MATH XpPerSec @XpGained/@TempTime;#MATH XpPerMin {@XpPerSec*60};#MATH TotXpPerSec @TotXpGained/@TotTempTime;#MATH TotXpPerHour @TotXpPerSec*3600;#SUB {%ansi(bold,blue)Total Exp: %ansi(white)%format("&.0n",@TotXpGained) %ansi(bold,blue)~[%ansi(white)[@TotTempTime/3600]hr%ansi(bold,yellow):%ansi(white)%mod(@TotTempTime/60,60)min%ansi(bold,yellow):%ansi(white)%mod(@TotTempTime,60)sec%ansi(bold,blue)~]  ~[XP/Hour: %ansi(white)%format("&.0n",@TotXpPerHour)%ansi(bold,blue)~]%cr%ansi(bold,blue)XP Gained: %ansi(white)%format("&.0n",@XpGained) %ansi(bold,blue)~[%ansi(white)[@TempTime/3600]hr%ansi(bold,yellow):%ansi(white)%mod(@TempTime/60,60)min%ansi(bold,yellow):%ansi(white)%mod(@TempTime,60)sec%ansi(bold,blue)~]  ~[XP/Min: %ansi(white)%format("&.0n",@XpPerMin)%ansi(bold,blue)~]%cr%ansi(bold,cyan)Experience Points: %ansi(yellow)%1 %ansi(bold,blue) To Level: @XpLeft}}
#CLASS 0

