;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Ticker echo macro ;; by Noose ;; ;; This is used to produce an echo for ;; my ticker. If you've got support ;; for 256 colors, you get some neat ;; effects. ;; ;; usage: ;; /tick_echo - ;; ;; h hp ;; i hpmax ;; j hpdiff ;; k hpmaxdiff ;; ;; s sp ;; t spmax ;; u spdiff ;; v spmaxdiff ;; ;; f fatigue ;; l last tick ;; e echo type (numbers / graph / simple) ;; c echo source (party, servant, etc) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Required files /require gauge.tf ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Macros /def -i tick_echo = \ /if (!getopts("h:i:j:k:s:t:u:v:f:l:e:c:","")) /return 0%;/endif%;\ /if (%{opt_e}=~"numbers") \ /echo -p \ $[test(%opt_c!~"") ? strcat("@{Ccyan}[@{B} ",toupper(opt_c)," @{n}@{Ccyan}]@{n} ") : strcat("@{Ccyan}[@{B} SC @{n}@{Ccyan}]@{n} ")]\ HP $[strcat("@{B",get_scale_color(%{opt_h}, %{opt_i}), "}", %{opt_h}, "@{n}")]$[echoDiff(opt_j)]\/@{B}%{opt_i}@{n}$[echoDiff(opt_k)] \ [@{Ccyan}$[perc(opt_h,opt_i)]\%@{n}] :: \ SP $[strcat("@{B",get_scale_color(%{opt_s}, %{opt_t}), "}", %{opt_s}, "@{n}")]$[echoDiff(opt_u)]\/@{B}%{opt_t}@{n}$[echoDiff(opt_v)] \ [@{Ccyan}$[perc(opt_s,opt_t)]\%@{n}] \ $[test(%opt_l!~"") ? strcat(":: T[@{B}",trunc(time()-opt_l),"@{n}s] ") : ""]\ $[test(%opt_f!~"") ? strcat(":: F[@{BCyellow}",%{opt_f},"@{n}]") : ""]%;\ /elseif (%{opt_e}=~"simple") \ /echo -p \ $[test(%opt_c!~"") ? strcat("@{Ccyan}[@{B} ",toupper(opt_c)," @{n}@{Ccyan}]@{n} ") : strcat("@{Ccyan}[@{B} SC @{n}@{Ccyan}]@{n} ")]\ @{B}$[pad(strcat("@{B",get_scale_color(%{opt_h}, %{opt_i}), "}", %{opt_h}),4)]@{n}$[echoDiff(%opt_j)]\/\ @{B}$[pad(strcat("@{B",get_scale_color(%{opt_s}, %{opt_t}), "}", %{opt_s}),4)]@{n}$[echoDiff(%opt_u)] \ $[test(%opt_l!~"") ? strcat(":: T[@{B}",trunc(time()-opt_l),"@{n}s]") : ""]\ $[test(%opt_f!~"") ? strcat(":: F[@{BCyellow}",%{opt_f},"@{n}]") : ""]%;\ /elseif (%{opt_e}=~"graph") \ /echo -p \ $[test(%opt_c!~"") ? strcat("@{Ccyan}[ ",toupper(opt_c)," ]@{n} ") : strcat("@{Ccyan}[@{B} SC @{n}@{Ccyan}]@{n} ")]\ $(/gauge -t"HP %opt_h$[echoDiff(opt_j)]" -c"red" -f"$[char(sc_rowfill)]" -e"$[char(sc_rowfill2)]" -l"%sc_rowlength" -n"%opt_h" -m"%opt_i") \ :: \ $(/gauge -t"SP %opt_s$[echoDiff(opt_u)]" -c"blue" -f"$[char(sc_rowfill)]" -e"$[char(sc_rowfill2)]" -l"%sc_rowlength" -n"%opt_s" -m"%opt_t") \ $[test(%opt_l!~"") ? strcat(":: T[@{B}",trunc(time()-opt_l),"@{n}s]") : ""]\ $[test(%opt_f!~"") ? strcat(":: F[@{BCyellow}",%{opt_f},"@{n}]") : ""]%;\ /endif ;; Ok, I'm not a rocket scientist, so the scale is hardcoded /set tick_echo_scale "500" "510" "520" "530" "540" "550" "450" "350" "250" "150" "050" /def get_scale_color = \ /let scale_length $(/length %tick_echo_scale)%;\ /let tempnum $[1+trunc((%1*1.0)/((%2*1.0)/scale_length))]%;\ /if (tempnum<1) \ /let tempnum 1%;\ /elseif (tempnum>%scale_length) \ /let tempnum $[%scale_length]%;\ /endif%;\ /let temp_scale $(/nth %tempnum %tick_echo_scale)%;\ /result $$[strcat("Crgb", %temp_scale)]