changeset 943:62b1971f9772

v0.6.11.4-svn; Prompt handling improvements (enable colour lites in prompt, function execution); Handle @{} codes in /opts panel better; Many documentation updates related to prompt, and other things.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 22 Mar 2009 03:25:47 +0000
parents 6aa6971e0df1
children a870ab3bb804
files docs/manual.sgml ggrtf.tf
diffstat 2 files changed, 213 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/docs/manual.sgml	Sun Mar 22 01:59:30 2009 +0000
+++ b/docs/manual.sgml	Sun Mar 22 03:25:47 2009 +0000
@@ -1,6 +1,6 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "/usr/share/xml/docbook/schema/dtd/4.3/docbookx.dtd">
 <!-- Define some entities
-<!ENTITY ggrtfver "0.6.9.x">
+<!ENTITY ggrtfver "0.6.11.x">
 <!ENTITY jeskko "<ulink url='http://jeskko.pupunen.net/'>Jarkko Vääräniemi</ulink> (<ulink url='http://www.bat.org/char/Jeskko'>Jeskko</ulink>)">
 <!ENTITY ggr "<ulink url='http://ccr.tnsp.org/'>Matti Hämäläinen</ulink> (<ulink url='http://www.bat.org/char/Ggr'>Ggr</ulink>)">
 <!ENTITY tfurl "<ulink url='http://tinyfugue.sf.net/'>TinyFugue</ulink>">
@@ -558,8 +558,12 @@
 <screen>sc set H:{colorhp}/&lt;maxhp&gt; S:{colorsp}/&lt;maxsp&gt; E:{colorep}/&lt;maxep&gt; $:&lt;cash&gt; exp:&lt;exp&gt;</screen>
 </listitem>
 
- <listitem><para>Prompt:</para>
-<screen>prompt H:&lt;hp&gt;/&lt;maxhp&gt; S:&lt;sp&gt;/&lt;maxsp&gt; E:&lt;ep&gt;/&lt;maxep&gt; &gt;</screen>
+ <listitem><para>Prompt</para>
+<screen>prompt PROMPT:&gt;</screen>
+<para>If you wish, you can add any BatMUD specific data to the prompt
+between ":" and "&gt;", this substring will be stored to "status_prompt" TF
+variable, which can be used in /gprompt. Read more in <link
+linkend="usage-general-prompt">prompt setup section</link>.</para>
 </listitem>
 
  <listitem><para>Listen to battle round flags:</para>
@@ -672,9 +676,8 @@
 commands.
 </para></listitem>
 
- <listitem><para>Prompt gagging. Optional skill/spell viewing in
- prompt, which shows the currently ongoing skill or spell in your
- prompt.
+ <listitem><para><link linkend="usage-general-prompt">Prompt
+ handling and mangling.</link>
 </para></listitem>
 
  <listitem><para>Automatic "ripaction", which is performed when
@@ -930,6 +933,13 @@
      Perform skill 'ceremony', but only if ceremony is not already "active".
     </entry>
    </row>
+
+   <row>
+    <entry>/gprompt [prompt string]</entry>
+    <entry>Set or change GgrTF's displayed prompt. The setting can contain
+    any TinyFugue expressions, such as variable substitutions. Refer to
+    <link linkend="usage-general-prompt">prompt settings section</link> for details.</entry>
+   </row>
 <!--
    <row>
     <entry></entry>
@@ -1013,9 +1023,86 @@
  </mediaobject>
 </screenshot>
 
