Skip to content

Instantly share code, notes, and snippets.

@makyo
Last active Apr 5, 2020
Embed
What would you like to do?
Makyo's TF setup - best viewed at http://etc.drab-makyo.com/tfrc/
worlds.tf
wixxx-info.tf
;;;;;
; Makyo's TF set up!
;
; Commands are all stored in appropriate files, so please see those for more
; information about what goes into each bit of functionality
;
/purge
/load -q ~/.config/tinyfugue/wixxx-info.tf
/load -q ~/.config/tinyfugue/wixxx.tf
/load -q ~/.config/tinyfugue/automew.tf
/load -q ~/.config/tinyfugue/away.tf
/load -q ~/.config/tinyfugue/hilites.tf
/load -q ~/.config/tinyfugue/names.tf
/load -q ~/.config/tinyfugue/log_mentions.tf
/require -q ~/.config/tinyfugue/worlds.tf
/if (all_loaded) \
/time ===== %Y-%m-%d %H:%M:%S - Commands reloaded =====%; \
/else \
/time ===== %Y-%m-%d %H:%M:%S - Commands loaded =====%; \
/set all_loaded 1%; \
/endif
/loaded automew.tf
;;;;;
; Timeout prevention
;
; Sets up a macro to whisper something to oneself every half-hour. This is
; done as a whisper to allow timestamping of activity and some various regex
; stuff down the line.
;
;; Gag outgoing whispers; don't need to see duplicates.
/gag You whisper, ?__automew__*
;;; The timeout prevention itself.
;; Start the automewer.
/def startmew = /eval -s0 /domew
;; Mew to self every 30 minutes.
/def domew = \
/send -W wh me=__automew__ $[ftime("%Y-%m-%d %H:%M:%S", time())]%; \
/repeat -0:30 1 /domew%; \
/eval /set automew_pid %?
;; Stop the automewer.
/def stopmew = /eval /kill $[automew_pid]
/loaded away.tf
;;;;;
; Setting self away
;
; Some macros used for setting self away and what to do with activity
; received while away.
;
;; Show away status.
;
; Also includes some shortcuts because I can never remember what to type.
/def away_status = \
/if (away) \
/eval /echo ===== You are currently set away =====%; \
/else \
/eval /echo ===== You are currently set present =====%; \
/endif
/def isaway = /away_status
/def amaway = /away_status
/def a = /away_status
;; Set self away.
;
; Take the following actions:
; - Set page away
; - Turn whispers off
; - Write a timestamp to the mentions file
; - Turn on mention-logging
/def away = \
/if (away) \
/away_status%; \
/return%; \
/endif%; \
/send -W p #away Snoozin'! Send a page #mail if needed, as my scrollback buffer is small!%; \
/send -W wh #off%; \
/let mentionsFH=$[tfopen("mentions.txt", "a")]%; \
/if (mentionsFH != -1) \
/let now=$[ftime("%Y-%m-%d %H:%M:%S", time())]%; \
/test tfwrite(mentionsFH,"")%; \
/test tfwrite(mentionsFH,"=== SETTING SELF AWAY %{now} ===")%; \
/test tfclose(mentionsFH)%; \
/endif%; \
/set away 1
;; Set self back
;
; Take the following actions:
; - Set page back
; - Turn whispers on
; - Write to the mentions file
; - Turn off mention-logging
/def back = \
/if (!away) \
/away_status%; \
/return%; \
/endif%; \
/send -W p #!away%; \
/send -W wh #on%; \
/send -W p #m%; \
/let mentionsFH=$[tfopen("mentions.txt", "a")]%; \
/if (mentionsFH != -1) \
/let now=$[ftime("%Y-%m-%d %H:%M:%S", time())]%; \
/test tfwrite(mentionsFH,"=== SETTING SELF BACK %{now} ===")%; \
/test tfwrite(mentionsFH,"")%; \
/test tfclose(mentionsFH)%; \
/endif%; \
/set away 0
;; Visibly set self away
/def mew = \
/send -W :sets up an automewer before curling up to snooze.%; \
/away
;; Visibly set self back
/def demew = \
/send -W :turns off the automewer and pockets it. Yawn and stretch.%; \
/back
;; Shortcut for visibly setting self away
/def m = /mew
;; Set self away with a mention of travel
/def travelaway = \
/away %; \
/send -W p #away Mew is traveling! She'll be about, but in a very spotty (hah) fashion. Whispers are off, and she may miss pages. If she's too slow to repond, a page-mail is best ^^
/loaded hilites.tf
;;;;;
; Hilites
;
;; Switch hilites to green.
/set hiliteattr=Cgreen
;; Hilite cyan for a few folks on watchfor list.
/def wfpartial = /def -PCcyan -F -t%{1}
/def cyan_line = /def -aCcyan -F -mglob -t%{*}
/cyan_line `Somewhere on the muck, * has connected.`
/cyan_line `Somewhere on the muck, * has connected. (But they're still online.)`
/cyan_line `Somewhere on the muck, * has reconnected.`
/cyan_line `Somewhere on the muck, * has disconnected.`
;; Hilite saves in light red.
/def save_line = /def -aCrgb432 -F -mglob -t%{*}
/save_line `## Saving changed objects, just a moment... ##`
/save_line `## Preparing to dump database. Two minute warning! ##`
/save_line `## Pausing to save database. This may take a while... ##`
/save_line `## ...or not. ##`
;; Hilite meta-posts dark grey.
/def meta_line = /def -aCgray7 -F -mglob -t%{*}
;; Hilite and trigger a wixxx log (use a regexp to capture names).
/def meta_with_wixxx = \
/def -aCgray7 -F -mregexp -t%{*}%; \
/wixxx_trigger %{*}
/meta_with_wixxx `(.*) \(a .*\) steps out of the teleport booth.`
/meta_with_wixxx `(.*) \(a .*\) walks in from .*`
/meta_with_wixxx `(.*) \(a .*\) walks up the path from .*`
/meta_with_wixxx `(.*) steps out of the platinum auctions theater from the south.`
/meta_with_wixxx `(.*) walks up the path from the public play space.`
/meta_with_wixxx `(.*) flies down from the skies above and lands.`
/meta_with_wixxx `^(\S+) has connected.$`
/meta_line `* has disconnected.`
/meta_line `* concentrates on a distant place, and fades from sight.`
/meta_line `* winks out of sight in the sparkling glow of a space/time rift.`
/meta_line `* walks southwest to the Public Show and Play area.`
/meta_line `* walks north to Dragon's Way.`
/meta_line `* walks east to East Mink Way.`
/meta_line `* walks west to West Mink Way.`
/meta_line `* walks northeast to the Classroom Campfire.`
/meta_line `* walks south to the Auction House.`
/meta_line `* goes home.`
/meta_line `* has left.`
/meta_line `* teleports away.`
/meta_line `* is taken home to sleep by the local police. (idle-sweep)`
/meta_line `* is taken home to sleep by the local police.`
/meta_line `* dozes off and gets swept away.`
/meta_line `There's no place like home...`
/meta_line `## You have entered the Unlinked Building zone.`
/meta_line `You wake up back home, without your possessions.`
;; Hilite errors red.
/def error_line = /def -aCred -F -mglob -t%{*}
/error_line `Huh? (Type "help" for help.)`
/error_line `I don't recognize the player named *`
/error_line `* is currently asleep.`
/error_line `You can leave mail with 'page #mail <plyrs>=<msg>'`
/error_line `I don't see that here.`
/error_line `You have been logged out due to inactivity.`
;; Additional wixxx triggers.
; Entering the Plaza
/wixxx_trigger `SIGN: This room is sex_ok.`
;; General stuff.
/hilite_page
/hilite_whisper
/partial (<|\[ ).* just looked at you( \]|>)
/partial (\[.* sniffs the air nearby\.\])
/loaded log_mentions.tf
;;;;;
; Mention logging
;
; Sets up logging of mentions while away to a file.
;
;; Log a line to the mentions file.
;
; Take the following actions:
; - if it's an automew, skip it.
; - try to open the mentions file.
; - if successful, write the line to the file with a timestamp and close.
/def logline = \
/if ({*} !/ "*__automew__*") \
/let fh=$[tfopen("mentions.txt", "a")]%; \
/if (fh != -1) \
/let now=$[ftime("%Y-%m-%d %H:%M:%S", time())]%; \
/test tfwrite(fh, strcat({now}, " - ", {*}))%; \
/test tfclose(fh)%; \
/endif%; \
/endif
;;; This is less than ideal, but we have to do a closure for each logline
;;; command, then set and unset a list of them in (un)log_mentions.
;;; Still, it works!
;; Log page-poses.
/def do_log_pagepose = \
/def -i -F -p2 -mregexp -t"^In a page-pose to you, .+$$" log_pagepose = \
$logline
;; Log pages.
/def do_log_page = \
/def -i -F -p2 -mregexp -t"^.+ pages, .+ to you.$$" log_page = \
$logline
;; Log instances of Maddy.
/def do_log_maddy = \
/def -i -F -p2 -mregexp -t"(?i)maddy" log_maddy = \
$logline
;; Log instances of Makyo.
/def do_log_makyo = \
/def -i -F -p2 -mregexp -t"(?i)makyo" log_makyo = \
$logline
;; Set up mention logging.
/def log_mentions = \
/echo ===== LOGGING MENTIONS =====%; \
/do_log_pagepose%; \
/do_log_page%; \
/do_log_maddy%; \
/do_log_makyo
;; Tear down mention logging.
/def unlog_mentions = \
/echo ===== LOGGING STOPPED =====%; \
/undef log_pagepose%; \
/undef log_page%; \
/undef log_maddy%; \
/undef log_makyo
;; Log mentions by default
/log_mentions
.PHONY: sync
sync:
scp "makyo@lagopus.makyo.io:*.tf .tfrc" .
git commit -am "Update from lagopus"
git push origin master
/loaded names.tf
;;;;;
; Names to hilite or gag
;
;; My characters and common misspellings/diminutives.
/partial (?i)Makyo
/partial (?i)Mayko
/partial (?i)Maddy
;/partial (?i)Ranna
/partial (?i)Happenstance
;/partial (?i)Macchi
/partial (?i)Younes
/partial (?i)Ephah
/partial (?i)Tsukiko
/partial (?i)\bKiko\b
/partial (?i)Sarai(Azoulay)?
;; Other people to hilite.
/wfpartial (?i)Lochiel
/wfpartial (?i)Lutea
/wfpartial (?i)Nocciola
/wfpartial (?i)\bTao\b
/wfpartial (?i)Vasha
/wfpartial (?i)Jaymie
/wfpartial (?i)Aeothen
/wfpartial (?i)Minka
/wfpartial (?i)Eirik
/wfpartial (?i)Kalyana
/wfpartial (?i)Maelkoth
/wfpartial (?i)Kord
/wfpartial (?i)Colton
/wfpartial (?i)Colton-Reye
/wfpartial (?i)Kaito
/wfpartial (?i)Maximus
/wfpartial (?i)Sarah_Baker
/wfpartial (?i)Sarah
/wfpartial (?i)Brone
;; Page helpers
/def colton = p colton-reye=%{*}
/def max = p maximus=%{*}
/def maelk = p maelkoth=%{*}
;; Gagged names and the reasons why
; CuddleBear:
; Creeping and inability to take no for an answer. Would message me constantly
; throughout the night begging for cub attention, then tell how much he hates
; his girlfriend for being bipolar. Made me realize that 'Miss Maddy' is
; context sensitive, and he's not allowed to use it in this context
/gag *CuddleBear*
; Terl:
; Largely just incomprehensible, but is incomprehensible in such blanket
; fashion that he's liable to say incredibly offensive stuff by accident. Has
; no understanding that he's doing so. Sorry, but no thanks.
/gag *{Terl}*
; WhiteWolf:
; Constant whining combined with misogyny and homophobia make Maddy growl.
/gag *WhiteWolf*
/loaded wixxx.tf
;;;;;
; wixxx logging
;
; Sets up commands and triggers for logging wixxx flags.
;
; Note that you'll need some variables set for this. You should have another
; wixxx-info.tf file that you load in .tfrc looking something like:
;
; /set WIXXX_USER=wixxx_username
; /set WIXXX_SECRET=wwixxx_secret
; /export WIXXX_USER
; /export WIXXX_SECRET
; /set wixxx_python=/path/to/wixxx/venv/bin/python
; /set wixxx_client=/path/to/wixxx/wixxx-client.py
; /set wixxx_server=https://wixxx.vis.adjectivespecies.com
;;; The following need to be wrapped in two layers of closures for reasons I
;;; don't totally understand. Doing them in one layer (that is, getting rid of
;;; do_wixxx_write and just having the closure in create_wixxx_write write the
;;; line) produces `% create_wixxx_write: unexpected /ENDIF in outer block`.
/def create_wixxx_write = /def -F -p2 -ag -mregexp -t"^(.+)$$" wixxx_write = \
$do_wixxx_write
;; Log a normal wixxx line to a file.
/def do_wixxx_write = \
/if (wixxx_fh != -1) \
/test tfwrite(wixxx_fh, {P1})%; \
/endif
/def create_wixxx_stop = /def -F -p3 -ag -mregexp -t"^(-------------------------------------------------------- by K'T/AnnonyMouse --)$$" wixxx_stop = \
$do_wixxx_stop
;; Stop logging wixxx.
;
; Take the following actions:
; - Write the final wixxx line to the file
; - Close the file
; - Delete these macross
; - Call the client.
/def do_wixxx_stop = \
/if (wixxx_fh != -1) \
/test tfwrite(wixxx_fh, {P1})%; \
/test tfclose(wixxx_fh)%; \
/endif%; \
/set wixxx_fh=-1 %; \
/undef wixxx_write%; \
/undef wixxx_stop%; \
;; Write the line silently. Comment this out and uncomment the line after to
;; receive a notification
/eval /quote /set wixxx_output !echo `%%{wixxx_python} %%{wixxx_client} --server %%{wixxx_server} %%{logname}` `date`&& rm %%{logname}
;/eval /quote /echo :::wixxx-client: !%%{wixxx_python} %%{wixxx_client} --server %%{wixxx_server} %%{logname} && rm %%{logname}
;; Start the process of logging wixxx.
;
; Take the following action:
; - Open the file with a unique filename
; - Create the macros
; - Send the wixxx command
/def logwixxx = \
/eval /set logname /tmp/wixxx.${world_name}.$[ftime("%@")]%; \
/set wixxx_fh=$[tfopen(logname, "w")]%; \
/if (wixxx_fh != -1) \
/create_wixxx_write%; \
/create_wixxx_stop%; \
;/eval /echo :::wixxx: %{*}%; \
/send wixxx %{*}%; \
/endif
;; Trigger to log wixxx.
;
; Use a regexp to capture any names in case you only want to wixxx those.
; The match should come quoted - e.g:
; /wixxx_trigger `foo`
/def wixxx_trigger = \
/def -F -p2 -mregexp -t%{*} = /logwixxx %%{P1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment