;;; ;;; Randor's GQ Watch script. ;;; ;;; Abelinc made some modifications, changed the "level" variable to curr_level ;;; simply because the abestatusgraph.tf script automatically sets curr_level ;;; via statmon. ;;; /require tr.tf /def reloadgqwatch=/load gqwatch.tf ;;; ;;; gqwatch_state variable values: ;;; 0 reset/base...this was a manual gq info, leave output intact ;;; 1 this was an automatic gq hist, gag most output ;;; 2 this is an automatic view of the last/completed GQ ;;; 3 this is an automatic view of a current/open GQ ;;; ;;;;;;;;;;;;;;;;;;;;;; Complete list of gquest ranges, macros to work with it ; arg_is_inrange outputs $2_$3 if $1 is in between or $1 = all /def arg_is_inrange=\ /if ((({1} >= {2}) & ({1} <= {3})) | ({1} =~ "all")) /result " %2_%3" %; /endif ; print_levelranges prints all real gq ranges X_Y if $1 = all, or the ones that are available for level $1 /def print_levelranges=\ /set rangelist=%;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},1,4)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},1,8)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},1,12)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},5,16)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},9,20)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},13,24)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},17,28)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},21,32)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},25,36)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},29,40)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},33,44)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},37,48)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},41,52)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},45,56)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},49,60)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},53,64)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},57,68)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},61,72)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},65,76)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},69,80)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},73,84)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},77,88)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},81,92)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},85,96)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},89,100)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},93,104)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},97,108)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},101,112)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},105,116)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},109,120)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},113,125)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},117,130)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},121,135)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},126,140)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},131,145)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},136,150)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},141,155)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},146,160)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},151,165)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},156,170)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},161,175)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},166,180)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},171,185)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},176,190)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},181,195)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},186,201)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},191,201)] %;\ /set rangelist=%{rangelist}$[arg_is_inrange({1},194,201)] %;\ /result rangelist ;;;;;;;;;;;;;;;;;;;;;;;; ; /gqrange_set - set one gq range /def gqrange_set=/eval /set gqrange_%{1}_on=1 ; /gqrange_reset - reset one gq range /def gqrange_reset=/eval /set gqrange_%{1}_on=0 ; /gqrange_reset_list - reset list of gq ranges /def gqrange_reset_list=\ /echo Resetting GQ ranges %; \ /set gqrange_remaining_total=48 %; \ /while ({#}) \ /gqrange_reset %1 %; /shift %; \ /done ; /gqrange_print_remaining - from the list of ranges, print out those that are still remaining /def gqrange_print_remaining=\ /set gqrange_remaining_mine=0 %; \ ; iterate through list, print available, and sum all of them /while ({#}) \ /eval \ /if ({gqrange_%{1}_on} == 0) \ /echo $[tr("_","-",%{1})] %%; \ /set gqrange_remaining_mine=$[{gqrange_remaining_mine} + 1] %%; \ /endif %; \ /shift %; \ /done %; \ /echo Total: %{gqrange_remaining_mine} out of %{gqrange_remaining_total} ; by default, our results are 100% imprecise, otherwise contains number of gquests total left on last reset /set gqwatch_unreliability_factor=48 ;;;;;;;;;;;;;;;;;;;;;;; Main "controlling" macro, accepts up to 2 parameters ;; /gqrange - prints remaining ranges for current level ;; /gqrange help - displays command synopsis ;; /gqrange all - prints all remaining ranges ;; /gqrange reset - resets ranges ;; /gqrange init - initialize internal state from gq hist %; \ ;; /gqrange - prints remaning ranges for given level /def gqrange_help=\ /echo Usage: %; \ /echo /gqrange - print remaining gq ranges for your level %; \ /echo /gqrange help - this screen %; \ /echo /gqrange all - prints all remaining ranges %; \ /echo /gqrange reset - reset internal state %; \ /echo /gqrange init - initialize internal state from gq hist %; \ /echo /gqrange - print remaining ranges for given level %; \ /def gqrange=\ /if ({1} =~ "") \ /echo Remaining GQ ranges for your level: %; \ /gqrange_print_remaining $[print_levelranges({curr_level})] %; \ /elseif ({1} =~ "help") \ /gqrange_help %; \ /return %; \ /elseif ({1} =~ "all") \ /echo Remaining GQ ranges: %; \ /gqrange_print_remaining $[print_levelranges("all")] %; \ /elseif ({1} =~ "reset") \ /gqrange_reset_list $[print_levelranges("all")] %; \ /elseif ({1} =~ "init") \ /gqhistwatch_process_hist %; \ /return %; \ /elseif (({1} > 0) & ({1} < 210)) \ /echo Remaining GQ ranges for level %{1}: %; \ /gqrange_print_remaining $[print_levelranges({1})] %; \ /endif %; \ /echo Possible error: %{gqwatch_unreliability_factor} ;;;;;;;;;;;;;;;;;;;;;;; Functions to perform statistics on gquest logs /set gqwatch_state=0 /set gqwatch_awaiting_finalize=0 ;; /gqwatch_process_gq - starts the trigger sequence for capturing last gq output /def gqwatch_process_gq=\ /set gqwatch_state=1 %;\ gq info ;; takes levels from and to and makes and updates the passed gqrange list /def update_gqrange=\ /eval \ /if ({gqrange_%{1}_%{2}_on} == 1) \ ; The gqrange already happened, it means that new series started just now, or sometime in the past ; NOTE: while this is not precise, our marked "start of series" will converge to the real one over time ; NoWinner gquests pose a problem, but the convergence should take care of the minor discrepancies /set gqwatch_unreliability_factor=%{gqrange_remaining_total} %%; \ /gqrange reset %%; \ /endif %; \ /gqrange_set %{1}_%{2} %; \ /set gqrange_remaining_total=$[{gqrange_remaining_total} - 1] ;; finalize_current_gq - this makes sure the variables for gq ranges are correctly updated for running gquests /def finalize_current_gq=\ ; check if we have new gquest, other than the previous one, otherwise just ignore this /if ({gqwatch_last_name} !~ {gqwatch_name}) \ /update_gqrange %{gqwatch_level_from} %{gqwatch_level_to} %; \ /set gqwatch_last_name=%{gqwatch_name} %; \ /endif ;;;;;;;;;;;;;;;;;;;;;;;; Triggers to parse gq info output /def -mregexp -t'^Global Quest: The global quest has been won by [A-Za-z]+ - [0-9]+[stnrdh]+ win.$' gqwatch_trig_someonewon=/gqwatch_process_gq %; /repeat -120 1 /gqwatch_process_gq %; /repeat -300 1 /gqwatch_process_gq %; /repeat -630 1 /gqwatch_process_gq /def -mregexp -t'^([*]\[NOEXP\][*] )?----------------------\[ LAST GLOBAL QUEST DETAILS \]----------------------$' gqwatch_trig_start_last=/if ({gqwatch_state} = 1) /echo Logging LAST Gquest (gagged) %; /set gqwatch_state=2 %; /endif /def -mregexp -t'^([*]\[NOEXP\][*] )?---------------------\[ CURRENT GLOBAL QUEST DETAILS \]---------------------$' gqwatch_trig_start_current=/if ({gqwatch_state} = 1) /echo Logging CURRENT Gquest (gagged) %; /set gqwatch_state=3 %; /endif ;;; Gag below output if it was an automatic gq info /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Quest Name.........: \[ (.*) \]$' gqwatch_trig_name=/set gqwatch_name=%{P1} /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Quest Status.......: \[ *(.*) *\]$' gqwatch_trig_status= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Started By.........: \[ (.*) \]$' gqwatch_trig_startedby= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Level range........: \[ *([0-9]*) \] - \[ *([0-9]*) \]$' gqwatch_trig_levels=/set gqwatch_level_from=%{P1} %; /set gqwatch_level_to=%{P2} /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Quest Duration.....: \[ *([0-9]*) *\]$' gqwatch_trig_duration= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Time to Start......: \[ *([0-9]*) *\]$' gqwatch_trig_tostart= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Time Expired.......: \[ *([0-9]*) *\]$' gqwatch_trig_expired= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Time Remaining.....: \[ *([0-9]*) *\]$' gqwatch_trig_remaining= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Completed by ......: \[ *(.*) *\]$' gqwatch_trig_completedby= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^-----------------------------\[ Quest Rewards \]-----------------------------$' gqwatch_trig_rewardssection= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Quest points.......: \[ *([0-9]*) *\] [(] \+3 for each mob killed [)]$' gqwatch_trig_rewardqp= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Training Sessions..: \[ *([0-9]*) *\]$' gqwatch_trig_rewardtrains= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Practice Sessions..: \[ *([0-9]*) *\]$' gqwatch_trig_rewardpracs= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Trivia points......: \[ *([0-9]*) *\]$' gqwatch_trig_triviapoints= /def -F -ag -E(gqwatch_state>1) -mregexp -t'^Gold Coins.........: \[ *([0-9]*) *\]$' gqwatch_trig_rewardgold= ;;; Display normal output if it was a manual GQ info, or display ;;; GQuest Log End (current|last) if an automatic GQ info /def -F -ag -E(gqwatch_state>1) -mregexp -t'^---------------------------------------------------------------------------$' gqwatch_trig_end= /if ({gqwatch_state} = 2) /echo GQuest Log End (last) %; /set gqwatch_state=0 %; /elseif ({gqwatch_state} = 3) /echo GQuest Log End (current) %; /set gqwatch_state=0 %; /endif %; /finalize_current_gq ;;; Gag below output if it was an automatic GQ info AND if it is a completed GQ ;;; If you see the GQ targets, then one of 2 conditions exist: ;;; 1) It was a manual GQ info ;;; 2) It was an automatic GQ info, but it's in your current range /def -F -ag -E(gqwatch_state=2) -mregexp -t'^-----------------------------\[ Quest Targets \]-----------------------------$' gqwatch_trig_targetsection= /def -F -ag -E(gqwatch_state=2) -mregexp -t'^The targets for this quest were:$' gqwatch_trig_targetswere= /def -F -ag -E(gqwatch_state=2) -mregexp -t'^Kill at least [1-9] [*] (.*) [(](.*)[)].$' gqwatch_trig_mobs= ;;; ;;; Initialize the script using gq hist ;;; Set pagesize to 0, gq hist, set pagesize back to original setting ;;; Put gq hist output into a file, then reverse that file to be read back in ;;; the order of GQs being completed. Parse each of those lines as if we ;;; just saw them end. ;;; /set gqhistwatch_state=0 /def gqhistwatch_process_hist=/gqrange reset %; /set gqhistwatch_state=1 %; scroll /def -F -ag -E(gqhistwatch_state=1) -mregexp -t'^(You do not page long messages|You currently display ([0-9]+) lines per page)[.]$' gqwatch_trig_scroll=/set gqhistwatch_state=2 %; scroll 0 %; gq hist %; echo GQWATCH_INIT_END %; /if (%P2!~"") scroll %{P2} %; /endif /def -F -ag -E(gqhistwatch_state) -mregexp -t'^([*].NOEXP.[*])? *Use \'pagesize \' to change, or \'pagesize 0\' to disable paging.$' gqwatch_trig_gagtheshit=/test /def -F -ag -E(gqhistwatch_state) -mregexp -t'^([*].NOEXP.[*])? *Paging disabled\.$' gqwatch_trig_gagtheshit2=/test /def gqhistwatch_finalize=/set gqhistwatch_state=0 %; /while ({#}) /update_gqrange %{1} %{2} %; /shift 2 %; /done /def -F -ag -E(gqhistwatch_state=2) -mregexp -t'^([*].NOEXP.[*])? *Date/Time finished From To Completed by Minutes$' gqhistwatch_trig_header=/set gqhistwatch_state=3 /def -F -ag -E(gqhistwatch_state=3) -mregexp -t'^------------------------- ---- ---- ------------ -------$' gqhistwatch_trig_postheader=\ /set gqhistwatch_finished_ranges= %; /set gqhistwatch_state=4 /def -F -ag -E(gqhistwatch_state=4) -mregexp -t'^[a-zA-Z ]*[ ]*[0-9]*[ ]*[0-9:]*[ ]*[0-9]*[ ]*([0-9]*)[ ]*([0-9]*)[ ]*([-a-zA-Z_0-9 ]*)[ ]*([0-9]*)[ ]*$' gqhistwatch_trig_gqentryparser=\ /set gqhistwatch_trig_by=%{P3} %; /set gqhistwatch_trig_minutes=%{P4} %; /set gqhistwatch_finished_ranges=%{P1} %{P2} %{gqhistwatch_finished_ranges} /def -F -ag -E(gqhistwatch_state=4) -mregexp -t'^GQWATCH_INIT_END$' gqwatch_trig_gqhist_end = /gqhistwatch_finalize %{gqhistwatch_finished_ranges}