Chapter 3. Configuration

Table of Contents

TF configuration file
Character set encoding and locales
Terminal/keyboard issues
BatMUD settings

After extracting GgrTF files into the appropriate directory folder, you will need to create (or change) configuration for TinyFugue to load GgrTF modules and possibly change some of your settings in BatMUD.

If you are upgrading GgrTF from a previous version, it is possible that you do not have to change your configuration. But it is neverthless recommended that you skim through this section, the ChangeLog and module-specific sections of this manual in case of any significant, backwards incompatible changes.

TF configuration file

Typical way to use GgrTF is to load the script modules at startup. This is accomplished via TinyFugue's configuration file, commonly referred as "tfrc", location of which depends on your operating system and environment.

  • UNIX-like systems, like Linux: ~/.tfrc or $HOME/.tfrc (aka a file named ".tfrc" in your user home directory.)

  • DruWare Win32 port of TF: Windows XP/2k/NT - C:\Documents and Settings\username\tfrc, Windows 7/Vista - C:\Users\username\tfrc

As a basis for your TF configuration, you can use the example-tfrc.txt provided with GgrTF. You will need to edit it to suit your guilds and certain settings. However, the example-tfrc is only a suggested layout of configuration, mostly to show the order GgrTF requires modules and settings to be loaded. It does not contain everything you can possibly do with TF.

Take note of the order of how different parts of GgrTF are loaded and where certain variables are set. Important thing is to have the order right, certain modules depend on other modules, and while GgrTF will usually print warning message(s) if the depencies are not met, sometimes this is not possible and erratic behaviour will occur.

;; Turn logging off, while we set things up
/log off

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Personal settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Set player name before loading scripts
/eval /set set_plrname=Ggr

;; Savefiles should be stored under $HOME/.ggrtf/
/eval /set set_datapath=%{HOME}/.ggrtf/

;; We want savefiles to use filename prefix "bat-"
/eval /set set_saveprefix=bat-


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Character set / locale
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; You MAY need to set your character set encoding/locale to have
;; non-ASCII characters work properly in BatMUD. This is outside of
;; the scope of GgrTF, but it is discussed in more depth in the
;; user's manual.

;/setenv LANG=en_US.iso88591

;; You may also try following settings if ISO-8859-1 does not work:
; /setenv LANG=en_US.iso885915
; /setenv LANG=en_US.latin1


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load GgrTF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; We define a helper macro to load modules from
;; under user's home directory $HOME/ggrtf/
/def -i gloadmod = /eval /load %{HOME}/ggrtf/%{*}

;; Preloader module MUST be loaded first
/gloadmod ggrtf-pre.tf

;; And the main module after that ...
/gloadmod ggrtf.tf

;; Some useful modules: mangler, placer, spellname translator
/gloadmod gm-pssmangle.tf
/gloadmod gm-magical.tf
/gloadmod gm-tgtcast.tf
/gloadmod gm-pplacer.tf
/gloadmod gm-spellnames.tf
/gloadmod gm-tf5.tf

;; Load additional modules now
/gloadmod gm-rais.tf
/gloadmod gm-tarma.tf
/gloadmod gm-nun.tf


;; Load previously saved settings after all modules are initialized
/gload


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load keyboard support files
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bind some keys
/gloadmod kbd-xterm.tf
/gloadmod kbd-tf5def.tf

;; Some personal keybinds here ...
;/def -i -b'^[Om' = @smode
;/def -i -b'^[Ok' = @cmode


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Re-start logging (examples below, uncomment one)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Log to tiny.log in CWD (current working directory)
; /log on

;; Log to tiny.log in user's home directory
; /eval /log %{HOME}/tiny.log

;; Log to tiny-YYYY-MM-DD.log in user's home directory
; /eval /log %{HOME}/tiny-$[ftime("%Y-%m-%d")].log

Character set encoding and locales

One thing that is out of scope of GgrTF itself, is the issue of character set translation and locales. This basically means the way different characters are encoded and interpreted, how different values map to characters and vice versa, for example a simple encoding might be A=1, B=2, C=3, etc.

