Overview
The DragonRealms experience monitoring system provides real-time tracking of skill experience gains with configurable display options. TheDRExpMonitor module manages background reporting threads and inline experience displays.
DRExpMonitor
TheDRExpMonitor module provides methods to control experience gain tracking.
start
Starts the background experience reporter thread.- Creates a background thread that reports skill gains every second
- Displays info message if already active
- Returns early with error if
exp-monitor.licscript is running (conflicts) - Thread automatically reports aggregated skill gains until stopped
stop
Stops the background experience reporter thread.- Terminates the reporter thread gracefully
- Displays info message if already inactive
- Thread cleanup happens automatically
active?
Checks if the experience reporter is currently running.trueif the reporter thread is runningfalseif stopped
inline_display?
Checks if inline experience display is enabled.trueif inline display is enabledfalseif disabled (default)
- Lazy-loaded from database on first access
- Defaults to
false- must be explicitly enabled - Uses persistent storage (survives restarts)
- Includes SQLite retry logic with max 10 attempts
inline_display=
Enables or disables inline experience display.Enable (
true, "on", "yes") or disable (false, "off", "no") inline display- Accepts boolean or string values (“on”, “true”, “yes” for true)
- Persists setting to database for future sessions
- Modifies
EXPoutput to include cumulative gained experience - Includes SQLite retry logic with max 10 attempts
format_briefexp_on
Formats a BRIEFEXP ON line to include cumulative gained experience.The original BRIEFEXP ON format line
The skill name to look up gained experience
- Modified line with gained experience appended
- Original line unchanged if inline display is disabled
format_briefexp_off
Formats a BRIEFEXP OFF line to include cumulative gained experience.The original BRIEFEXP OFF format line
The skill name to look up gained experience
The learning rate word (e.g., “learning”, “pondering”)
- Modified line with gained experience appended
- Original line unchanged if inline display is disabled
Constants
MAX_SQLITE_RETRIES
Maximum number of SQLite retry attempts before giving up.BOOLEAN_TRUE_PATTERN
Regular expression for matching boolean true values.Command Line Usage
The experience monitor can be controlled via thedisplay command:
Cannot run simultaneously with
exp-monitor.lic script. Use ;kill exp-monitor first if needed.Integration with DRSkill
The experience monitor integrates with theDRSkill module to access skill data:
Thread Safety
The experience monitor is thread-safe:- Uses class variables for state management
- Reporter thread runs in background
- Cleanup handler registered via
at_exit - Automatic stop on disconnect or exit
Error Handling
Robust error handling includes:- SQLite busy exception retry logic (max 10 attempts)
- Conflict detection with
exp-monitor.licscript - Graceful degradation on database lock
- Error logging for debugging (
$DREXPMONITOR_DEBUG)
