changeset 563:217cc3131d61

Mangle 'slots' command's messages to more nicer layout. Implements something like requested in ID#12.
author Ealoren Pupunen <ealoren@bat.org>
date Wed, 22 Nov 2006 10:49:43 +0000
parents 28669f28c254
children 398e0685e413
files ggrtf-misc.tf
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ggrtf-misc.tf	Wed Nov 22 08:13:29 2006 +0000
+++ b/ggrtf-misc.tf	Wed Nov 22 10:49:43 2006 +0000
@@ -481,3 +481,33 @@
 /msw | Misses: @{Cyellow}$[pad(hst_misses,-6)]@{n} (@{BCyellow}$[pad(qtmp2,3)]\%@{n}) | Total Hit Types: @{BCwhite}$[pad(hst_count,-3)]@{n} |%;\
 /msw `----------------------------------------------'
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Special highlights and  maglings for misc. commands
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Mangle 'slots' command's messages to more nicer layout.
+;; FIXME:
+;; What if torso is not the last slot listed? How to elegantly print
+;; the bottom of the table.
+
+/def -i -ag -p9999 -msimple -t"Your current armour status is:" gslots_mangle1 =\
+	/msw ,-----------------.%;\
+	/msw | Free | Slot     |%;\
+	/msw +------+----------+
+
+/def -i -ag -p9999 -mregexp -t"^  You have (no|one|two|three|four) free ([a-z]*) slots?\.$" gslots_mangle2 =\
+	/if     ({P1} =/ "no")    /let num 0%;\
+	/elseif ({P1} =/ "one")   /let num 1%;\
+	/elseif ({P1} =/ "two")   /let num 2%;\
+	/elseif ({P1} =/ "three") /let num 3%;\
+	/elseif ({P1} =/ "four")  /let num 4%;\
+	/else                     /let num -1%;\
+	/endif%;\
+	/let slots %{P2}%;\
+	/if (num <= 0) /msw | @{BCred}$[pad(num,3)]@{n}  | $[pad({P2},-8)] |%;\
+	/else          /msw | @{Cgreen}$[pad(num,3)]@{n}  | $[pad({P2},-8)] |%;\
+	/endif%;\
+	/if (slots =/ "torso") /msw `-----------------'%;\
+	/endif
+