Guest Board

Message Details

Magical TF Scripts!

By Tristan on 23/08/2009 03:04:01

Just in case anyone else uses tinyfugue to connect I thought I'd post a couple scripts I have written to do exciting things! This first one is a python script that uses libnotify to pop up a window to display notifications. This works only on linux, unless the library is available for other systems. #!/usr/bin/python import sys if len(sys.argv) ==3: title = sys.argv[1] text = sys.argv[2] try: import pynotify if pynotify.init("Notify Script"): n = pynotify.Notification(title, text) n.show() else: print "error initialising pynotify" except: print "pynotify not installed" else: print "usage: notify.py <title> <message>" --END FILE-- The next one is a script that contains tinyfugue macros. The first one is the one that calls the above python script. It makes a notification appear when a global event is received. The next few lines together change the title of the gnome-terminal/xterm that tf is running in to the last line of text received from the mud. This means you can minimise the terminal and the title in the taskbar will change when something happens. /def -p1 -mregexp -t'\\(global\\) ([a-zA-Z \.]*)$' notify = /sys /home/tristan/svn/Scripts/notify.py "Antikaria" "%{P1}" /set shpause=off /set interactive=off /set warn_curly_re=off /def -p1 -mregexp -t'([\d\w\s\:\'\"\[\]\-\.\!\?\@\(\)]{1,30}).*$' settitle = /sh -q echo -ne "\033]0;TF: %{P1}\007" -- END FILE -- You can put that in your .tfrc file and have it loaded automatically when tf starts. Let me know if you have any comments, suggestions, or improvements to the scripts! Tristan

Back to board index.