Guides

TinTin++ with open-source tools

This guide outlines the implementation of a modular TinTin++ environment designed for terminal-based MUDding. It focuses on creating a scalable script architecture, handling multi-session management, and optimizing the terminal UI for high-speed gameplay.

45-60 minutes6 steps
TinTin++ with open-source tools hero illustration
1

Establish a Modular Directory Structure

Avoid monolithic script files. Create a directory structure that separates core logic, character-specific settings, and external data to allow for easier debugging and version control.

mkdir -p ~/mud/scripts/common ~/mud/scripts/chars ~/mud/logs
touch ~/mud/main.tin ~/mud/scripts/common/aliases.tin ~/mud/scripts/common/triggers.tin

⚠ Common Pitfalls

  • Placing scripts in the same directory as the binary can lead to permission issues or accidental deletion during upgrades.
2

Configure the Master Loader Script

Create a main.tin file that acts as the entry point. This script handles global settings, loads common modules, and defines the connection logic using variables for flexibility.

main.tin
#config {charset} {UTF-8}
#config {packet patch} {0.5}
#read {scripts/common/aliases.tin}
#read {scripts/common/triggers.tin}

#alias {connect_%1} {
    #session {%1} {%1.mud.com} {4000};
    #read {scripts/chars/%1.tin}
}

⚠ Common Pitfalls

  • Failing to set the correct charset will cause broken box-drawing characters in maps and status bars.
  • Hardcoding connection strings makes it difficult to manage multiple characters.
3

Implement Split-Screen and Status Bars

Utilize the #split command to separate the input line from the output buffer. This prevents incoming text from interrupting your typing and provides a dedicated area for status indicators.

scripts/common/ui.tin
#split 1 1
#prompt {HP: %1 MP: %2} {HP: %1 MP: %2} {1}
#action {^HP: %1/%2 MP: %3/%4} {
    #showme {<118>HP: %1/%2 MP: %3/%4} {-1}
}

⚠ Common Pitfalls

  • Setting split lines incorrectly can cause screen flickering in some terminal emulators like rxvt or screen.
4

Secure Credential Management

Do not hardcode passwords in scripts. Use variables that can be populated at runtime or read from a local, non-versioned file to automate the login sequence securely.

scripts/common/login.tin
#action {^What is your name?} {#send {$username}}
#action {^Enter your password:} {#send {$password}}

#alias {login} {
    #read {scripts/private/creds.tin};
    connect_character_name
}

⚠ Common Pitfalls

  • Accidentally committing scripts/private/creds.tin to a public Git repository.
  • Using #action for passwords without anchors (^) can lead to security leaks if the MUD echoes the prompt unexpectedly.
5

Enable Automated Logging and Timestamping

Configure session logging to capture all raw output for later analysis or trigger debugging. Use the #format command to generate dynamic filenames based on the current date.

scripts/common/logging.tin
#event {SESSION CONNECTED} {
    #format {datestamp} {%t} {%Y-%m-%d};
    #log {append} {logs/%0-$datestamp.log}
}
#config {LOG} {PLAIN}

⚠ Common Pitfalls

  • Using HTML logging by default can make grep-based searches difficult.
  • Forgetting to use 'append' mode may result in overwriting logs during session reconnects.
6

Initialize the Automapper

Set up the internal pathing engine. This requires defining the map file location and telling TinTin++ how to interpret directional movement commands to update the visual map.

scripts/common/mapping.tin
#map read {world.map}
#map flag vtmap on
#alias {map_save} {#map write {world.map}}
#action {^Exits: %1} {
    #map get roomvnum {result};
    #if {$result == 0} {#map create}
}

⚠ Common Pitfalls

  • Mapping errors occur if the client misses a movement fail message (e.g., 'The door is locked'). Ensure triggers are set to catch movement failure strings to synchronize the map.

What you built

With this modular setup, your TinTin++ environment is optimized for stability and extensibility. You can now add character-specific logic in the chars/ directory without cluttering the core engine, while maintaining secure credentials and persistent logs.