Mercurial > hg > batmud > ggrtf
view ggrtf.tf @ 665:fbe727e4dd9b
Fixed an old problem in sc/prompt handling triggers, noticed by Renilauv.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 19 Sep 2007 15:15:15 +0000 |
parents | 47f881160fc1 |
children | 8722a7a1b306 |
line wrap: on
line source
;; ;; GgrTF v0.6.2-pre5 - TinyFugue script for BatMUD ;; (C) Copyright 2004-2007 Matti Hämäläinen (Ggr Pupunen) ;; /set ggrtf_ver=0.6.2-pre5 ;; ;; This triggerset is Free Software distributed under ;; GNU General Public License version 2. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; For installation instructions, and more information, ;; please refer to GgrTF's homepage and user's manual. ;; ;; http://ccr.tnsp.org/ggrtf/ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The actual scriptcode starts here: initialize, load prereqs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set warn_status=off /set status_pad=_ /def -i greset =\ /prdefivar cnt_date $[time()]%;\ /prdefivar cnt_casts 0%;\ /prdefivar cnt_scasts 0%;\ /prdefivar cnt_icasts 0%;\ /prdefivar cnt_fcasts 0%;\ /prdefivar cnt_fucasts 0%;\ /prdefivar cnt_hastes 0%;\ /prdefivar cnt_ghastes 0%;\ /prdefivar cnt_qlips1 0%;\ /prdefivar cnt_qlips2 0%;\ /prdefivar cnt_qlips3 0%;\ /prdefivar cnt_trounds 0%;\ /prdefivar cnt_damcrits 0%;\ /prdefivar cnt_dcrit1 0%;\ /prdefivar cnt_dcrit2 0%;\ /prdefivar cnt_dcrit3 0%;\ /prdefivar cnt_dcrit4 0%;\ /prdefivar cnt_skills 0%;\ /prdefivar cnt_sskills 0%;\ /prdefivar cnt_iskills 0%;\ /prdefivar cnt_fskills 0%;\ /prdefivar cnt_fuskills 0%;\ /prdefivar cnt_ctime 0%;\ /prdefivar cnt_sktime 0%;\ /prexecfuncs %{lst_resetfuncs}%;\ /set set_cntinit=1%;\ /msq Global counters reset. /def -i ginitialize =\ /prdefvar -n"status_pad" -v"_" -c"The padding character used in displaying the status area in TF visual mode"%;\ /prdefvar -n"status_attr" -v"" -c"The attributes used to display the status area in TF visual mode" %;\ /prdefvar -n"fmt_date" -v"%%%c" -c"ftime() formatting string used for dates"%;\ /prdefvar -n"opt_bindings" -v"off" -c"Whether command bindings are loaded/defined in startup (on/off)"%;\ /set battle_target=%;\ /set battle_st=0%;\ /set spell_st=off%;\ /set skill_st=off%;\ /set stun_st=off%;\ /set camp_st=1%;\ /set cast_info=%;\ /set cast_info_t=%;\ /set cast_info_n=%;\ /set opt_verbose=on%;\ /set set_round=@@scan all%;\ /set set_ripcommand=@whee%;\ /set set_peer=embedded%;\ /set set_roundmin=2%;\ /set set_sysinit=1%;\ /msq System variables initialized. /set cnt_def_fail=0 /set lst_resetfuncs= /set event_battle_rip=ripfunc /set event_battle_end= /set event_battle_round= /set event_tick_sc= /set event_skill_intr= /set event_spell_intr= /set lst_stats_spell= /set lst_stats_skill= /set status_hp= /set status_hpmax= /set status_sp= /set status_spmax= /set status_ep= /set status_epmax= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Macros which may be re-defined by user or in other modules ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /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 msr_real = @@party report %* /def msp = /if (opt_verbose=~"on") @@party say %*%;/else /msq %*%;/endif /def mse = /if (opt_verbose=~"on") @@party say emote %*%;/else /msq %*%;/endif /def msb = @party report %* /def dig_grave = @@dig grave /def eat_corpse = @@get corpse%;@@eat corpse /def get_corpse = @@get corpse ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Report message queuing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set lst_busy_queue= /def msr =\ /if (opt_verbose=~"on")\ /if (camp_st == 2)\ /test gmsg_que({*})%;\ /else \ /test msr_real({*})%;\ /endif%;\ /else \ /test msq({*})%;\ /endif /def gmsg_que =\ /set lst_busy_queue=%{lst_busy_queue} $[replace(" ", "_",{*})] /def gmsg_empty_que =\ /gmsg_empty_do %{lst_busy_queue}%;\ /unset lst_busy_queue /def gmsg_empty_do =\ /while ({#})\ /test msr_real(replace("_"," ",{1}))%;\ /shift%;\ /done ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Helper macros/functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /def -i prconvto = /return tolower(replace(" ","_",{1})) /def -i prconvfrom = /return replace("_"," ",strcat(toupper(substr({1},0,1)),substr({1},1))) /def -i prconvpm = /return replace("_"," ",{1}) ;; Return ratio of 2 arguments (avoid divide by zero) /def -i prdiv = /if ({2} != 0) /return {1}/{2}%;/else /return 0%;/endif ;; Return ratio of 2 arguments rounded to two decimals /def -i prstdiv = /return prround(prdiv({1},{2}),2) ;; Return a substring of given string with specified maxlen, padded to maxlen /def -i prsubpad = /return pad(substr({1},0,{2}),{2}) /def -i prsubipad = /return pad(substr({1},0,{2}),-{2}) ;; Return a string containing a floating point value, ;; truncated to specified number of decimal digits maximum. /def -i prround =\ /let _rval=$[{1}*1.0]%;\ /let _rpos=$[strchr(_rval,".")]%;\ /if (_rpos >= 0)\ /if ({2} > 0)\ /return strcat(substr(_rval,0,_rpos),substr(_rval,_rpos,{2}+1))%;\ /else \ /return substr(_rval,0,_rpos)%;\ /endif%;\ /else \ /return _rval%;\ /endif ;; Return string describing timestamp in "[[??h]??m]??s" format /def -i prgettime =\ /if ({1} > 0)\ /let _jtime=$[trunc({1})]%;\ /let _jtimeh=$[_jtime/3600]%;\ /let _jtimeq=$[mod(_jtime,3600)]%;\ /if (_jtimeh > 0)\ /let _jstr=%{_jtimeh}h%;\ /else \ /let _jstr=%;\ /endif%;\ /let _jstr=%{_jstr}$[_jtimeq/60]m$[mod(_jtimeq,60)]s%;\ /return _jstr%;\ /else \ /return ""%;\ /endif ;; Return given string post-padded to specified length with specified character ;; prpadwith(string,length,char) /def -i prpadwith =\ /let _tmps=%;\ /let _tmpc=$[{2}-strlen({1})]%;\ /while (_tmpc > 0) /let _tmps=%{_tmps}%{3}%;/let _tmpc=$[_tmpc-1]%;/done%;\ /return strcat({1},_tmps) ;; If string is longer than specified max, cut and pad with ellipsis (...) /def -i prsubstr =\ /if (strlen({1})>{2})\ /return "$[substr({1},0,{2}-3)]..."%;\ /else \ /return {1}%;\ /endif ;; Return string describing time elapsed from given timestamp parameter /def -i prgetstime =\ /let _tmps=$[prgettime(time()-{1})]%;\ /if (_tmps!~"") /return "[%{_tmps}]"%;/else /return ""%;/endif ;; Return a color definition based on [n, nmax] (useful for hp/sp/ep lites) /def -i prgetnlite =\ /if ({1} < 0) /return "BCwhite,BCbgred"%;/endif%;\ /if ({1} < {2}*0.16) /return "BCred"%;/endif%;\ /if ({1} < {2}*0.33) /return "Cred"%;/endif%;\ /if ({1} < {2}*0.49) /return "Cyellow"%;/endif%;\ /if ({1} < {2}*0.66) /return "BCyellow"%;/endif%;\ /if ({1} < {2}*0.85) /return "Cgreen"%;/endif%;\ /return "BCgreen" ;; Execute macros given as parameters /def -i prexecfuncs =\ /while ({#})\ /eval /%{1}%;\ /shift%;\ /done ;; Create prettyprint version of a numeric value /def -i prprettyvalstr =\ /let _jval=$[abs({1})]%;\ /let _jtmp=$[_jval-trunc(_jval)]%;\ /if (_jtmp > 0)\ /let _jstr=$[substr(_jtmp,1,3)]%;\ /else \ /let _jstr=%;\ /endif%;\ /while (_jval >= 1000)\ /let _jstr=,$[replace(" ","0",pad(mod(_jval, 1000.0),3))]%{_jstr}%;\ /let _jval=$[trunc(_jval / 1000)]%;\ /done%;\ /let _jstr=%{_jval}%{_jstr}%;\ /if ({1} < 0) /let _jstr=-%{_jstr}%;/endif%;\ /return _jstr ;; Insert item into list-string variable if it does not exist ;; /prlist_insert("list variable name", "item") /def -i prlist_insert =\ /eval /set _prlist= $$[%{1}] %;\ /if (regmatch(strcat("(^",{2},"| ",{2}," | ",{2},"$)"),_prlist) <= 0)\ /eval /set %{1}=%%{%{1}} %{2}%;\ /return 1%;\ /else \ /return 0%;\ /endif ;; Delete item from list-string variable ;; /prlist_delete("list variable name", "item") /def -i prlist_delete_do =\ /let _tdname=%{1}%;/shift%;\ /let _tditem=%{1}%;/shift%;\ /let _tdlist=%;\ /while ({#})\ /if ({1}!~_tditem)\ /let _tdlist=%{_tdlist} %{1}%;\ /endif%;\ /shift%;\ /done%;\ /eval /set %{_tdname}=%{_tdlist} /def -i prlist_delete =\ /eval /prlist_delete_do %{1} %{2} $$[%{1}] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Option, setting and hook definition macros ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define an togglable option ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set lst_options= /def -i prdeftoggle =\ /if (!getopts("n:d:", "")) /gerror Invalid toggle creation command!%;/break%;/endif%;\ /if (opt_n=~""|opt_d=~"") /gerror Required arguments not specified!%;/break%;/endif%;\ /test prlist_insert("lst_options", opt_n)%;\ /set opt_%{opt_n}_d=%{opt_d}%;\ /eval /def -i %{opt_n} =\ /if (opt_%{opt_n}=~"on")\ /set opt_%{opt_n}=off%%%;\ /let _qstr=@{Cred}OFF@{n}%%%;\ /else \ /set opt_%{opt_n}=on%%%;\ /let _qstr=@{BCgreen}ON@{n}%%%;\ /endif%%%;\ /msq @{Cyellow}%{opt_d}@{n} [%%%{_qstr}] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define a value setting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set lst_values= /def -i prdefvalue =\ /if (!getopts("n:d:", "")) /gerror Invalid value setting creation command!%;/break%;/endif%;\ /if (opt_n=~""|opt_d=~"") /gerror Required arguments not specified!%;/break%;/endif%;\ /test prlist_insert("lst_values", opt_n)%;\ /set set_%{opt_n}_d=%{opt_d}%;\ /eval /def -i %{opt_n} =\ /if ({#}) \ /if ({1}=~"*") \ /set set_%{opt_n}=%%%;\ /msq @{Cyellow}%{opt_d}@{n} : @{BCgreen}Cleared@{n}%%%;\ /else \ /set set_%{opt_n}=%%%{*}%%%;\ /msq @{Cyellow}%{opt_d}@{n} [@{Cgreen}%%%{*}@{n}]%%%;\ /endif%%%;\ /else \ /msq @{Cyellow}%{opt_d}@{n} : [@{Cgreen}%%%{set_%{opt_n}}@{n}]%%%;\ /msq Use "@{BCyellow}/%{opt_n} *@{n}" to clear.%%%;\ /endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define a setting with legal values ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set lst_settings= /def -i prchksetting =\ /set _prdeftmp=0%;\ /let _qvs=%{1}%;\ /shift%;\ /while ({#})\ /if ({1}=~_qvs) /set _prdeftmp=1%;/break%;/endif%;\ /shift%;\ /done /def -i prdefsetting =\ /if (!getopts("n:d:s:", "")) /gerror Invalid setting creation command!%;/break%;/endif%;\ /if (opt_n=~""|opt_d=~""|opt_s=~"") /gerror Required arguments not specified!%;/break%;/endif%;\ /test prlist_insert("lst_settings", opt_n)%;\ /set set_%{opt_n}_d=%{opt_d}%;\ /set set_%{opt_n}_s=%{opt_s}%;\ /eval /def -i %{opt_n} =\ /if ({#})\ /prchksetting %%%{1} %%%{set_%{opt_n}_s}%%%;\ /if (_prdeftmp > 0)\ /set set_%{opt_n}=%%%{1}%%%;\ /msq @{Cyellow}%{opt_n}@{n} : Set to [@{BCgreen}%%%{set_%{opt_n}}@{n}]%%%;\ /else \ /msq @{Cyellow}%{opt_n}@{n} : @{BCred}Invalid setting@{n} [@{BCgreen}%%%{1}@{n}]!%%%;\ /endif%%%;\ /else \ /msq @{BCred}/%{opt_n}@{n} - @{Cyellow}%{opt_d}@{n} [@{BCgreen}%%%{set_%{opt_n}_s}@{n}]%%%;\ /endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define a function hook setting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set lst_hooks= /def -i prdefhook =\ /if (!getopts("n:d:s:h:", "")) /gerror Invalid function hook setting creation command!%;/break%;/endif%;\ /if (opt_n=~""|opt_d=~""|opt_s=~""|opt_h=~"") /gerror Required arguments not specified!%;/break%;/endif%;\ /test prlist_insert("lst_hooks", opt_n)%;\ /set set_%{opt_n}_d=%{opt_d}%;\ /set set_%{opt_n}_s=%{opt_s}%;\ /eval /def -i %{opt_n} =\ /if ({#})\ /prchksetting %%%{1} %%%{set_%{opt_n}_s}%%%;\ /if (_prdeftmp > 0)\ /set set_%{opt_n}=%%%{1}%%%;\ /msq @{Cyellow}%{opt_n}@{n} : Set to [@{BCgreen}%%%{set_%{opt_n}}@{n}]%%%;\ /eval /def -i %{opt_h}=/%{opt_h}_%%%{1} %%%%%*%%%;\ /else \ /msq @{Cyellow}%{opt_n}@{n} : @{BCred}Invalid setting@{n} [@{BCgreen}%%%{1}@{n}]!%%%;\ /endif%%%;\ /else \ /msq @{BCred}/%{opt_n}@{n} - @{Cyellow}%{opt_d}@{n} [@{BCgreen}%%%{set_%{opt_n}_s}@{n}]%%%;\ /endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variable saving functionality ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define a global, saveable variable /set lst_savevars= /def -i prdefvar =\ /if (!getopts("n:v:c:", "")) /gerror Invalid save variable definition!%;/break%;/endif%;\ /if (opt_n=~"") /gerror No variable name option specified.%;/break%;/endif%;\ /if (opt_c!~"") /set comment_%{opt_n}=%{opt_c}%;/endif%;\ /test prlist_insert("lst_savevars", opt_n)%;\ /eval /set _dsv=$$[%{opt_n}]%;\ /if (opt_v!~"" & _dsv=~"")\ /eval /set %{opt_n}=%{opt_v}%;\ /endif /set lst_saveivars= /def -i prdefivar =\ /if ({#} < 1) /gerror No arguments specified, at least variable name is required!%;/break%;/endif%;\ /test prlist_insert("lst_saveivars", {1})%;\ /eval /set %{1}=%{-1} ;; Save given list of variables (set 'gsave_varpref' to prefix) /def -i gsave_vars =\ /while ({#})\ /eval /set _gsa=%%{comment_%{gsave_varpref}%{1}}%;\ /if (_gsa!~"")\ /set _gsa=; %{_gsa}%;\ /if (tfwrite(gsave_file,_gsa) < 0)\ /gerror Error writing to file '@{Cyellow}%{gsave_filename}@{n}'!%;\ /return%;\ /endif%;\ /endif%;\ /eval /set _gsa=/set %{gsave_varpref}%{1}=%%{%{gsave_varpref}%{1}}%;\ /if (tfwrite(gsave_file,_gsa) < 0)\ /gerror Error writing to file '@{Cyellow}%{gsave_filename}@{n}'!%;\ /return%;\ /endif%;\ /if (tfwrite(gsave_file,"") < 0)\ /gerror Error writing to file '@{Cyellow}%{gsave_filename}@{n}'!%;\ /return%;\ /endif%;\ /shift%;\ /done ;; Save given list of hooks /def -i gsave_hooks =\ /while ({#})\ /eval /set _gsa=/%{1} %%{set_%{1}}%;\ /if (tfwrite(gsave_file,_gsa) < 0)\ /gerror Error writing to file '@{Cyellow}%{gsave_filename}@{n}'!%;\ /return%;\ /endif%;\ /shift%;\ /done ;; Save a separator /def -i gsave_separator =\ /let _ss=;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%;\ /if (tfwrite(gsave_file,_ss) < 0)\ /gerror Error writing to file '@{Cyellow}%{gsave_filename}@{n}'!%;\ /return%;\ /endif ;; Save a header string /def -i gsave_header =\ /gsave_separator%;\ /let _ss=;; GgrTF v%{ggrtf_ver} %{1}-INIT savefile ($[ftime(fmt_date,time())])%;\ /if (tfwrite(gsave_file,_ss) < 0)\ /gerror Error writing to file '@{Cyellow}%{gsave_filename}@{n}'!%;\ /return%;\ /endif%;\ /gsave_separator ;; Save status /def -i gsave =\ /let _spreinit=%{set_datapath}%{set_saveprefix}pre.tf%;\ /let _spostinit=%{set_datapath}%{set_saveprefix}post.tf%;\ /msq @{BCgreen}Saving pre-init settings to@{n} '@{Cyellow}%{_spreinit}@{n}'%;\ /set gsave_file=$[tfopen(_spreinit, "w")]%;\ /if (gsave_file < 0)\ /gerror Could not create/open savefile '@{Cyellow}%{_spreinit}@{n}'!%;\ /else \ /set gsave_filename=%{_preinit}%;\ /gsave_header PRE%;\ /set gsave_varpref=%;/gsave_vars %{lst_savevars}%;\ /test tfclose(gsave_file)%;\ /endif%;\ /msq @{BCgreen}Saving post-init settings to@{n} '@{Cyellow}%{_spostinit}@{n}'%;\ /set gsave_file=$[tfopen(_spostinit, "w")]%;\ /if (gsave_file < 0)\ /gerror Could not create/open savefile '@{Cyellow}%{_spostinit}@{n}'!%;\ /else \ /set gsave_filename=%{_preinit}%;\ /gsave_header POST%;\ /set gsave_varpref=%;/gsave_vars %{lst_saveivars}%;\ /gsave_separator%;\ /gsave_hooks %{lst_hooks}%;\ /gsave_separator%;\ /set gsave_varpref=set_%;/gsave_vars %{lst_settings}%;\ /gsave_separator%;\ /set gsave_varpref=set_%;/gsave_vars %{lst_values}%;\ /gsave_separator%;\ /set gsave_varpref=opt_%;/gsave_vars %{lst_options}%;\ /test tfclose(gsave_file)%;\ /endif%;\ /msq @{BCgreen}Done.@{n}%;\ ;; Load status /def -i gload =\ /let _spreinit=%{set_datapath}%{set_saveprefix}pre.tf%;\ /let _spostinit=%{set_datapath}%{set_saveprefix}post.tf%;\ /msq @{BCgreen}Loading post-init settings from@{n} '@{Cyellow}%{_spostinit}@{n}'%;\ /load -q %{_spostinit}%;\ /msq @{BCgreen}Done.@{n}%;\ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Hooks and bindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set lst_bindings= ;; Define a generic command/macro bind ; -s"<name>" String to bind ; -c"<command>" Command/macro to be executed ; -n Does not need/accept arguments /def -i prdefgbind =\ /if (!getopts("s:c:n", "")) /gerror Invalid bind creation command!%;/break%;/endif%;\ /if (!prlist_insert("lst_bindings", opt_s)) /gwarning Binding for '%{opt_s}' already defined!%;/endif%;\ /set bind_%{opt_s}_n=2%;\ /set bind_%{opt_s}_t=G%;\ /set bind_%{opt_s}_c=%{opt_c}%;\ /if (opt_n)\ /let _qs=%;\ /else \ /let _qs= %%%{-1}%;\ /endif%;\ /eval /def -i -h"SEND {%{bind_prefix}%{opt_s}}*" bind_%{opt_s} = %{opt_c}%{_qs} ;; Define a skill bind with optional party reporting ; -s"<name>" String to bind ; -c"<skill name>" Name of the skill to be executed ; -n Skill does not use a target ; -d"<message>" Use non-default message for reporting ; -q Quiet (no reporting) /def -i prdefsbind =\ /if (!getopts("s:c:m:d:nq", "")) /gerror Invalid bind creation command!%;/break%;/endif%;\ /if (!prlist_insert("lst_bindings", opt_s)) /gwarning Binding for '%{opt_s}' already defined!%;/endif%;\ /set bind_%{opt_s}_t=S%;\ /set bind_%{opt_s}_c=%{opt_c}%;\ /let _qs=$[tolower(opt_c)]%;\ /if (opt_d!~"") /let _qm=%{opt_d}%;/else /let _qm=%{opt_c}%;/endif%;\ /if (opt_n)\ /set bind_%{opt_s}_n=0%;\ /let _qw=%{_qm} ...%;\ /else \ /set bind_%{opt_s}_n=1%;\ /let _qw=%{_qm} -> %%%{-1}%;\ /let _qs='%{_qs}' %%%{-1}%;\ /endif%;\ /if (opt_q)\ /eval /def -i -h"SEND {%{bind_prefix}%{opt_s}}*" bind_%{opt_s} =\ @use %{_qs}%;\ /else \ /eval /def -i -h"SEND {%{bind_prefix}%{opt_s}}*" bind_%{opt_s} =\ /msb %{_qw}%%%;@use %{_qs}%;\ /endif ;; Define a spellcasting (at a target) bind with optional party reporting ; Usage same as with /prdefsbind /def -i prdefcbind =\ /if (!getopts("s:c:d:nq", "")) /gerror Invalid bind creation command!%;/break%;/endif%;\ /if (!prlist_insert("lst_bindings", opt_s)) /gwarning Binding for '%{opt_s}' already defined!%;/endif%;\ /set bind_%{opt_s}_t=C%;\ /set bind_%{opt_s}_c=%{opt_c}%;\ /let _qs=$[tolower(opt_c)]%;\ /if (opt_d!~"") /let _qm=%{opt_d}%;/else /let _qm=%{opt_c}%;/endif%;\ /if (opt_n)\ /set bind_%{opt_s}_n=0%;\ /let _qw=%{_qm} ...%;\ /else \ /set bind_%{opt_s}_n=1%;\ /let _qw=%{_qm} -> %%%{-1}%;\ /let _qs='%{_qs}' %%%{-1}%;\ /endif%;\ /if (opt_q)\ /eval /def -i -h"SEND {%{bind_prefix}%{opt_s}}*" bind_%{opt_s} =\ @cast %{_qs}%;\ /else \ /eval /def -i -h"SEND {%{bind_prefix}%{opt_s}}*" bind_%{opt_s} =\ /msb %{_qw}%%%;@cast %{_qs}%;\ /endif ;; List bindings /def -i gbindings_dolist =\ /while ({#})\ /eval /set qtval_t=$$[bind_%{1}_t]%;\ /eval /set qtval_c=$$[bind_%{1}_c]%;\ /eval /set qtval_n=$$[bind_%{1}_n]%;\ /if (qtval_n==0) /let _ttc=Cred%;/let _tt=No%;\ /elseif (qtval_n==1) /let _ttc=Cgreen%;/let _tt=Yes%;\ /else /let _ttc=Ccyan%;/let _tt=?%;/endif%;\ /if (qtval_t=~"G") /let _tc=BCred%;\ /elseif (qtval_t=~"S") /let _tc=BCgreen%;\ /elseif (qtval_t=~"C") /let _tc=BCcyan%;\ /else /let _tc=%{BCwhite}%;/endif%;\ /msw | @{BCyellow}$[prsubipad({1},14)]@{n} | @{%{_tc}}%{qtval_t}@{n} | @{BCmagenta}$[prsubipad(qtval_c,40)]@{n} | @{%{_ttc}}$[pad(_tt,3)]@{n} |%;\ /shift%;\ /done /def -i binds =\ /msw ,----------------.%;\ /msw | @{BCgreen}GgrTF@{n} @{Cyellow}Bindings@{n} |%;\ /msw +----------------+----------------------------------------------------.%;\ /gbindings_dolist %{lst_bindings}%;\ /msw `---------------------------------------------------------------------' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Report current statistics ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /def -i prprints =\ /if ({1}!~"")\ /msw | $[prpadwith({1},18,".")]: $[pad({2},-47)] |%;\ /else \ /msw | $[pad("",-18)]: $[pad({2},-47)] |%;\ /endif /def -i prprintl =\ /msw |$[prpadwith("",69,"-")]| /def -i stats =\ /msw ,------------------.%;\ /msw | @{BCgreen}GgrTF@{n} @{Cyellow}Statistics@{n} |%;\ /msw +------------------+--------------------------------------------------.%;\ /test prprints("Gathered since", "$[ftime(fmt_date,cnt_date)]")%;\ /prprintl%;\ /test prprints("Spells", "%{cnt_casts} casts total, %{cnt_scasts} successful.")%;\ /test prprints(" uncompleted", "%{cnt_fcasts} failed, %{cnt_icasts} interrupted, %{cnt_fucasts} fumbled.")%;\ /test prprints(" hastes", "%{cnt_hastes} hastes, %{cnt_ghastes} ghastes, %{cnt_trounds} total rounds.")%;\ /test prprints(" time spent", "$[prgettime(cnt_ctime)] ($[prround(cnt_ctime,2)]s) total, $[prstdiv(cnt_ctime,cnt_trounds)]s/rnd, $[prstdiv(cnt_ctime,cnt_scasts)]s/cast")%;\ /test prprints(" crits", "%{cnt_damcrits} total, %{cnt_dcrit1} lvl#1, %{cnt_dcrit2} lvl#2, %{cnt_dcrit3} lvl#3")%;\ /test prprints("", "%{cnt_dcrit4} mage essence")%;\ /prexecfuncs %{lst_stats_spell}%;\ /prprintl%;\ /test prprints("Skills", "%{cnt_skills} skills total, %{cnt_sskills} successful.")%;\ /test prprints(" uncompleted", "%{cnt_fskills} fail, %{cnt_iskills} intr, %{cnt_fuskills} fumbled.")%;\ /test prprints(" time spent", "$[prgettime(cnt_sktime)] ($[prround(cnt_sktime,2)]s) total, $[prstdiv(cnt_sktime,cnt_sskills)]s/skill")%;\ /prexecfuncs %{lst_stats_skill}%;\ /msw `---------------------------------------------------------------------' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; List available options / settings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /def -i gopts_dolist =\ /while ({#})\ /eval /set qtval=$$[opt_%{1}]%;\ /eval /set qtval_d=$$[opt_%{1}_d]%;\ /if (qtval=~"on")\ /set qtval_s=@{BCgreen} ON@{n}%;\ /else \ /set qtval_s=@{Cred}OFF@{n}%;\ /endif%;\ /msw | /@{BCyellow}$[pad({1},-10)]@{n} : $[pad(qtval_d,-45)] - [%{qtval_s}] |%;\ /shift%;\ /done /def -i gsettings_dolist =\ /while ({#})\ /eval /set qtval=$$[set_%{1}]%;\ /eval /set qtval_d=$$[set_%{1}_d]%;\ /eval /set qtval_s=$$[set_%{1}_s]%;\ /msw | /@{BCyellow}$[pad({1},-10)]@{n} : $[pad(qtval_d,-45)] - [@{Cgreen}$[pad(qtval,8)]@{n}] |%;\ /shift%;\ /done /def -i gvalues_dolist =\ /while ({#})\ /eval /set qtval=$$[set_%{1}]%;\ /eval /set qtval_d=$$[set_%{1}_d]%;\ /eval /set qtval_s=$$[set_%{1}_s]%;\ /msw |--------------------------------------------------------------------------|%;\ /msw | /@{BCyellow}$[pad({1},-10)]@{n} : $[pad(qtval_d,-58)] |%;\ /msw | [@{Cgreen}$[prsubipad(qtval,58)]@{n}] |%;\ /shift%;\ /done /def -i opts =\ /msw ,----------------.%;\ /msw | @{BCgreen}GgrTF@{n} @{Cyellow}Settings@{n} |%;\ /msw +----------------+---------------------------------------------------------.%;\ /gopts_dolist %{lst_options}%;\ /gsettings_dolist %{lst_settings}%;\ /gsettings_dolist %{lst_hooks}%;\ /gvalues_dolist %{lst_values}%;\ /msw `--------------------------------------------------------------------------' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define some generic option toggles and settings /prdeftoggle -n"verbose" -d"Verbose (off = echo to client only)" /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 executed each round" /prdefvalue -n"roundmin" -d"Amount of rounds left when to report" /def pss = @party status short ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Define RIP functions and hook /def -i prdefripfunc =\ /eval /set set_ripaction_s=%{1} %{set_ripaction_s}%;\ /eval /def -i ripfunc_%{1} = %{-1} /prdefripfunc off /prdefripfunc dig /dig_grave /prdefripfunc eat /eat_corpse /prdefripfunc get /get_corpse /prdefripfunc cmd %%{set_ripcommand} /prdefhook -n"ripaction" -d"Set the action performed at monster RIP" -h"ripfunc" -s"off dig eat get cmd" /ripaction off ;; RIP command /prdefvalue -n"ripcommand" -d"Commands to be executed if ripaction = cmd" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; LoC-action /prdefsetting -n"locaction" -d"Set action performed after blood corpse" -s"off dig eat get cmd" /locaction off ;; LoC command /prdefvalue -n"loccommand" -d"Commands to be executed if locaction = cmd" /def -i -p9999 -ag -mregexp -t"^([A-Z][a-z]+) holds (.+) over the still form of (its|her|his) fallen foe\.$" loc_blood =\ /msw @{BCyellow}%{P1}@{n} @{BCwhite}holds@{n} @{Cred}%{P2}@{n} @{BCwhite}over the still form of %{P3} fallen foe.@{n}%;\ /if (set_locaction=~"dig") /dig_grave%;\ /elseif (set_locaction=~"eat") /eat_corpse%;\ /elseif (set_locaction=~"get") /get_corpse%;\ /elseif (set_locaction=~"cmd") %{set_loccommand}%;/endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Lich-action /prdefsetting -n"lichaction" -d"Set action performed after lich sucking" -s"off dig eat get" /lichaction off /def -i -p9999 -mregexp -t"^([A-Z][a-z]+) chants with an eerie hollow voice some arcane sounding words\.$" lich_suck =\ /if (set_lichaction=~"dig") /dig_grave%;\ /elseif (set_lichaction=~"eat") /eat_corpse%;\ /elseif (set_lichaction=~"get") /get_corpse%;/endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Movement ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Catch movement commands to update the status bar /def -i -mglob -h'send {n|s|e|w|ne|sw|nw|se|u|d}' prmove_send =\ /set prmove_last=%*%;\ /gstatus_update%;\ /send %* ;; Normal movement /def -i prmove_walk = /set prmove_last=%{1}%;/gstatus_update%;@%{1} ;; Autopeering /def -i prmove_peer = /set prmove_last=%{1}%;/gstatus_update%;@%{1}%;\ /if ({1}=~"n" | {1}=~"s") /let pd1=w%;/let pd2=e%;\ /elseif ({1}=~"w" | {1}=~"e") /let pd1=n%;/let pd2=s%;\ /else /break%;/endif%;\ @@grep '(%{set_peer})' peer %{pd1}%;\ @@grep '(%{set_peer})' peer %{pd2} ;; Main handling macro for binding movemement keys, etc. /prdefhook -n"move" -d"Keyboard movement hooks" -h"prmove" -s"walk ship peer" /move walk /prdefvalue -n"peer" -d"Regular expression used with autopeering" ;; Ship movement /prdeftoggle -n"cruise" -d"Cruise speed on ship (off = sail)" /def -i prmove_ship =\ /set prmove_last=%{1}%;/gstatus_update%;\ /if ({1}=~"X") @@sail stop%;\ /elseif (opt_cruise=~"on") @@cruise %{1}%;\ /else @@sail %{1}%;/endif ;; Ship viewing setting /prdefsetting -n"shipmove" -d"Action on ship movement" -s"off view map" /shipmove off /def -i -F -mregexp -t"^The ship (sails|cruises) " gship_move =\ /if (set_shipmove=~"view") @@view%;\ /elseif (set_shipmove=~"map") @@map%;/endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Status bar ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; These macros handle the statusbar functionality. Unfortunately ; some things (like channeller energy aura), etc. are hardcoded here, ; due to some complexities in modularizing them. This might get changed ; in future, though... ;; Add value item (hp/sp/ep/etc) to status string /def -i gstatus_add_val =\ /set status_w=$[status_w+13]%;\ /eval /set qtval1v=$$[status_%{1}]%;\ /eval /set qtval2v=$$[status_%{1}max]%;\ /let qtval1=status_%{1}%;\ /let qtval2=status_%{1}max%;\ /let qtcolor=$[prgetnlite(qtval1v,qtval2v)]%;\ /set status_pstr=%{status_pstr} "[" "%{2}:":2:BCwhite %{qtval1}:-4:%{qtcolor} "/" %{qtval2}:-4:BCgreen "]" ;; Add aura item /def -i gstatus_add_aura =\ /if (prot_eaura > 0)\ /if (prot_eaura == 1) /let qtcolor=BCyellow%;/endif%;\ /if (prot_eaura == 2) /let qtcolor=BCred%;/endif%;\ /if (prot_eaura == 3) /let qtcolor=BCblue%;/endif%;\ /if (prot_eaura_weak=~"on")\ /let _utime=$[prgetstime(prot_eaura_weak_t)]%;\ /let _uweak=/" "WEAK":4:Cred "%{_utime}" "%;\ /set status_w=$[status_w+5+strlen(_utime)]%;\ /else \ /let _uweak=%;\ /endif%;\ /let _utime=$[prgetstime(prot_eaura_t)]%;\ /set status_w=$[status_w+7+strlen(_utime)]%;\ /set status_pstr=%{status_pstr} "[" "Aura%{prot_eaura}":5:%{qtcolor} "%{_utime}%{_uweak}]"%;\ /endif /def -i gstatus_get_val =\ /if ({1}=~"on") /return "BCwhite"%;/else /return "Cblue"%;/endif /def -i gstatus_get_camp =\ /if (camp_st == 1) /return "BCgreen"%;\ /elseif (camp_st == 2) /return "BCred"%;\ /else /return "BCyellow"%;/endif ;; Update statusbar /def -i gstatus_update=\ /set status_w=12%;\ /set status_pstr=%;\ /gstatus_add_val hp H%;\ /gstatus_add_val sp S%;\ /gstatus_add_val ep E%;\ /set status_pstr=%{status_pstr} "[" "%{prmove_last}":2:BCgreen "C":1:$[gstatus_get_val(ceremony_st)] "S":1:$[gstatus_get_val(spell_st)] "K":1:$[gstatus_get_val(skill_st)] "c":1:$[gstatus_get_camp()] "]"%;\ /gstatus_add_aura%;\ /let _qw=$[columns() - status_w]%;\ /if (_qw > 3) /set status_pstr=%{status_pstr} :1 "%{status_protstr2}":%{_qw}:Cgreen%;/endif%;\ /set status_fields=$[{status_pstr}] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Status short score/prompt grabbing triggers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /def -i prgetdiff =\ /let _ts=%;/let _tv=$[{1} - {2}]%;\ /if (_tv < 0) /let _ts=@{Cred}%{_tv}@{n}%;\ /elseif (_tv > 0) /let _ts=@{Cgreen}+%{_tv}@{n}%;/endif%;\ /return "[%{_ts}]" /def -i prgetqd =\ /return "@{$[prgetnlite({1},{2})]}%{1}@{n}/%{2} $[prgetdiff({1},{3})]" /def -i gstatus_scupd =\ /set status_qhp=%{1}%;/set status_hp=%{1}%;/set status_hpmax=%{2}%;\ /set status_qsp=%{3}%;/set status_sp=%{3}%;/set status_spmax=%{4}%;\ /set status_qep=%{5}%;/set status_ep=%{5}%;/set status_epmax=%{6}%;\ /set status_qmoney=%{7}%;/set status_qexp=%{8}%;\ /gprots_get%;/gstatus_update%;/prexecfuncs %{event_tick_sc} ;; 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)]%;\ /endif%;\ /test gstatus_scupd({P1},{P2},{P3},{P4},{P5},{P6},{P7},{P8}) /def -i -F -p9999 -mregexp -t"^H:(-?[0-9]+)/(-?[0-9]+) \[[+-]?[0-9]*\] S:(-?[0-9]+)/(-?[0-9]+) \[[+-]?[0-9]*\] E:(-?[0-9]+)/(-?[0-9]+) \[[+-]?[0-9]*\] \$:(-?[0-9]+) \[[+-]?[0-9]*\] exp:(-?[0-9]+) \[[+-]?[0-9]*\]$" gstatus_sc2=\ /test gstatus_scupd({P1},{P2},{P3},{P4},{P5},{P6},{P7},{P8})%;\ /if (opt_gagsc=~"on")/substitute -ag%;/endif ;; 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!~"") \ /if (cast_info_t!~"") \ /test prompt("%{cast_info}[%{cast_info_n} -> %{cast_info_t}] >")%;\ /else \ /test prompt("%{cast_info}[%{cast_info_n}] >")%;\ /endif%;\ /else \ /test prompt("GgrTF >")%;\ /endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Version reporting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /set ggrtf_copy=(C) Copyright 2004-2007 Matti Hämäläinen (Ggr Pupunen) and others /def gver = /result "GgrTF %{ggrtf_ver}" /def gversion =\ /result "GgrTF v%{ggrtf_ver} %{ggrtf_copy} on TinyFugue $[ver()]" /prdeftoggle -n"repver" -d"Report version via 'hopple inquisitively'" /set opt_repver=on /set report_ver_t=0 /def -i -E(opt_repver=~"on") -p9999 -mregexp -t"^@?([A-Z][a-z]+) hopples around you inquisitively, all bunny-like\.$" greport_ver =\ /if (time()-report_ver_t > 5)\ /set report_ver_t=$[time()]%;\ @@emoteto %{P1} is using $[gversion()]%;\ /endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Skill/spell fumble / fail definition ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; -t"<pattern>" Pattern/string for matching ; -r Use regexp instead of simple matching ; -c Type: Spell ; -k Type: Skill ; -f Fail ; -F Fumble /def -i prdeffail =\ /if (!getopts("t:rckfF", "")) /gerror Invalid fail/fumble definition!%;/break%;/endif%;\ /if (opt_c & opt_k) /gerror Skill and spell options are mutually exclusive!%;/break%;/endif%;\ /if (opt_f & opt_F) /gerror Fail and fumble options are mutually exclusive!%;/break%;/endif%;\ /if (opt_t=~"") /gerror Invalid fail/fumble definition! -t not specified or empty.%;/break%;/endif%;\ /if (opt_r) /let _tmpr=regexp%;/else /let _tmpr=simple%;/endif%;\ /if (opt_f)\ /let _tmpt=fail%;\ /let _tmpa=Cred%;\ /elseif (opt_F)\ /let _tmpt=fumble%;\ /let _tmpa=BCred%;\ /else \ /gerror Invalid fail/fumble definition! You MUST specify either -f or -F%;\ /break%;\ /endif%;\ /if (opt_c)\ /def -i -F -p9999 -m%{_tmpr} -a%{_tmpa} -t"%{opt_t}" gspell_%{_tmpt}%{cnt_def_fail} = /gspell_%{_tmpt}%;\ /elseif (opt_k)\ /def -i -F -p9999 -m%{_tmpr} -a%{_tmpa} -t"%{opt_t}" gskill_%{_tmpt}%{cnt_def_fail} = /gskill_%{_tmpt}%;\ /else \ /gerror Invalid fail/fumble definition! You must specify either -k or -c%;\ /break%;\ /endif%;\ /set cnt_def_fail=$[cnt_def_fail+1] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Prot triggers and reporting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; List of prots and conjurer prots (cprots list needed for handling/clearing minor prot prereqs) /set lst_prots= /set lst_cprots= /set lst_dmpprots= /set lst_ripprots= ;; Clear a given list of prot prerequisites /def -i prclearprotpreqs =\ /while ({#})\ /set prot_%{1}_p=0%;\ /shift%;\ /done /def -i prclearprots =\ /while ({#})\ /set prot_%{1}=0%;\ /set prot_%{1}_p=0%;\ /shift%;\ /done ;; Reset prots /def cprots =\ /msq @{BCgreen}NOTICE!@{n} Clearing status of all prots.%;\ /prclearprots %{lst_prots}%;\ /gprots_get%;/gstatus_update ;; Define a conjuprot trigger (function) /def -i prdefconju =\ /def -i -p9999 -F -aCgreen -msimple -t"%{3}" rec_%{2}_on=\ /if (prot_%{1}_p==1) /pron %{1}%{4}/endif%%;\ /set prot_%{1}_p=0 ;; Clear/setup all variables related to prot ; -i"<name>" ; -n"<shortname>" ; -l"<desc/longname>" ; -A"<prerequisite regexp #1>" ; -B"<prerequisite regexp #2>" ; -C"<prerequisite regexp #3>" ; -r Use regexp instead of simple matching ; -s Stackable prot ; -h Renewable prot (does not stack, but can be renewed) ; -p Conjurer minor typeprot (options -u, -s, -r are meaningless) ; -P Conjurer major typeprot ; -q Don't give error on proff if prot is not up ; -m DMP removes this prot (all conju prots are added automatically) ; -M RIP (player's death) removes this prot ; -e Extra counter report (don't ask) ; -z Handicap (curse, or similar) /def -i prdefprot =\ /if (!getopts("i:n:l:A:B:C:u:d:srhpPqmMez", "")) /gerror Invalid prot definition!%;/break%;/endif%;\ /set lst_prots=%{opt_i} %{lst_prots}%;\ /set prot_%{opt_i}=0%;\ /set prot_%{opt_i}_t=-1%;\ /set prot_%{opt_i}_n=%{opt_n}%;\ /set prot_%{opt_i}_l=%{opt_l}%;\ /set prot_%{opt_i}_p=0%;\ /set prot_%{opt_i}_st=0%;\ /set prot_%{opt_i}_w=0%;\ /if (opt_z) /set prot_%{opt_i}_hcap=1%;/else /set prot_%{opt_i}_hcap=0%;/endif%;\ /if (opt_e) /set prot_%{opt_i}_e=1%;/else /set prot_%{opt_i}_e=0%;/endif%;\ /if (opt_M) /set lst_ripprots=%{opt_i} %{lst_ripprots}%;/endif%;\ /if (opt_q) /set prot_%{opt_i}_q=0%;/else /set prot_%{opt_i}_q=1%;/endif%;\ /if (opt_p | opt_P)\ /if (opt_p & opt_P) /gerror Minor and major typeprot options given.%;/break%;/endif%;\ /if (opt_d=~"" | opt_A=~"") /gerror Conjurer typeprot definition requires proper -A and -d options!%;/break%;/endif%;\ /set lst_cprots=%{opt_i} %{lst_cprots}%;\ /let _qmatch=simple%;\ /let qact1=%%;%;\ /let qact2= (sticky)%%;/set prot_%{opt_i}_st=1%%;%;\ /if (opt_P) \ /def -i -p9999 -F -aCyellow -mregexp -t"^([A-Z][a-z]+) utters? the magic words '%{opt_A}'\$" rec_%{opt_i}_A=\ /set prot_%{opt_i}_p=1%;\ /test prdefconju(opt_i, opt_i, "You see a %{opt_d} shield fade into existance around you.", qact1)%;\ /test prdefconju(opt_i, "%{opt_i}_st", "You see an extra %{opt_d} shield fade into existance around you.", qact2)%;\ /let opt_d=Your %{opt_d} shield fades out.%;\ /else \ /def -i -p9999 -F -aCyellow -mregexp -t"^([A-Z][a-z]+) utters? the magic words '%{opt_A}'\$" rec_%{opt_i}_A=\ /prclearprotpreqs %%{lst_cprots}%%;/set prot_%{opt_i}_p=1%;\ /test prdefconju(opt_i, opt_i, "You sense a powerful protective aura around you.", qact1)%;\ /test prdefconju(opt_i, "%{opt_i}_st", "You sense an extra powerful protective aura around you.", qact2)%;\ /let opt_d=A %{opt_d} flash momentarily surrounds you and then vanishes.%;\ /endif%;\ /else \ /if (opt_m) /set lst_dmpprots=%{opt_i} %{lst_dmpprots}%;/endif%;\ /if (opt_s) /set prot_%{opt_i}_stack=1%;/else /set prot_%{opt_i}_stack=0%;/endif%;\ /if (opt_h) /set prot_%{opt_i}_renew=1%;/else /set prot_%{opt_i}_renew=0%;/endif%;\ /if (opt_u=~"" | opt_d=~"") /break%;/endif%;\ /if (opt_r) /let _qmatch=regexp%;/else /let _qmatch=simple%;/endif%;\ /let pstr=0%;\ /if (opt_A!~"") /let pstr=1%;/def -i -p9999 -F -aCyellow -mregexp -t'%{opt_A}' rec_%{opt_i}_A=/set prot_%{opt_i}_p=1%;/endif%;\ /if (opt_B!~"") /let pstr=2%;/def -i -p9999 -F -aCyellow -mregexp -t'%{opt_B}' rec_%{opt_i}_B=/if (prot_%{opt_i}_p == 1) /set prot_%{opt_i}_p=2%%;/endif%;/endif%;\ /if (opt_C!~"") /let pstr=3%;/def -i -p9999 -F -aCyellow -mregexp -t'%{opt_C}' rec_%{opt_i}_C=/if (prot_%{opt_i}_p == 2) /set prot_%{opt_i}_p=3%%;/endif%;/endif%;\ /if (pstr > 0)\ /def -i -p9999 -F -aCgreen -m%{_qmatch} -t'%{opt_u}' rec_%{opt_i}_on=/if (prot_%{opt_i}_p==%{pstr})/pron %{opt_i}%%;/endif%%;/set prot_%{opt_i}_p=0%;\ /else \ /def -i -p9999 -F -aCgreen -m%{_qmatch} -t'%{opt_u}' rec_%{opt_i}_on=/set prot_%{opt_i}_p=0%%;/pron %{opt_i}%;\ /endif%;\ /endif%;\ /def -i -p9999 -F -aCgreen -m%{_qmatch} -t'%{opt_d}' rec_%{opt_i}_off=/proff %{opt_i} ;; Turn prot ON /def -i pron =\ /if ({#} < 1) /gerror No prot identifier argument defined!%;/break%;/endif%;\ /eval /set qtval_l=$$[prot_%{1}_l]%;\ /eval /set qtval_s=$$[prot_%{1}_stack]%;\ /eval /set qtval_h=$$[prot_%{1}_renew]%;\ /eval /set qtval_c=$$[prot_%{1}]%;\ /if (qtval_c == 0 | (qtval_h == 1 & qtval_s == 0))\ /if (qtval_c > 0)\ /eval /set qtval_t=$$[prot_%{1}_t]%;\ /let qtstrs=Renewed! $[prgetstime(qtval_t)]%;\ /else \ /let qtstrs=ON!%;\ /endif%;\ /set prot_%{1}=1%;\ /else \ /if (qtval_s)\ /set prot_%{1}=$[qtval_c+1]%;\ /let qtstrs=ON [#$[qtval_c+1]]%;\ /else \ /gerror Prot '%{1}' (%{qtval_l}) increased even though not flagged stackable!%;\ /break%;\ /endif%;\ /endif%;\ /set prot_%{1}_t=$[time()]%;\ /if ({-1}!~"")\ /msr %{qtval_l} %{-1} %{qtstrs}%;\ /else \ /msr %{qtval_l} %{qtstrs}%;\ /endif%;\ /gprots_get%;/gstatus_update ;; Turn prot OFF /def -i proff =\ /if ({#} < 1) /gerror No prot identifier argument defined!%;/break%;/endif%;\ /eval /set qtval_c=$$[prot_%{1} - 1]%;\ /set prot_%{1}=%{qtval_c}%;\ /eval /set qtval_l=$$[prot_%{1}_l]%;\ /eval /set qtval_s=$$[prot_%{1}_stack]%;\ /eval /set qtval_t=$$[prot_%{1}_t]%;\ /eval /set qtval_h=$$[prot_%{1}_renew]%;\ /eval /set qtval_q=$$[prot_%{1}_q]%;\ /if (qtval_l=~"") /gerror No such prot '%{1}' defined!%;/break%;/endif%;\ /if (qtval_c < 0 & qtval_q) \ /gwarning '%{1}' (%{qtval_l}) count %{qtval_c} at /proff!%;\ /set prot_%{1}=0%;\ /msr %{qtval_l} OFF!%;\ /break%;\ /endif%;\ /if (qtval_s & qtval_c >= 1 & qtval_h == 0) \ /msr %{qtval_l} Weakened! [#%{qtval_c}] $[prgetstime(qtval_t)]%;\ /else \ /set prot_%{1}=0%;\ /if (!qtval_q & qtval_c < 0)\ /msr %{qtval_l} OFF!%;\ /else \ /msr %{qtval_l} OFF! $[prgetstime(qtval_t)]%;\ /endif%;\ /endif%;\ /gprots_get%;/gstatus_update ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Form the "current prots" strings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /def -i gprots_doget =\ /while ({#})\ /eval /set qtval=$$[prot_%{1}]%;\ /eval /set qtval_t=$$[prot_%{1}_t]%;\ /eval /set qtval_n=$$[prot_%{1}_n]%;\ /eval /set qtval_st=$$[prot_%{1}_st]%;\ /eval /set qtval_e=$$[prot_%{1}_e]%;\ /eval /set qtval_w=$$[prot_%{1}_w]%;\ /eval /set qtval_hcap=$$[prot_%{1}_hcap]%;\ /if (qtval > 0)\ /set cnt_prots=$[cnt_prots+1]%;\ /if (qtval_st) /let _qts=+%;/else /let _qts=%;/endif%;\ /if (qtval > 1) /let _qts=(%{qtval})%;/endif%;\ /if (qtval_e & qtval_w > 0) /let _qts=%{_qts}<%{qtval_w}>%;/endif%;\ /if (qtval_hcap) /set qtval_n=-%{qtval_n}%;/endif%;\ /let _qss=%{qtval_n}%{_qts}$[prgetstime(qtval_t)]%;\ /if (status_protstr!~"")\ /set status_protstr=%{status_protstr} | %{_qss}%;\ /set status_protstr2=%{status_protstr2}|%{qtval_n}%{_qts}%;\ /else \ /set status_protstr=%{_qss}%;\ /set status_protstr2=%{qtval_n}%{_qts}%;\ /endif%;\ /endif%;\ /shift%;\ /done /def -i gprots_get =\ /set status_protstr=%;\ /set status_protstr2=%;\ /set cnt_prots=0%;\ /eval /gprots_doget %{lst_prots}%;\ /if (cnt_prots > 0)\ /return status_protstr%;\ /else \ /return "No prots."%;\ /endif ;; Prot reporting /def prots = /msq $[gprots_get()] /def -i -p9999 -mregexp -t"^[A-Z][a-z]+ tweaks your nose (mischievously|mischeviously).$" prot_tweak1 =\ /msr $[gprots_get()] /def -i -p9999 -mregexp -t"^You tweak your own nose (mischievously|mischeviously).$" prot_tweak3 =\ /msr $[gprots_get()] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Prots which expire on death, DMP or reboot ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Death /def -i prclearrip =\ /set gripstr=%;\ /while ({#})\ /eval /set qtval=$$[prot_%{1}]%;\ /if (qtval)\ /eval /set qtval_n=$$[prot_%{1}_n]%;\ /set prot_%{1}=0%;\ /if (gripstr!~"") \ /set gripstr=%{gripstr}, %{qtval_n}%;\ /else \ /set gripstr=%{qtval_n}%;\ /endif%;\ /endif%;\ /shift%;\ /done /def -i -p9999 -F -aCgreen -msimple -t"You die." gprots_rip =\ /msq @{BCyellow}Various prots expire as you die!@{n}%;\ /set spell_st=off%;\ /set skill_st=off%;\ /prclearrip %{lst_ripprots}%;\ /gprots_get%;/gstatus_update%;\ /if (gripstr!~"")\ /msr R.I.P. removed: %{gripstr}%;\ /endif ;; Dispel magical protection (dmp) /def -i prcleardmp =\ /set gdmpstr=%;\ /while ({#})\ /eval /set qtval=$$[prot_%{1}]%;\ /eval /set qtval_st=$$[prot_%{1}_st]%;\ /if (qtval & qtval_st == 0)\ /eval /set qtval_n=$$[prot_%{1}_n]%;\ /set prot_%{1}=0%;\ /if (gdmpstr!~"") \ /set gdmpstr=%{gdmpstr}, %{qtval_n}%;\ /else \ /set gdmpstr=%{qtval_n}%;\ /endif%;\ /endif%;\ /shift%;\ /done /def -i -p9999 -F -ag -mregexp -t"^You feel (unprotected|much more vulnerable)\.$" gprots_dmp =\ /prcleardmp %{lst_cprots} %{lst_dmpprots}%;\ /gprots_get%;/gstatus_update%;\ /if (gdmpstr!~"")\ /msq @{BCred}Dispel Magical Protection@{n} hit you!%;\ /msr DMP removed: %{gdmpstr}%;\ /endif ;; Login after reboot /def -i -p9999 -F -aCgreen -msimple -t"Moving to starting location." gprots_reboot =\ /cprots ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Create normal regular prots without complexities ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /prdefprot -i"eaura" -n"EAura" -l"Energy Aura" -s -h /prdefprot -i"pff" -n"PFF" -l"Personal Force Field" -r -u"^You surround yourself by a bubble of force.$" -d"^Your field disperses with a soft \*pop\* and is gone\.$" /prdefprot -i"infra" -n"Infra" -l"Infravision" -h -A"\'demoni on pomoni\'$" -u"You have infravision." -d"Everything no longer seems so red." /prdefprot -i"ww" -n"WW" -l"Water Walking" -h -A" \'Jeeeeeeeeeeeesuuuuuuuus\'$" -r -u"^(You feel light|Your feet feel lighter than before)\." -d"^You feel heavier\." /prdefprot -i"float" -n"Float" -l"Floating" -s -r -u"^You feel light, and rise into the air.$" -d"^(Your old floating spell dissipates|You slowly descend until your feet are on the ground).$" /prdefprot -i"invis" -n"Invis" -l"Invisibility" -r -u"^You (suddenly can\'t see yourself|twist the ring and suddenly you become invisible).$" -d"^You turn visible.$" /prdefprot -i"godpr" -n"GodPr" -l"Godly Presence" /prdefprot -i"seeinvis" -n"SeeInv" -l"See Invisible" -u"You feel you can see more than ever." -d"Your vision is less sensitive now." /prdefprot -i"seemagic" -n"SeeMag" -l"See Magic" -u"You can now see magical things." -d"You are no longer sensitive to magical things." /prdefprot -i"hw" -n"HW" -l"Heavy Weight" -A" \'tonnikalaa\'$" -u"You suddenly feel magically heavier." -d"You feel lighter, but it doesn\'t seem to affect your weight!" /prdefprot -i"haste" -n"Haste" -l"Haste" /prdefprot -i"erage" -n"ERage" -l"Enrage" -r -u"^(You feel mildly enraged.|You are maddened with rage!|You feel your barbarian rage stir up.|Holy CRAP! OH what a RUSH!|You feel TOTALLY ENRAGED and ready to KICK ASS!|YOU FEEL AS IF YOU WERE GROO HIMSELF!|You are ENRAGED! Your body ACHES for action!|You feel the adrenaline BURST into your veins!|Your blood is boiling (of|with) rage!|You tremble uncontrollably and feel completely ENRAGED!)$" -d"^You no longer feel enraged.$" /prdefprot -i"pthrsh" -n"PThrsh" -l"Pain Threshold" -u"You begin to concentrate on pain threshold." -d"Your concentration breaks and you feel less protected from physical damage." /prdefprot -i"timm" -n"TImm" -l"Toxic Immunity" -u"You begin to concentrate on toxic immunity." -d"Your concentration breaks and you feel less protected from poison." /prdefprot -i"ctol" -n"CTol" -l"Cold Tolerance" -u"You begin to concentrate on cold tolerance." -d"Your concentration breaks and you feel less protected from cold." /prdefprot -i"fwal" -n"FWal" -l"Fire Walking" -u"You begin to concentrate on fire walking." -d"Your concentration breaks and you feel less protected from fire." ;/prdefprot -i"pbsf" -n"PbSf" -l"Protection by Sacrifice" -A" kneels before you and whispers \'With my life I\'ll protect yours\'.$" -r -u"^(She|He|It) stands up with a solemn look on her face.$" /prdefprot -i"lol" -n"LoL" -l"Lift of Load" -u"You feel odd. Not stronger, but..." -d"You feel odd. Not weaker, but..." /prdefprot -i"eawaren" -n"EA" -l"Enhanced Awareness" -u"You feel more aware of your surroundings." -d"You feel your enhanced awareness subside." ;; --- Misc. handicaps ---- /prdefprot -i"forget" -n"Forget" -l"Forget" -z -u"You feel rather empty-headed." -d"A fog lifts from your mind. You can remember things clearly now." /prdefprot -i"supprm" -n"Suppr" -l"Suppress Magic" -z -A"^You are hit by a mental storm suppressing your magic\.$" -u"Your feel excruciating pain in your head." -d"You feel relieved." ;; ---- Spider ---- /prdefprot -i"sptouch" -n"STouch" -l"Spider Touch" -z -u"Suddenly you don\'t feel too good. Your blood feels like it is on fire." -d"Your blood does not burn anymore." /prdefprot -i"qsilver" -n"QS" -l"Quicksilver" -u"You feel more agile." -d"You feel less agile." /prdefprot -i"spwalk" -n"SWalk" -l"Spider Walk" -u"For some reason you want to run on the walls for a little while." -d"The walls don\'t look so inviting anymore." ;; ---- Tiger ---- /prdefprot -i"ffist" -n"FFist" -l"Flame Fists" -u"Your fists are surrounded by Curath\'s black flames!" -d"Your flaming fists disappear." ;; ---- Evil priest ---- /prdefprot -i"pfg" -n"PfG" -l"Protection from Good" -u"A vile black aura surrounds you." -d"You no longer have a vile black aura around you." /prdefprot -i"paranoia" -n"Para" -l"Paranoia" -z -A" \'noxim delusa\'" -u"You have a bad feeling about this." -d"Everything seems so much more pleasant." /prdefprot -i"aoh" -n"AoH" -l"Aura of Hate" -r -u"^You feel burning hatred and rage erupt within you!" -d"^You feel your anger and hate of the world recede." ;; ---- Tarmalen ---- /prdefprot -i"unpain" -n"Unp" -l"Unpain" -h -r -u"^You feel your will getting stronger.$" -d"^(You feel your will returning normal.|Your Unpain spell dissipates|You feel your will getting normal.|You suffer an acute health change)" /prdefprot -i"bot" -n"BoT" -l"Blessing of Tarmalen" -r -u"^You feel strong - like you could carry( the)? whole flat world on your back!$" -d"^You feel weaker\.$" /prdefprot -i"lifelnk" -n"LifeLnk" -l"Life Link" -r -u"^You (succeed. You create a link to [A-Z][a-z]+\.|feel somehow linked to [A-Z][a-z]+!)$" -d"^You hear a loud snap like sound!$" /prdefprot -i"evital" -n"EV" -l"Enhanced Vitality" -A"\'zoot zoot zoot\'" -r -u"^A bright light extracts from (your|.+\'s) hands covering your skin.$" -d"^Your skin stops glowing.$" /prdefprot -i"gangel" -n"GAngel" -l"Guardian Angel" -u"A guardian angel arrives to protect you!" -d"Your guardian angel cannot stay for longer and flies away." ;; ---- Nun ---- /prdefprot -i"pfe" -n"PfE" -l"Protection from Evil" -M -A" \'sanctus Exzordus\'" -r -u"(you feel more protected against evil|as you are surrounded by protective holy aura)\.$" -d"^(You suddenly feel more vulnerable to evil|Your glow fades away and you suddenly feel more vulnerable to evil|The evil in you gives you strength and you shatter the holy aura around you).$" /prdefprot -i"soulsh" -n"SoulSh" -l"Soul Shield" -M -A" \'sanctus angeliq\'" -r -u"^(Your soul is covered by holy aura.|You spiritually reach out for your soul, protecting it with holy force.|[A-Z][a-z]+ places her hand over you and blesses your soul in the name of Las.)$" -d"^Your soul feels suddenly more vulnerable.$" /prdefprot -i"hprot" -n"HProt" -l"Heavenly Protection" -M -A" \'sanctus . o O\'" -r -u"(glow supernatural light|vibrates under magical pressure|blazes heavenly|flashes uncanny|twinkles|flickers) as you .* dazzling white particles dancing" -d"^Holy particles slow down, rapidly fading away.$" /prdefprot -i"manash" -n"ManaSh" -l"Mana Shield" -s -A" \'nullum driiiks umbah mana\'" -u"You feel your magical power expanding." -d"Your life force seems weaker." ;; ---- Templar ---- /prdefprot -i"sof" -n"SoF" -l"Shield of Faith" -m -u"You are surrounded by divine glow!" -d"Your glow disappears." /prdefprot -i"bof" -n"BoF" -l"Blessing of Faerwon" -r -u"^You feel your conviction to rid the world of evil grow stronger as you" -d"^You can feel the power of Faerwon leaving you\.$" ;; ---- Psionicist ---- /prdefprot -i"levi" -n"Levi" -l"Levitation" -u"You slowly rise from the ground and start levitating." -d"You decide that you have levitated enough and slowly descend to the ground." /prdefprot -i"forcesh" -n"FSh" -l"Force Shield" -r -A"^([A-Z][a-z]+ is surrounded by blue waves as you hear|You tap the power of the blue star with) the words \'thoiiiiiisss" -u"^(You form a psionic shield of force around your body|[A-Z][a-z]+ forms a shield of force around you)\.$" -d"^Your armour feels thinner.$" /prdefprot -i"psish" -n"PsiSh" -l"Psionic Shield" -u"Psionic waves surge through your body and mind!" -d"The psionic shield vanishes." /prdefprot -i"minddev" -n"MDev" -l"Mind Development" -s -u"You feel your mind developing." -d"Your brain suddenly seems smaller." ;/prdefprot -i"transs" -n"TSelf" -l"Transmute Self" -A" \'nihenuak assaam no nek orrek\'$" -u"There is a puff of logic!" -d"You feel like the illusion around you lifted." ;; ---- Druid ---- /prdefprot -i"flexsh" -n"FlexSh" -l"Flex Shield" -M -u"You sense a flex shield covering your body like a second skin." -d"Your flex shield wobbles, PINGs and vanishes." /prdefprot -i"epower" -n"EPower" -l"Earth Power" -u"You feel your strength changing. You flex you muscles experimentally." -d"The runic sigla \'% !^\' fade away.. leaving you feeling strange." /prdefprot -i"eskin" -n"ESkin" -l"Earth Skin" -M -s -u"You feel your skin harden." -d"Your skin feels softer." /prdefprot -i"eblood" -n"EBlood" -l"Earth Blood" -A" traces? icy blue runes on the ground with" -B" is surrounded by a sudden cloudburst" -u"An icy chill runs through your veins." -d"The runic sigla \'!( *)\' fade away.. leaving you feeling strange." /prdefprot -i"vmant" -n"Vmant" -l"Vine Mantle" -M -s -u"Vines entangle your body." -d"The vines around your body shrink." /prdefprot -i"regen" -n"Regen" -l"Regeneration" -u"You feel your metabolism speed up." -d"You no longer have a active regeneration spell on you." ;; ---- Bard ---- /prdefprot -i"warez" -n"WarEns" -l"War Ensemble" -A"\'War is TOTAL massacre, sport the war, war SUPPOORT!!!\'" -u"You feel full of battle rage! Victory is CERTAIN!" -d"The effect of war ensemble wears off." /prdefprot -i"emelody" -n"EMelody" -l"Embracing Melody" -r -u"^(You embrace yourself with your|[A-Z][A-Za-z]+ wraps you into an embracing) melody\.$" -d"^The embracing melody subsides, leaving you longing for more\.$" /prdefprot -i"afavour" -n"AFav" -l"Arches Favour" -u"You feel optimistic about your near future!" -d"You no longer have Arches Favour on you. You feel sad." /prdefprot -i"cthought" -n"CT" -l"Clandestine Thoughts" -u"[clandestine thought]: activated. Snooping activities will be terminated and reported." -d"[clandestine thought]: scanning ended. Shielding from snoopers no longer active." /prdefprot -i"motma" -n"MotMA" -l"Melody of the Misadventurer" -z -A"^The melody sung by .* descends upon you like a weight on your shoulders\.$" -u"You feel miserable." -d"You feel like a weight has been lifted from your mental shoulders." ;; ---- LoC ---- /prdefprot -i"drage" -n"DRage" -l"Destructive Rage" -r -A"^A veiled darkness descends over your eyes. Sounds are oddly distorted" -u"but wreaking havoc on all that stands before you\.$" -d"^Your massive build-up of rage slowly dissipates leaving you drained" ;; ---- Conjurer::Basic Prots ---- /prdefprot -i"sop" -n"SoP" -l"Shield of Protection" -A" \'nsiiznau\'$" -u"You feel a slight tingle." -d"You feel more vulnerable now." /prdefprot -i"bimage" -n"BImg" -l"Blurred Image" -A" \'ziiiuuuuns wiz\'$" -u"You feel a powerful aura." -d"You feel less invisible." /prdefprot -i"disp" -n"Disp" -l"Displacement" -A" \'diiiiuuunz aaanziz\'$" -r -u"^You feel a powerful aura\.$" -d"^You(r displacement spell wears off| feel much less invisible)\.$" /prdefprot -i"iwill" -n"IWill" -l"Iron Will" -u"You feel protected from being stunned." -d"You feel no longer protected from being stunned." /prdefprot -i"rentr" -n"REntrop" -l"Resist Entropy" -u"You feel your life force expanding." -d"You feel your hair is getting grayer." /prdefprot -i"rdisint" -n"RDisInt" -l"Resist Disintegrate" -u"You feel very firm." -d"You feel somewhat weaker." ;; ---- Conjurer::Minor Typeprots ---- /prdefprot -i"c_phys" -n"FAbs" -l"Force Absorption" -p -A"ztonez des deckers" -d"skin brown" /prdefprot -i"c_acid" -n"CShd" -l"Corrosion Shield" -p -A"sulphiraidzik hydrochloodriz gidz zuf" -d"disgusting yellow" /prdefprot -i"c_poison" -n"TDil" -l"Toxic Dilution" -p -A"morri nam pantoloosa" -d"green" /prdefprot -i"c_elec" -n"EChan" -l"Energy Channeling" -p -A"kablaaaammmmm bliitz zundfer" -d"crackling blue" /prdefprot -i"c_asphyx" -n"EBound" -l"Ether Boundary" -p -A"qor monoliftus" -d"dull black" /prdefprot -i"c_fire" -n"HeatR" -l"Heat Reduction" -p -A"hot hot not zeis daimons" -d"burning red" /prdefprot -i"c_magic" -n"MDisp" -l"Magic Dispersion" -p -A"meke tul magic" -d"golden" /prdefprot -i"c_psi" -n"PSanc" -l"Psychic Sanctuary" -p -A"toughen da mind reeez un biis" -d"transparent" /prdefprot -i"c_cold" -n"FIns" -l"Frost Insulation" -p -A"skaki barictos yetz fiil" -d"cold white" ;; ---- Conjurer::Major Typeprots ---- /prdefprot -i"m_phys" -n"AoA" -l"Armour of Aether" -P -A"fooharribah inaminos cantor" -d"crystal clear" /prdefprot -i"m_acid" -n"AcidS" -l"Acid Shield" -P -A"hfizz hfizz nglurglptz" -d"bubbling yellow" /prdefprot -i"m_poison" -n"Detox" -l"Shield of Detoxification" -P -A"nyiaha llaimay exchekes ployp" -d"slimy olive green" /prdefprot -i"m_elec" -n"LightS" -l"Lightning Shield" -P -A"ohm" -d"neon purple" /prdefprot -i"m_asphyx" -n"AoW" -l"Aura of Wind" -P -A"englobo globo mc\'pop" -d"swirling foggy white" /prdefprot -i"m_fire" -n"FlameS" -l"Flame Shield" -P -A"huppa huppa tiki tiki" -d"crackling red-orange" /prdefprot -i"m_magic" -n"RepAur" -l"Repulsor Aura" -P -A"shamarubu incixtes delfo" -d"flickering golden" /prdefprot -i"m_psi" -n"PsiPha" -l"Psionic Phalanx" -P -A"all for one, gather around me" -d"misty pale blue" /prdefprot -i"m_cold" -n"FrostS" -l"Frost Shield" -P -A"nbarrimon zfettix roi" -d"frosty blue-white" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Unstun (NS) /prdefprot -i"unstun" -n"Unst" -l"Unstun" -h -q -e /def -i -F -aCgreen -mregexp -t"^[A-Z][A-Za-z]+\'s chanting appears to do absolutely nothing.$" rec_unstun_on =\ /pron unstun%;/set prot_unstun_w=0 /def -i -F -aCgreen -msimple -t"You are STUNNED." rec_stun_start =\ /set stun_st=on%;/proff unstun /def -i -F -aCgreen -mregexp -t" paralyzes you with its mind\.$" rec_paralyzed_start =\ /gspell_interrupt%;/gskill_interrupt%;/set stun_st=on%;/proff unstun /def -i -F -aCgreen -msimple -t"You are no longer stunned." rec_stun_end =\ /set stun_st=off%;/msr No longer stunned /def -i -F -aCgreen -msimple -t"It doesn't hurt as much as it normally does!" rec_unstun_off =\ /proff unstun /def -i -F -aCgreen -msimple -t"It doesn't hurt at all!" rec_unstun_notall =\ /gspell_interrupt%;/gskill_interrupt%;\ /set prot_unstun_w=$[prot_unstun_w+1]%;\ /msr Unstun weakened [#%{prot_unstun_w}]%;\ /gstatus_update ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Mesmeric Threshold (NS) /prdefprot -i"mthresh" -n"MesmTh" -l"Mesmeric Threshold" -h -q -e /def -i -F -aCgreen -msimple -t"You feel too mesmerized to know pain as a supernatural trance takes over you." rec_mthresh_on =\ /pron mthresh%;/set prot_mthresh_w=0 /def -i -F -aCgreen -msimple -t"The dreamlike feeling improving your concentration subsides." rec_mthresh_off =\ /proff mthresh /def -i -F -aCgreen -msimple -t"You get hit HARD, but continue your actions under a supernatural trance." rec_mthresh_weak =\ /set prot_mthresh_w=$[prot_mthresh_w+1]%;\ /msr Mesmeric Threshold weakened [#%{prot_mthresh_w}]%;\ /gstatus_update ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Skill and skill-status reporting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; skill_t - timestamp of when skill started ; skill_st - 'on' during skill "concentration" phase, off when skill goes off ; skill_st2 - 'off' during "concentration", on when skill goes off ; ; cast_info - empty for no cast/skill going on, 'SP' for spells, 'SK' for skills ; cast_info_n - name of skill/spell currently going on ; cast_info_t - target of skill/spell (empty if no target) ;; Display information about current skill/spell /def -i gshow_info =\ /if (cast_info_t!~"")\ /msq '%{cast_info_n}' -> %{cast_info_t}%;\ /else \ /if (battle_target!~"")\ /msq '%{cast_info_n}' -> (%{battle_target})%;\ /else \ /msq '%{cast_info_n}'%;\ /endif%;\ /endif ;; Start of skill /def -i -p9999 -msimple -t"You start concentrating on the skill." gskill_start =\ /set skill_t=$[time()]%;\ /set cnt_skills=$[cnt_skills+1]%;\ /set skill_st=on%;\ /set skill_st2=off%;\ /set cast_info=SK%;/set cast_info_n=%;/set cast_info_t=%;@@cast info%;\ /mss @{BCyellow} ---- SKILL START ---- @{n} (@{Cyellow}%{cnt_skills}@{n})%;\ /gstatus_update ;; Skill done /def -i -p9999 -msimple -t"You are prepared to do the skill." gskill_end =\ /set cnt_sskills=$[cnt_sskills+1]%;\ /set skill_st=off%;\ /set skill_st2=on%;\ /set cast_info=%;\ /set cnt_sktime=$[cnt_sktime+time() - skill_t]%;\ /mss @{Cbggreen} ---- SKILL DONE ---- @{n} @{Cyellow}$[prgetstime(skill_t)]@{n}%;\ /gstatus_update ;; Cast info /def -i -p9999 -ag -mregexp -t"^You are using \'([a-z ]+)\'.$" gskill_info1 =\ /set cast_info_n=%{P1}%;/set cast_info_t=%;/gshow_info%;\ /if (opt_rskills=~"on") @@emote is using '%{P1}'%;/endif /def -i -p9999 -ag -mregexp -t"^You are using \'([a-z ]+)\' at \'([A-Za-z0-9_ ,.'-]+)\'.$" gskill_info2 =\ /set cast_info_n=%{P1}%;/set cast_info_t=%{P2}%;/gshow_info%;\ /if (opt_rskills=~"on") @@emote is using '%{P1}' -> '%{P2}'%;/endif ;; Skill fumbled /def -i gskill_fumble =\ /if (skill_st2=~"on")\ /set cnt_sskills=$[cnt_sskills - 1]%;\ /set cnt_fuskills=$[cnt_fuskills+1]%;\ /set skill_st2=off%;\ /endif ;; Skill failed /def -i gskill_fail =\ /if (skill_st2=~"on")\ /set cnt_sskills=$[cnt_sskills - 1]%;\ /set cnt_fskills=$[cnt_fskills+1]%;\ /set skill_st2=off%;\ /endif ;; Skill interrupted /def -i gskill_interrupt =\ /if (skill_st=~"on")\ /msq @{Cbgred} ---- SKILL INTERRUPTED ---- @{n}%;\ /set cnt_iskills=$[cnt_iskills+1]%;\ /set skill_st=off%;\ /set cast_info=%;\ /gstatus_update%;\ /prexecfuncs %{event_skill_intr}%;\ /endif /def -i -p9999 -ag -msimple -t"Your movement prevents you from doing the skill." gskill_interrupt1 =\ /set skill_st2=on%;/gskill_interrupt /def -i -p9999 -ag -msimple -t"You break your skill attempt." gskill_interrupt2 =\ /set skill_st2=on%;/gskill_interrupt /def -i -p9999 -ag -msimple -t"You lose your concentration and cannot do the skill." gskill_interrupt4 =\ /set skill_st2=on%;/gskill_interrupt /def -i -p9999 -ag -mregexp -t"^You decide to change the skill to (a )?new one\.$" gskill_interrupt3 =\ /set skill_st2=off%;/gskill_interrupt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Battle, enemy shape ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Report shape /def shape =\ /if (battle_target!~"")\ /msr %{battle_shape} (%{battle_target})%;\ /else \ /msr %{battle_shape}%;\ /endif%;\ ;; Update/set new shape /prdefvar -n"fmt_shape" \ -v"@{Cgreen}%%{4} %%{5}@{n} [@{%%{1}}%%{2}@{n}] (@{%%{1}}%%{3}%%%@{n})" \ -c"Format string for shape reporting. %{1}=shape colour, %{2}=shape short name, %{3}=percentage, %{4}=target name, %{5}=shape long name" /eval /def -i gbattle_ss =\ /msw %{fmt_shape}%%;\ /if (battle_st)\ /set battle_pshape=%%{battle_shape}%%;\ /set battle_shape=%%{2}%%;\ /endif ;; Update/set new target /def -i gbattle_target =\ /set battle_oldtarget=%{battle_target}%;\ /set battle_target=%{1} ;; (Re)initialize battle /def -i gbattle_init =\ /set battle_shape=es%;\ /set battle_pshape=es%;\ /set battle_st=1 ;; New round /def -i -F -msimple -t"*****************************************************" gbattle_round =\ /if (set_round!~"") %{set_round}%;/endif%;\ /if (opt_autopss=~"on") /pss%;/endif%;\ /if (battle_st==0) /gbattle_init%;/endif%;\ /prexecfuncs %{event_battle_round}%;\ /gstatus_update ;; Grab target via several methods /def -i -p9999 -ag -mregexp -t"^You are now targetting ([A-Za-z ,.'-]+)\.$" gbattle_target3 =\ /msq @{BCyellow}Targetting@{n} -> @{BCred}%{P1}@{n}%;\ /test gbattle_target({P1}) ;; Get shape /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is in (excellent shape)\.$" gbattle_shape0 = /test gbattle_ss("BCgreen","es","90-100",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is in a (good shape)\.$" gbattle_shape3 = /test gbattle_ss("Cgreen","gs","80-90",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is (slightly hurt)\.$" gbattle_shape1 = /test gbattle_ss("BCcyan","sh","65-80",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is (noticeably hurt)\.$" gbattle_shape2 = /test gbattle_ss("Ccyan","nh","50-65",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is (not in a good shape)\.$" gbattle_shape4 = /test gbattle_ss("BCyellow","nigs","35-50",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is in (bad shape)\.$" gbattle_shape5 = /test gbattle_ss("Cyellow","bs","20-35",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is in (very bad shape)\.$" gbattle_shape6 = /test gbattle_ss("BCred","vbs","10-20",{P1},{P2}) /def -i -p9999 -ag -mregexp -t"^([A-Za-z ,.'-]+) is (near death)\.$" gbattle_shape7 = /test gbattle_ss("Cred","nd","0-10",{P1},{P2}) ;; End of battle /def -i -p9999 -aCgreen -mregexp -t"^[A-Za-z ,.'-]+ is DEAD, R.I.P.$" gbattle_rip =\ /set battle_st=0%;\ /set battle_target=%;\ /prexecfuncs %{event_battle_rip} /def -i -p9999 -aCyellow -msimple -t"You are not in combat right now." gbattle_end =\ /set battle_st=0%;\ /set battle_target=%;\ /prexecfuncs %{event_battle_end} ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Global script initialization ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; /if (set_wasinit != 1)\ /greset%;\ /ginitialize%;\ /endif