Useful TF Macros/Keybindings/STUFF!

Text:

The purpose of this wiki page is to create a list of Pennmush's/the mushing world's favourite TF 'Stuff'. Please feel free to put your favourite Macro/Keybinding/Feature - if you find it useful, then others most likely will as well! I'll start the list out with my own favourites.

A logging script to log each world on connection to it's own directory. Lognames are in MM-DD-YY format:
/def -hCONNECT log_on_connect=/log -w ~/share/${world_name}/$[ftime("%m-%d-%y")].log

A simple idle timer (for routers that won't let you keepalive to a telnet connection):
/def do_idle = /send -W IDLE%;/repeat -0:3 1 /do_idle

Rebinding to get CTRL+S spell checking capability of command input:
/def -b'^S' = /spell_line

Rebinding to get CTRL+P command input history search (Thanks Jav!):
/def -b'^P' = /dokey SEARCHB

Set your locale on login (e.g., to get accents):
/def -p1 -hLOGIN accents = /setenv LANG en_US

; Skip long scrollback
/def skip = /test morescroll(moresize()+1)

; Open a web address (in firefox) with /browse
/def browse = /sys firefox -remote "openurl(%1)"

Tell if a given URI is reachable (Requires wget). Intended for macros that test urls stored in a game:
/def uri_exists = /set cmd=-1 %;/set code="" %;/echo $[(cmd := tfopen(strcat("wget -nv --spider ", {*}, " 2>&1"), "p")), tfread(cmd, code), tfclose(cmd), code =/ "200*"]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

In the old tradition of

In the old tradition of finding other ways to do things:

A simple idle timer (for routers that won't let you keepalive to a telnet connection):
/def do_idle = /send -W IDLE%;/repeat -0:3 1 /do_idle

In TF5 saying 'i' as the repeat count means infinite, so:
/def do_idle = /repeat -0:3 i /send -W IDLE
Or if you always want it on to begin with, just:
/repeat -0:3 i /send -W IDLE

Rebinding to get CTRL+S spell checking capability of command input:
/def -b'^S' = /spell_line

Probably needs you to /require spell.tf, which binds the above to meta-s (usually alt+s or ESC s) by default. (Also note that ^S can hang some terminals until you press ^Q)

Set your locale on login (e.g., to get accents):
/def -p1 -hLOGIN accents = /setenv LANG en_US

Or just /setenv LANG en_US so it just does it once, at startup.

; Skip long scrollback
/def skip = /test morescroll(moresize()+1)

Or /dokey FLUSH which by default is bound to meta-j ;)

Also.. If you want PROMPT_NEWLINES set to 0 on just PennMUSHes:

/def -T'tiny.penn' -hLOGIN penn_login_newlines=/send -w PROMPT_NEWLINES 0

This assumes you define PennMUSHes like tiny.penn, MUX like tiny.mux, etc.

Make the space bar scroll 'more', but only when there's nothing already in your input window, and only if there's any more to read:

/def -b" " space=/if (kblen() == 0 & morepaused()) /dokey page%;/else /input $[char(32)]%;/endif

Strip all ANSI from channels:

/def -T'tiny.penn' -mregexp -t'^<(.+?)> (.+)' -P0nx deansify

If you don't follow the tiny.penn convention, change the -T bit or leave it out entirely. Also thanks to Trinsec, who found a better way to do this than I used before.

Put the current world name in the window title ('xterm title'):

/hook WORLD=/xtitle ${world_name}

You need to /require tools.tf if you don't already to use it.

Random bits: I'd suggest looking into the following (help files) if you haven't yet: /quote, /limit, kbstack.tf, attributes (the 'A' attribute is often overlooked).

I should post some of my larger scriptlets somewhere for people to grab since a few of them are terribly useful, and some I don't find very useful, but other people do.

Dark player check

Here's a macro and hooks for spotting dark wizards (and other players who can go dark) in the room you're in, without constantly having to do a @sweep. This bit of code will automatically do a check every time you pose or say something.

/def darkwiz=/send think iter(lcon(here),ifelse(andflags(##,PD),%r%xrGAME:%xn [name(##)] is here %xcDark.%xn,))

/def -p1 -mregexp -h'SEND ^:(.+)$' = /send :%{P1}%; /darkwiz

/def -p1 -mregexp -h'SEND ^say (.+)$' = /send say %{P1}%; /darkwiz

Use the ':' example to extend this to other single-char commands with no space (" ; etc.), and the 'say' example for other word commands with a space (pose, an ooc message command, etc.)

The code for the darkwiz macro is TinyMUSH 3; adjust it to server flavor if necessary (%c rather than %x for ANSI code, replace andflags() with anything else that detects 'player with dark flag', etc.).

All of the tf scripts I use

All of the tf scripts I use are available at:

http://walker.pennmush.org/tf/

Scripts currently there are:

srec.tf - Cheetah's "Search Recall". So if you want to recall the last input line you sent that includes the phrase "phooey", type "phooey" and hit ^R. Hit it a few more times to search farther back in input history.

copyto.tf - A simple tf script I wrote to make copying objects from mushes to mushes over. It requires a PennMUSH with the @decompile = syntax.

kbdoublestack.tf - A modification of kbstack to have stacks up and down, so you can search your stack history without losing anything. It's incredibly useful when coding, especially if you're a Yak Shaver like me. Start some code, see somebody chat, hit esc-down to push your unfinished code onto the stack, chat, esc-up to recall.

teach.tf - A small script with /teach that lets you "teach" tf code. "/teach /quote -0 !grep walker /etc/passwd"

tfrc - My .tfrc, slightly modified. You'll notice it refers to ~/.tfworlds, which I maintain separately, and am not posting as it includes passwords, etc. ;).

keys.tf - A lot of keybindings, including two dynamic bits: 1) Ctrl X - C will limit tf to the channel you're currently talking on, or last talked on. 2) F1 to F10 are bound to the worlds in the order you connect to them, and on disconnect the f-key is released for later binding.

Feel free to use, abuse, modify, trash, ignore, learn from or slice and dice for your Omelet.

--
My kingdom for a minute of silence!

a "comment"

This is a wiki.

Separator

Cheetah showed a way to put world name in window title.

I remember, several years ago, I had something like that for the separator line (between input/output) ... different color with full world name, blah blah blah.

Anyone have any code for this?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.