tf-scripts/common/substitute.tf
2018-06-22 00:20:31 +02:00

35 lines
1.3 KiB
HCL

/def _sub = \
/return substitute(strcat(decode_attr(strcat({PL}, {P0}, {PR}, " @{C%c_info}[", {1}, "]@{n} "))))
/def _sub_inside = \
/return substitute(strcat(decode_attr(strcat({PL}, {P0}, " @{C%c_info}[", {*}, "]@{n}", {PR})))) %;\
/def typo =\
/let n=$[strchr({*}, '|')]%;\
/test param1 := substr({*}, 0, n) %;\
/test param2 := substr({*}, n+1) %;\
/echo -p #@{C%c_info}#@{n}# Zdefiniowana podmiana: @{C%c_info}%{param1}@{n} => @{C%c_info}%{param2}@{n} %;\
/def -mregexp -h'SEND %{param1}' typo_%{1} = /send $$[strcat ({PL}, '%{param2}', replace('%{param1}', '%{param2}', {PR}))]
/def -mregexp -Fp2 -t'(przybywaja|podazaja) (z(e|)|na) [wzpgd]' _liczenie_teamow = \
/unset _il_wr%;\
/let _ile=%{PL} %;\
/let _ile=$[replace("##", " ", replace(" ", "_",replace(", ", "##", replace(" i ", "##", {_ile}))))]%;\
/podlicz_team %{_ile}%;\
/return substitute(strcat("[", decode_attr({_il_wr}, {zc_bold}), "] ", {PL}, {P0}, {PR}))%;\
/unset _il_wr
/def podlicz_team = \
/while ({#}) \
/test ++_il_wr%; \
/shift%; \
/done
;; zgon
/def -mregexp -Fp2 -t' (polegl(a|o|)|umarl(a|o|))\\.' _zgon = \
/echo -p @{C%c_alarm}>>>>>>****** ZGON ******<<<<<<@{n}
;; self
/def -mregexp -Fp3 -t' ty(, | i )' _selfupper = \
/test substitute(strcat({PL}, decode_attr(" --TY--", {zc_alarm}), {P1}, {PR}))