Difference between revisions of "Group list:colors and format"
Jump to navigation
Jump to search
(forgot align, hp and perhaps mana/moves could be negative) |
(Now colors alignment as well) |
||
| Line 2: | Line 2: | ||
<pre> | <pre> | ||
| − | |||
| − | |||
;Colors | ;Colors | ||
| − | ; hp and mana are yellow if they're | + | ; hp and mana are yellow if they're below 50%, red if they're below 20%. |
| − | ; tnl is yellow if it's | + | ; tnl is yellow if it's below 250, red if it it's below 100. |
| + | ; align is yellow if it's between -450 and 450, red if it's between -200 and | ||
| + | ; 200. | ||
;The original group list has this green, cyan, etc pattern. With no default | ;The original group list has this green, cyan, etc pattern. With no default | ||
| Line 15: | Line 15: | ||
;So if gls_default_color is an empty string it will keep the colors it got from | ;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. | ; avatar. If it's set to a value that value will be used as default color. | ||
| − | |||
;/set gls_default_color= | ;/set gls_default_color= | ||
/set gls_default_color=cyan | /set gls_default_color=cyan | ||
| Line 35: | Line 34: | ||
;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]+) *-? | + | /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}%;\ | ||
| Line 73: | Line 72: | ||
/test _tnl:=decode_attr(strip_attr(_tnl), "C%{gls_default_color}")%;\ | /test _tnl:=decode_attr(strip_attr(_tnl), "C%{gls_default_color}")%;\ | ||
/endif%;\ | /endif%;\ | ||
| − | ;substitute the mud output and do | + | ;color align |
| + | /if ((_align >= -200) & (_align <= 200)) \ | ||
| + | /test _align:=decode_attr(strip_attr(_align), "Cred")%;\ | ||
| + | /elseif ((_align >= -450) & (_align <= 450)) \ | ||
| + | /test _align:=decode_attr(strip_attr(_align), "Cyellow")%;\ | ||
| + | /elseif (gls_default_color !~ "") \ | ||
| + | /test _align:=decode_attr(strip_attr(_align), "C%{gls_default_color}")%;\ | ||
| + | /endif%;\ | ||
| + | ;substitute the mud output and do some padding | ||
/substitute -aCcyan -p @{n}$[pad(_id, 2, "|", 1, _level, 3, " ", 1, _tier, -5, \ | /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, \ | _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)]. | _mana_max, -6, _mv, 5, "/", 1, _mv_max, -6, _tnl, -7, _align, 4)]. | ||
| + | |||
</pre> | </pre> | ||
[[Category: TinyFugue Scripting]] | [[Category: TinyFugue Scripting]] | ||
Revision as of 03:29, 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.
;Colors
; hp and mana are yellow if they're below 50%, red if they're below 20%.
; tnl is yellow if it's below 250, red if it it's below 100.
; align is yellow if it's between -450 and 450, red if it's between -200 and
; 200.
;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%;\
;color align
/if ((_align >= -200) & (_align <= 200)) \
/test _align:=decode_attr(strip_attr(_align), "Cred")%;\
/elseif ((_align >= -450) & (_align <= 450)) \
/test _align:=decode_attr(strip_attr(_align), "Cyellow")%;\
/elseif (gls_default_color !~ "") \
/test _align:=decode_attr(strip_attr(_align), "C%{gls_default_color}")%;\
/endif%;\
;substitute the mud output and do some 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)].