+</section>
+
+<!-- ================================================ -->
+
+<section id="usage-general-prompt"><title>Prompt configuration</title>
+<para>
+In addition to basic prompt handling, GgrTF offers very flexible and
+extensible way of presenting the game prompt. Internal TF variables
+can be shown, even simple TF macro snippets executed to show the prompt
+as the user wishes. Also, in GgrTF v0.6.11.3 and later, it is possible to
+have custom BatMUD data in the prompt (see 'help prompt' in BatMUD).
+</para>
+<para>
+To get started, you need to have a basic prompt setting in BatMUD,
+as required to have GgrTF detect and handle it properly is. This
+setting is presented below, and we'll get to the more complex ones later.
+</para>
+
+<screen>prompt PROMPT:&gt;</screen>
+
+<para>
+After setting the BatMUD prompt, you can start configuring how GgrTF
+"mangles" your prompt. This is done by using "/gprompt" command macro
+(or alternatively editing the saved configuration files and "set_gprompt"
+setting.) There are myriad of ways of how and what things can be done,
+mostly limited by what you can come up with. Some examples are presented
+below:
+</para>
+
+<orderedlist>
+ <listitem><screen>/gprompt &gt;</screen><para>Set prompt to show only
+"&gt;" and nothing more</para></listitem>
+ <listitem><screen>/gprompt %{status_cast}&gt;</screen><para>
+Show currently in-progress skill or spell in prompt.</para></listitem>
+ <listitem><screen>/gprompt @{BCred}%{status_cast}@{n}@{BCwhite}&gt;@{n}</screen><para>
+TinyFugue color attributes can be used also.</para></listitem>
+ <listitem><screen>/gprompt @{$[prgetnlite(status_hp,status_hpm)]}%{status_hp}@{n}@{BCwhite}&gt;@{n}</screen><para>
+Above would print your hp, lited similarly to the statusbar HP/SP/EP display.
+As you can use any macro evaluations and call TF functions.</para></listitem>
+</orderedlist>
+
+<para>
+As you can see, lots of things can be done, and only fraction of ideas
+are represented here. However, in addition to what GgrTF and TF offer,
+it is also possible to add BatMUD specific information into the prompt.
+As you remember, we set up the basic prompt above to "PROMPT:&gt;".
+The user definable data can be put between the colon (":") and greater than
+("&gt;") sign, and it gets parsed by GgrTF. Observe following example:
+</para>
+
+<screen>prompt PROMPT:&lt;hp&gt;/&lt;sp&gt;/&lt;ep&gt;|&lt;eqset&gt;&gt;</screen>
+
+<para>
+Above prompt setting would make the BatMUD prompt show something like:
+</para>
+
+<screen>PROMPT:663/636/333|spr&gt;</screen>
+
+<para>Where the numbers represent your hp, sp and ep, and 'spr' is the work
+eqset, as described by 'help prompt'. This string gets parsed into a TF variable
+called "status_prompt", which can be then used in GgrTF's prompt. Examples
+follow:
+</para>
+
+<orderedlist>
+ <listitem><screen>/gprompt %{status_prompt}&gt;</screen>
+ <para>This simple example would just prompt the grabbed BatMUD data with
+ greater than sign in the end.</para></listitem>
+ <listitem><screen>/gprompt @{BCgreen}%{status_prompt}@{n}&gt;</screen>
+ <para>Same as above, but coloured bright green.</para></listitem>
+</orderedlist>
+
+<para>
+The prompt can contain any BatMUD data, as long as it is formatted as
+"PROMPT:your data here&gt;".
+</para>
 
 </section>
 
+
 <!-- ================================================ -->
 
 <section id="usage-general-saves"><title>State-saving</title>
@@ -1761,9 +1848,58 @@
    <row>
     <entry>tweak &lt;target&gt;</entry>
     <entry>