One of the first and most widely used character encodings on computer systems is known as 7-bit ASCII. This encoding allows 128 symbols or characters, and was commonly used for decades. Unfortunately, 128 symbols is nearly not sufficient enough to represent all the different alphabets or symbols used around the world (scandinavian characters, cyrillic alphabet, etc.) Thus other encodings were invented, most of them incompatible with each other, until introduction of Unicode standard and especially Unicode UTF-8.

The de-facto character set used in BatMUD is called "ISO-8859-1" which is a 8-bit encoding that allows 7-bit ASCII characters and 8-bit encoding of scandinavian characters (A and O with dots, etc). This is mostly due to BatMUD's origin in Finland, where ISO-8859-1 has been most deployed.

However, increasing number of systems are starting to use Unicode "UTF-8" encoding, and other encodings are also still used. Unicode is a good thing in itself, and UTF-8 allows compatible 7-bit ASCII characters, but 8-bit and over are not compatible with ISO-8859-1. This is why if your system uses UTF-8, other people in BatMUD may see your non-ASCII characters incorrectly.

Now that we know the issue, what can we do? Sometimes the solution may be very simple, but in many cases rather complex and very dependant on your setup - e.g. where you run TF, is it a shell or running locally, etc. Below is a list of tips and pointers, which may be of some help.

UNIX-likes / Linux

For Linux/UNIX, you need to have the ISO-8859-1 locale installed/configured. How this is done depends on your OS distribution. For example in Debian, you need to use dpkg-reconfigure locales and add some ISO-8859-1 locale, for example en_US.iso88591.

On Ubuntu, things get a bit more complicated:

  1. Edit /var/lib/locales/supported.d/local with your favorite editor, and on the last line add: en_US.ISO-8859-1 ISO-8859-1. It should look something like this:

    en_US.UTF-8 UTF-8
    en_US.ISO-8859-1 ISO-8859-1
  2. Then, run sudo dpkg-reconfigure locales

On other Linux distributions and UNIX-like platforms the methods for installing locales vary. Your best bet is to Use the Google.

If your system is using some locale other than ISO-8859-1 such as UTF-8, you will need to make the terminal use ISO-8859-1 despite the system-global setting, or alternatively use some software like GNU Screen to "translate" between your system's and BatMUD's ISO-8859-1. Some information about how to make GNU Screen do that, can be found from this website: http://aperiodic.net/screen/terminal.

However, if you choose not to use 'screen', you will have to either start your terminal program (inside which TinyFugue will run) with the locale set to ISO-8859-1, OR if your terminal supports the feature, use the following shell script wrapper which will use terminal control codes to change the effective character translation. This feature is not supported by all terminals, XTerm and Rxvt are known to support it, however. You will need to copy+paste the script, or download it from here.

#!/bin/sh
SAVE_LANG="$LANG"
export LANG="en_US.ISO-8859-1"
printf '\33]701;%s\007' $LANG

/usr/bin/tf5 $*

export LANG="$SAVE_LANG"
printf '\33]701;%s\007' $LANG

You should place the script in some directory in your $PATH. You will also need to modify it to point to the correct TinyFugye executable, (e.g. change "/usr/bin/tf5" if needed.) Name the script as something like "mytf" or rename the real TinyFugue executable as "tf5-bin" and the script as "tf5", changing the script to point to tf5-bin.

Remember to set the script executable by changing its permissions, 'chmod 0755 /some/where/scriptfile' should do it.

The idea is that you run the script instead of TF directly. The script changes your current locale and forces the terminal via special terminal control code to use it, and changes it back after TF exits.

Terminal/keyboard issues

You need to make sure that you have the correct keyboard module(s) loaded. For most Linux/UNIX terminals you want to load EITHER or BOTH kbd-xterm.tf and kbd-tf5def.tf. For TF on Windows and Mac OSX, you may wish to use kbd-tf5def.tf only. You may need to experiment.

Additionally, it may be necessary to enable the so-called "application mode" in your terminal.

  • In OSX terminal app, the setting can be found in Terminal / Preferences / Setting / Advanced and turn on "Allow VT100 application keypad mode".

  • In PuTTY, the application keypad mode should be enabled by default, but if it is not, see the Features panel of PuTTY's configuration, see PuTTY documentation here.