; $Id: ignore.tf,v 1.1 1996/11/24 20:22:57 dmoore Exp $ ; v1.0 - created May 31, 1996 ; *** Requires tf3.5a18 or later to use. *** ; (May work with earlier versions.) ; ; dmoore@ucsd.edu ; You first say '/ignore_pair WORLD1 WORLD2', (with your two world names), ; to tell it that these two worlds go together. Then you can use ; '/ignore_toggle' from inside either of those worlds to switch which is ; ignored. And you can use '/ignore_off' to turn it off. It won't start ; ignoring until the first time you use '/ignore_toggle'. This way you ; can stick the '/ignore_pair W1 W2' command in your world file. ; You can also just say '/ignore_auto WORLD1 WORLD2' which will ; automatically keep the frontmost world in a pair showing text, and the ; background one hiding it. ; Both /ignore_toggle and /ignore_off can be given a world name. ;; Example lines in your world file: ; ; /addworld bob BOB xxx localhost echo ; /addworld fred FRED xxx localhost echo ; /ignore_pair bob fred ; ;; Then after you've connected to bob and fred and gotten started: ; ; /ignore_toggle bob ; --> now you won't see anything on world bob anymore. ; ; /ignore_toggle ; --> now you won't see anything on world fred anymore. ; ; /ignore_off bob ; --> now you see everyone on both bob and fred. ;; Example lines in your world file: ; ; /addworld aa BOB xxx localhost echo ; /addworld bb FRED xxx localhost echo ; /ignore_auto aa bb ;;; This sets the priority level of the gags. /set ignore_priority=0 ;;; FIX FIX FIX: if Ken adds a /fg flush option, then you could ;;; easily use /advise on fg to check if the destination is a pair'd one, ;;; and add the flush arg to the /fg subcall. /def -i ignore_auto =\ /if /!ignore_pair %1 %2%;/then /break%;/endif%;\ /if (!ismacro("ignore__world_hook")) \ /def -i -F -h'WORLD' ignore__world_hook = \ /let ignore_which=\$[tolower({1})]%%;\ /let ignore_other=%%;\ /if (ignore__find_pair()) \ /ignore__show \%{ignore_which}%%;\ /ignore__hide \%{ignore_other}%%;\ /endif%;\ /endif /def -i ignore_pair =\ /if ({#} != 2) \ /echo \% /ignore_pair requires two world names.%;\ /test 0%;\ /break%;\ /endif%;\ /let first=$[tolower({1})]%;\ /let second=$[tolower({2})]%;\ /set ignore_pairs=%{ignore_pairs} [%{first} %{second}]%;\ /test 1 /def -i ignore_toggle =\ /if ({#} > 1) \ /echo \% /ignore_toggle requires one world name.%;\ /break%;\ /endif%;\ /let ignore_which=$[tolower({1-${world_name}})]%;\ /let ignore_other=%;\ /if (!ignore__find_pair()) \ /echo \% No match found for world %{ignore_which}.%;\ /break%;\ /endif%;\ /if ({#}) \ /ignore__show %{ignore_other}%;\ /ignore__hide %{ignore_which}%;\ /elseif /test (ignore_hidden =/ "*{%{ignore_which}}*")%;/then \ /ignore__show %{ignore_which}%;\ /ignore__hide %{ignore_other}%;\ /else \ /ignore__show %{ignore_other}%;\ /ignore__hide %{ignore_which}%;\ /endif /def -i ignore_off =\ /if ({#} > 1) \ /echo \% /ignore_off requires one world name.%;\ /break%;\ /endif%;\ /let ignore_which=$[tolower({1-${world_name}})]%;\ /let ignore_other=%;\ /if (!ignore__find_pair()) \ /echo \% No match found for world %{ignore_which}.%;\ /break%;\ /endif%;\ /ignore__show %{ignore_which}%;\ /ignore__show %{ignore_other} /def -i ignore__find_pair =\ /: First try to find a match like [WHICH *]%;\ /test regmatch("\\[%{ignore_which} ([^ ]*)\\]", ignore_pairs)%;\ /test ignore_other := "%P1"%;\ /if (ignore_other =~ "") \ /: Didn't find it, now try a match like [* WHICH]%;\ /test regmatch("\\[([^ ]*) %{ignore_which}\\]", ignore_pairs)%;\ /test ignore_other := "%P1"%;\ /endif%;\ /test (ignore_other !~ "") /require lisp.tf /def -i ignore__show =\ /set ignore_hidden=$(/remove %1 %{ignore_hidden})%;\ /if /ismacro ignore__gag_%1%;/then \ /undef ignore__gag_%1%;\ /endif /def -i ignore__hide =\ /set ignore_hidden=%{ignore_hidden} %1%;\ /def -i -p%{ignore_priority} -w%1 -ag -t'*' ignore__gag_%1