-BatMUD's 'tweak' emote is used to report prots either to party
-report-channel, or in case if the tweaker is not in same room,
-via emote.
+BatMUD's 'tweak' emote is used to report prots to party
+report-channel.
+</entry>
+   </row>
+  </tbody>
+ </tgroup>
+</table>
+</section>
+
+</section>
+
+<!-- ================================================ -->
+
+<section id="usage-general-curses"><title>Curse management</title>
+<para>
+Often an important aspect while bashing those nasty eq-monsters dead,
+is to keep track of any handicapping spells or skills cast against the
+said monster. GgrTF's curse handling is made just for that, it
+tracks most common handicaps cast at non-partymembers.
+</para>
+<para>
+<emphasis>Notice! To work fully, this feature requires <link
+linkend="usage-pssmangle">PSS-mangler</link> module to be loaded and in use.
+</emphasis>
+While curse tracking does work without it, curses cast by other
+entities than party members will be counted also, which can be
+counterproductive.
+</para>
+
+<section>
+&sectmacros;
+</para>
+
+<table><title>Commands</title>
+ <tgroup cols="2" align="left">
+  <thead>
+   <row>
+    <entry>Command</entry>
+    <entry>Description</entry>
+   </row>
+  </thead>
+  <tbody>
+   <row>
+    <entry>/curses</entry>
+    <entry>
+Echo status of tracked curses to yourself (e.g. not shown to others.)
+</entry>
+   </row>
+   <row>
+    <entry>twirl &lt;target&gt;</entry>
+    <entry>
+BatMUD's 'twirl' emote is used to report curses to party report-channel.
 </entry>
    </row>
   </tbody>
@@ -2023,6 +2159,10 @@
     even if all rows aren't filled. When disabled, only the first used rows
     are shown.</entry>
    </row>
+   <row>
+    <entry>/diffpss</entry>
+    <entry>Shows diff-values of hp/sp/ep if enabled.</entry>
+   </row>
   </tbody>
  </tgroup>
 </table>
@@ -2391,9 +2531,30 @@
 strike) but it gives you some impression about what kinds of hits you mostly
 deal out. Only some weapon types are currently supported.
 </para>
+
 <screen>
