Difference between revisions of "Group list:colors and format"
Jump to navigation
Jump to search
(Colors hp/mana/tnl in the output of 'group' and reformats it a bit) |
(forgot align, hp and perhaps mana/moves could be negative) |
||
| Line 35: | Line 35: | ||
;It appends a dot to each line so you can easily see the trigger is working. | ;It appends a dot to each line so you can easily see the trigger is working. | ||
| − | /def -i -mregexp -t"^ *([0-9]+)[^ ] *([0-9]+) *([a-zA-Z]+) *([a-zA-Z]+) *([a-zA-Z]+) *([0-9]+)/([0-9]+) *([0-9]+)/([0-9]+) *([0-9]+)/([0-9]+) *([0-9]+) *([0-9]+)$" group_list_substitute = \ | + | /def -i -mregexp -t"^ *([0-9]+)[^ ] *([0-9]+) *([a-zA-Z]+) *([a-zA-Z]+) *([a-zA-Z]+) *-?([0-9]+)/([0-9]+) *-?([0-9]+)/([0-9]+) *-?([0-9]+)/([0-9]+) *([0-9]+) *-?([0-9]+)$" group_list_substitute = \ |
/let _id %{P1}%;\ | /let _id %{P1}%;\ | ||
/let _level %{P2}%;\ | /let _level %{P2}%;\ | ||
Revision as of 03:24, 10 November 2008
This script changes the format and color of the list you see when you type "group". See the comments in the script for more information.
;Bug reports, suggestions and/or diffs are appreciated, '''sulfar''' _AT_ ''inbox'' +DOT+ ''com''
;Colors
; hp and mana are yellow if they're <= 50%, red if they're <= 20%.
; tnl is yellow if it's <= 250, red if it it's <= 100.
;The original group list has this green, cyan, etc pattern. With no default
; color set it'll keep as much from that pattern as it can, which is nice by
; itself, but might be confusing if the group is hurt and you get red, cyan,
; green, yellow, green, cyan. Setting a default would change that to red,
; <default>, <default>, yellow, <default>, <default>.
;So if gls_default_color is an empty string it will keep the colors it got from
; avatar. If it's set to a value that value will be used as default color.
;
;/set gls_default_color=
/set gls_default_color=cyan
;I also made the columns align differently, so the hp/hp_max and mana/mana_max
; aren't just left-aligned, but the '/' is at a fixed position. I like that
; much better.
;
;Original:
; 1| 24 Mag Darkfader Stand 213/213 538/538 268/268 1296 1000
; 2|973 Hero Enchantress Stand 1765/1765 6039/6110 4114/5216 819 1000
; 3| 6 Lord Kimla Stand 2086/2086 1095/4686 4283/4283 14458 1000
;
;With this substitute:
; 1| 24 Mag Darkfader Stand 213/213 538/538 268/268 1296 1000.
; 2|973 Hero Enchantress Stand 1765/1765 6037/6110 4114/5216 819 1000.
; 3| 6 Lord Kimla Stand 2086/2086 1020/4686 4283/4283 14458 1000.
;It appends a dot to each line so you can easily see the trigger is working.
/def -i -mregexp -t"^ *([0-9]+)[^ ] *([0-9]+) *([a-zA-Z]+) *([a-zA-Z]+) *([a-zA-Z]+) *-?([0-9]+)/([0-9]+) *-?([0-9]+)/([0-9]+) *-?([0-9]+)/([0-9]+) *([0-9]+) *-?([0-9]+)$" group_list_substitute = \
/let _id %{P1}%;\
/let _level %{P2}%;\
/let _tier %{P3}%;\
/let _name %{P4}%;\
/let _pos %{P5}%;\
/let _hp %{P6}%;\
/let _hp_max %{P7}%;\
/let _mana %{P8}%;\
/let _mana_max %{P9}%;\
/let _mv %{P10}%;\
/let _mv_max %{P11}%;\
/let _tnl %{P12}%;\
/let _align %{P13}%;\
;color hp
/if ((_hp*100/_hp_max) <= 20) \
/test (_hp:=decode_attr(strip_attr(_hp), "Cred"), _hp_max:=decode_attr(strip_attr(_hp_max), "Cred"))%;\
/elseif ((_hp*100/_hp_max) <= 50) \
/test (_hp:=decode_attr(strip_attr(_hp), "Cyellow"), _hp_max:=decode_attr(strip_attr(_hp_max), "Cyellow"))%;\
/elseif (gls_default_color !~ "") \
/test (_hp:=decode_attr(strip_attr(_hp), "C%{gls_default_color}"), _hp_max:=decode_attr(strip_attr(_hp_max), "C%{gls_default_color}"))%;\
/endif%;\
;color mana
/if ((_mana*100/_mana_max) <= 20) \
/test (_mana:=decode_attr(strip_attr(_mana), "Cred"), _mana_max:=decode_attr(strip_attr(_mana_max), "Cred"))%;\
/elseif ((_mana*100/_mana_max) <= 50) \
/test (_mana:=decode_attr(strip_attr(_mana), "Cyellow"), _mana_max:=decode_attr(strip_attr(_mana_max), "Cyellow"))%;\
/elseif (gls_default_color !~ "") \
/test (_mana:=decode_attr(strip_attr(_mana), "C%{gls_default_color}"), _mana_max:=decode_attr(strip_attr(_mana_max), "C%{gls_default_color}"))%;\
/endif%;\
;color tnl
/if (_tnl <= 100) \
/test _tnl:=decode_attr(strip_attr(_tnl), "Cred")%;\
/elseif (_tnl <= 250) \
/test _tnl:=decode_attr(strip_attr(_tnl), "Cyellow")%;\
/elseif (gls_default_color !~ "") \
/test _tnl:=decode_attr(strip_attr(_tnl), "C%{gls_default_color}")%;\
/endif%;\
;substitute the mud output and do the padding
/substitute -aCcyan -p @{n}$[pad(_id, 2, "|", 1, _level, 3, " ", 1, _tier, -5, \
_name, -13, _pos, -6, _hp, 5, "/", 1, _hp_max, -6, _mana, 5, "/", 1, \
_mana_max, -6, _mv, 5, "/", 1, _mv_max, -6, _tnl, -7, _align, 4)].