-.. TODO FIXME place a 'screenshot' here ..
+,----------------------.
+| GgrTF Hit Statistics |
++-----------------------------------------------.
++-| Axes/Long blades     |----------------------|
+|horribly shred      :        (  0):     2 ( 11)|
+|shred               :        (  0):     7 ( 41)|
+|incise              :        (  0):     8 ( 47)|
+|tear                :     21 (  3):       (  0)|
+|cut                 :    462 ( 72):       (  0)|
+|lightly cut         :    157 ( 24):       (  0)|
+|                                               |
++-----------------------------------------------'
++-| Totals |-------------------------------------------+
+| Hits..: 640        ( 76%) | Crits: 17         (  2%) |
+| Misses: 192        ( 23%) | Total hit types: 6       |
++----------------------------------------------+-------'
+| Dodges..: 3          | Parries..:            |
+| Tumbles.:            | Stuns....:            |
+| Ripostes:            | Stun mano:            |
+`----------------------------------------------'
 </screen>
+
 <para>
 <emphasis>NOTICE! Hit stats REQUIRES the TF terminal window width
 to be 95 columns or more!</emphasis> If you are using TF in smaller
@@ -2567,6 +2728,7 @@
   </tbody>
  </tgroup>
 </table>
+</section>
 
 <section id="usage-merchant-settings">
 &sectvariables;
@@ -2763,7 +2925,7 @@
 <para>
 </para>
 
-<!--@MACROS GgrTF::Nun -->
+<!-- @MACROS GgrTF::Nun -->
 
 </section>
 
@@ -2840,7 +3002,7 @@
   <listitem><para>
 Remember to include information about your system and environment,
 (*NIX/Linux/Windows), version of &tfurl; ("/ver" command in TF),
-and of course the version of GgrTF ("/gver" command).
+and version of GgrTF ("/gver" command).
 </para></listitem>
 
   </itemizedlist>
--- a/ggrtf.tf	Sun Mar 22 01:59:30 2009 +0000
+++ b/ggrtf.tf	Sun Mar 22 03:25:47 2009 +0000
@@ -1,8 +1,8 @@
 ;;
-;; GgrTF v0.6.11.3-svn - TinyFugue script for BatMUD
+;; GgrTF v0.6.11.4-svn - TinyFugue script for BatMUD
 ;; (C) Copyright 2004-2009 Matti Hämäläinen (Ggr Pupunen)
 ;;
-/set ggrtf_ver=0.6.11.3-svn
+/set ggrtf_ver=0.6.11.4-svn
 ;;
 ;; This triggerset is Free Software distributed under
 ;; GNU General Public License version 2.
@@ -70,7 +70,7 @@
 	/set set_round=@@scan all%;\
 	/set set_ripcommand=@whee%;\
 	/set set_peer=embedded%;\
-	/set set_gprompt=>%;\
+	/set set_gprompt=%%{status_prompt}>%;\
 	/set set_roundmin=2%;\
 	/set set_sysinit=1%;\
 	/msq System variables initialized.
@@ -105,12 +105,13 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Macros which may be re-defined by user or in other modules
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+/def msd = /echo %*
 /def msw = /echo -p %*
 /def msq = /echo -p @{BCwhite}GgrTF@{n}: %*
 /def mss = /if (opt_skspam=~"on") /substitute -p @{BCwhite}GgrTF@{n}: %*%;/endif
-/def gerror = /msq @{BCred}ERROR!@{n} %*
-/def gwarning = /msq @{BCred}WARNING!@{n} %*
-/def goutput = %*
+/def -i gerror = /msq @{BCred}ERROR!@{n} %*
+/def -i gwarning = /msq @{BCred}WARNING!@{n} %*
+/def -i gsend = %*
 
 /def msr_real = @@party report %*
 /def msp = /if (opt_verbose=~"on") @@party say %*%;/else /msq %*%;/endif
@@ -127,7 +128,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 /set lst_busy_queue=
 
-/def msr =\
+/def -i msr =\
 	/if (opt_verbose=~"on")\
 		/if (camp_st == 2)\
 			/gmsg_que %*%;\
@@ -138,14 +139,14 @@
 		/msq %*%;\
 	/endif
 
-/def gmsg_que =\
+/def -i gmsg_que =\
 	/set lst_busy_queue=%{lst_busy_queue} $[replace(" ", "_",{*})]
 
-/def gmsg_empty_que =\
+/def -i gmsg_empty_que =\
 	/gmsg_empty_do %{lst_busy_queue}%;\
 	/unset lst_busy_queue
 
-/def gmsg_empty_do =\
+/def -i gmsg_empty_do =\
 	/while ({#})\
 		/test msr_real(replace("_"," ",{1}))%;\
 		/shift%;\
@@ -334,10 +335,10 @@
 				/msq @{Cyellow}%{opt_d}@{n} : @{BCgreen}Cleared@{n}%%%;\
 			/else \
 				/set set_%{opt_n}=%%%{*}%%%;\
-				/msq @{Cyellow}%{opt_d}@{n} [@{Cgreen}%%%{*}@{n}]%%%;\
+				/msq @{Cyellow}%{opt_d}@{n} [@{Cgreen}$$$[replace("@","@@",{*})]@{n}]%%%;\
 			/endif%%%;\
 		/else \
-			/msq @{Cyellow}%{opt_d}@{n} : [@{Cgreen}%%%{set_%{opt_n}}@{n}]%%%;\
+			/msq @{Cyellow}%{opt_d}@{n}: [@{Cgreen}$$$[replace("@","@@",set_%{opt_n})]@{n}]%%%;\
 			/msq Use "@{BCyellow}/%{opt_n} *@{n}" to clear.%%%;\
 		/endif
 
@@ -690,7 +691,7 @@
 	/let _bval_d=$[prgetval(strcat("set_",{1},"_d"))]%;\
 	/msw |--------------------------------------------------------------------------|%;\
 	/msw | /@{BCyellow}$[pad({1},-10)]@{n} : $[pad(_bval_d,-58)] |%;\
-	/msw |             [@{Cgreen}$[prsubipad(_bval,58)]@{n}] |%;\
+	/msd |             [$[prsubipad(_bval,58)]] |%;\
 	/shift%;\
 /done
 
@@ -712,7 +713,6 @@
 /prdeftoggle -n"skspam"		-d"Skill/Spell start/end 'lite' spam"
 /prdeftoggle -n"rrounds"	-d"Report spell/skill rounds"
 /prdeftoggle -n"autopss"	-d"Auto party short status"
-/prdeftoggle -n"info"		-d"Cast/skill information in prompt"
 /prdeftoggle -n"gagsc"		-d"Gag Short Score ('sc') messages"
 /prdefvalue -n"round"		-d"Commands to execute on each battle round marker"
 /prdefvalue -n"roundmin"	-d"Amount of rounds left when to report"
@@ -721,7 +721,7 @@
 /prdeftoggle -n"rcda"		-d"Combat Damage Analysis reporting"
 /set opt_rcda=on
 
-/def pss = @party status short
+/def -i pss = @@party status short
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -896,9 +896,11 @@
 
 
 ;; Grab SHORT SCORE (sc)
-/def -i -F -ag -p9999 -mregexp -t"^H:(-?[0-9]+)/(-?[0-9]+) S:(-?[0-9]+)/(-?[0-9]+) E:(-?[0-9]+)/(-?[0-9]+) \$:(-?[0-9]+) exp:(-?[0-9]+)$" gstatus_sc1=\
-	/if (opt_gagsc!~"on")\
-	/msw H:$[prgetqd({P1},{P2},status_qhp)] S:$[prgetqd({P3},{P4},status_qsp)] E:$[prgetqd({P5},{P6},status_qep)] \$:%{P7} $[prgetdiff({P7},status_qmoney)] exp:%{P8} $[prgetdiff({P8},status_qexp)]%;\
+/def -i -F -p9999 -mregexp -t"^H:(-?[0-9]+)/(-?[0-9]+) S:(-?[0-9]+)/(-?[0-9]+) E:(-?[0-9]+)/(-?[0-9]+) \$:(-?[0-9]+) exp:(-?[0-9]+)$" gstatus_sc1=\
+	/if (opt_gagsc=~"on")\
+		/substitute -ag%;\
+	/else \
+		/mss H:$[prgetqd({P1},{P2},status_qhp)] S:$[prgetqd({P3},{P4},status_qsp)] E:$[prgetqd({P5},{P6},status_qep)] \$:%{P7} $[prgetdiff({P7},status_qmoney)] exp:%{P8} $[prgetdiff({P8},status_qexp)]%;\
 	/endif%;\
 	/test gstatus_scupd({P1},{P2},{P3},{P4},{P5},{P6},{P7},{P8})
 
@@ -908,20 +910,18 @@
 
 
 ;; Grab PROMPT
-;"H:336/336 S:1049/1049 E:243/243 >"
-/def -i -mregexp -h"PROMPT H:(-?[0-9]+)/(-?[0-9]+) S:(-?[0-9]+)/(-?[0-9]+) E:(-?[0-9]+)/(-?[0-9]+) >$" gstatus_prompt=\
-	/set status_hp=%{P1}%;/set status_hpmax=%{P2}%;\
-	/set status_sp=%{P3}%;/set status_spmax=%{P4}%;\
-	/set status_ep=%{P5}%;/set status_epmax=%{P6}%;\
-	/if (opt_info=~"on" & cast_info!~"" & cast_info_n!~"") \
+/def -i -p9999 -mregexp -h"PROMPT PROMPT:(.*)>$" gstatus_prompt=\
+	/set status_prompt=$[strip_attr({P1})]%;\
+	/if (cast_info!~"" & cast_info_n!~"") \
 		/if (cast_info_t!~"") \
-			/test prompt("%{cast_info}[%{cast_info_n} -> %{cast_info_t}] >")%;\
+			/set prompt_cast=%{cast_info}[%{cast_info_n} -> %{cast_info_t}]%;\
 		/else \
-			/test prompt("%{cast_info}[%{cast_info_n}] >")%;\
+			/set prompt_cast=%{cast_info}[%{cast_info_n}]%;\
 		/endif%;\
 	/else \
-		/eval /test prompt("%{set_gprompt}")%;\
-	/endif
+		/set prompt_cast=%;\
+	/endif%;\
+	/eval /prompt -p %{set_gprompt}
 
 /prdefvalue -n"gprompt" -d"GgrTF prompt string"
 
@@ -931,9 +931,9 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 /set ggrtf_copy=(C) Copyright 2004-2009 Matti Hämäläinen (Ggr Pupunen) and others
 
-/def gver = /result "GgrTF %{ggrtf_ver}"
+/def -i gver = /result "GgrTF %{ggrtf_ver}"
 
-/def gversion =\
+/def -i gversion =\
 	/result "GgrTF v%{ggrtf_ver} %{ggrtf_copy} on TinyFugue $[ver()]"
 
 /prdeftoggle -n"repver" -d"Report version via 'hopple inquisitively'"
@@ -1010,7 +1010,7 @@
 
 
 ;; Reset prots
-/def cprots =\
+/def -i cprots =\
 	/msq @{BCgreen}NOTICE!@{n} @{BCwhite}Clearing status of all prots.@{n}%;\
 	/prclearprots %{lst_prots}%;\
 	/gprots_get%;/gstatus_update
@@ -1205,7 +1205,7 @@
 
 
 ;; Prot reporting
-/def prots = /msq $[gprots_get()]
+/def -i prots = /msq $[gprots_get()]
 
 /prdefgbind -s"prots" -c"/prots"
 
@@ -1540,7 +1540,7 @@
 
 
 ;; Curse reporting
-/def curses = /msq $[gcurses_get()]
+/def -i curses = /msq $[gcurses_get()]
 
 /prdefgbind -s"curses" -c"/curses"
 
@@ -1864,7 +1864,7 @@
 
 ;; Ambush
 /set ambush_t=0
-/def -i -p9999 -aCred -msimple -t"You cannot leave, you have been AMBUSHED." gmisc_ambush1 =\
+/def -i -F -p9999 -aCred -msimple -t"You cannot leave, you have been AMBUSHED." gmisc_ambush1 =\
 	/if (time()-ambush_t > 5)\
 		/set ambush_t=$[time()]%;\
 		/msm AMBUSHED!%;\
@@ -1890,13 +1890,13 @@
 	/msm Poison removed!
 
 ;; Uncon
-/def -i -p9999 -ag -mregexp -t"^([A-Z][A-Za-z]+) lapses into unconsciousness from severe loss of blood.$" gmisc_uncon =\
+/def -i -F -p9999 -ag -mregexp -t"^([A-Z][A-Za-z]+) lapses into unconsciousness from severe loss of blood.$" gmisc_uncon =\
 	/msq @{BCred}!!!@{n} @{BCwhite}%{P1}@{n} is @{BCgreen}UNCON@{n} @{BCred}!!!@{n}%;\
 	/msm %{P1} is UNCON!
 
 
 ;; Warn about changes in party formation
-/def -i -p9999 -ag -mregexp -t"^([A-Z][a-z]+) is now in the 1st row.$" gmisc_firstrow =\
+/def -i -F -p9999 -ag -mregexp -t"^([A-Z][a-z]+) is now in the 1st row.$" gmisc_firstrow =\
 	/msq @{BCred}!!!@{n} @{BCwhite}%{P1}@{n} @{BCyellow}is now in 1st row@{n} @{BCred}!!!@{n}%;\
 	/if ({P1}=~set_plrname) /msm %{P1} is now in 1st row!%;/endif
 
@@ -2124,9 +2124,9 @@
 		/shift%;\
 	/done
 
-/def comppath = /prcomppath %{path}%;/echo Compressed Path: %{qtzst}
-/def csavepath = /prcomppath %{path}%;@command %1 %{qtzst}
-/def reversepath = /prreversepath %{path}%;/echo Reversed Path: %{qtzst}
+/def -i comppath = /prcomppath %{path}%;/echo Compressed Path: %{qtzst}
+/def -i csavepath = /prcomppath %{path}%;@command %1 %{qtzst}
+/def -i reversepath = /prreversepath %{path}%;/echo Reversed Path: %{qtzst}
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;