Peril_Dice/Verbose_Logger.lsl
RebeccaNod1 dd03bd8eef v2.8.5 - Memory Optimization & Architecture Cleanup
🧠 MEMORY OPTIMIZATION & DEAD CODE CLEANUP:
- Removed vestigial UpdateHelper.lsl (204 lines, ~41KB memory waste)
- Main Controller memory improved from 83.8% to 81.4% (2.4% reduction)
- Simplified Verbose_Logger from 149 to 80 lines (47% reduction)
- Eliminated unused buffering systems and timer overhead

🎨 BOT PROFILE PICTURE FIX:
- Fixed bot avatars randomly turning into gray boxes mid-game
- Modified refreshPlayerDisplay() to preserve active player textures
- Enhanced bot caching to prevent HTTP requests
- Stable bot visuals throughout entire game

🏗️ ARCHITECTURE OPTIMIZATION:
- Updated link numbers: Scoreboard (2→12), Leaderboard (25→35), Dice (73→83)
- Enhanced prim structure with dedicated overlay prims (links 2-11)
- Updated 11 scripts with new mappings and prim ranges
- More organized and scalable linkset structure

🔧 ENHANCED GAME LOGIC & BUG FIXES:
- Improved number picker parsing for CSV and semicolon formats
- Enhanced bot round detection and fair play mechanics
- Better communication handling and player feedback
- Whitespace handling for consistent number parsing

📊 PERFORMANCE IMPACT:
- Measurable memory reduction across multiple scripts
- Eliminated profile picture flickering and display issues
- Reduced unnecessary inter-script message traffic
- Cleaner, more maintainable codebase

Files changed: 11 modified scripts, 4 updated documentation files
Total: 838 insertions, 776 deletions representing significant optimization
2025-09-14 20:44:52 -05:00

79 lines
2.9 KiB
Text

// === Verbose Logger - Simple Debug Toggle Controller ===
// Provides system-wide verbose logging toggle functionality
// Scripts use their own VERBOSE_LOGGING flags, this just coordinates the toggle
// Verbose logging control
integer VERBOSE_LOGGING = FALSE;
// Loop protection - prevent rapid toggle spam
float lastToggleTime = 0.0;
float TOGGLE_COOLDOWN = 2.0; // Minimum 2 seconds between toggles
// Message constants for verbose logging system
integer MSG_VERBOSE_TOGGLE = 9010; // Toggle verbose logging on/off
integer MSG_VERBOSE_BROADCAST = 9011; // Broadcast logging state to all modules
// Report memory status of this script
reportMemoryStatus() {
if (VERBOSE_LOGGING) {
integer free = llGetFreeMemory();
integer used = llGetUsedMemory();
llOwnerSay("🔍 [Verbose Logger] Memory - Free: " + (string)free + " Used: " + (string)used);
}
}
default {
state_entry() {
llOwnerSay("🔍 Verbose Logger initialized - ready to handle debug toggle");
}
on_rez(integer start_param) {
llOwnerSay("🔍 Verbose Logger rezzed - debug system ready");
VERBOSE_LOGGING = FALSE; // Default to off after rez
}
link_message(integer sender, integer num, string str, key id) {
// Handle verbose logging toggle - FIXED to prevent loops
if (num == MSG_VERBOSE_TOGGLE && str == "TOGGLE_VERBOSE_LOGS") {
// Only respond if sender is NOT the Main Controller (prevent forwarding loop)
if (sender == 1) {
// This came from Main Controller forwarding - ignore to prevent loop
return;
}
// Loop protection - prevent rapid toggle spam
float currentTime = llGetTime();
if (currentTime - lastToggleTime < TOGGLE_COOLDOWN) {
return; // Silent ignore during cooldown
}
lastToggleTime = currentTime;
VERBOSE_LOGGING = !VERBOSE_LOGGING;
string status = "OFF";
if (VERBOSE_LOGGING) {
status = "ON";
llOwnerSay("🔍 [Verbose Logger] Debug logging: ENABLED");
} else {
llOwnerSay("🔍 [Verbose Logger] Debug logging: DISABLED");
}
// Public announcement
llSay(0, "🔍 Verbose logging system-wide: " + status);
// Broadcast the new setting to all modules
llMessageLinked(LINK_SET, MSG_VERBOSE_BROADCAST, "VERBOSE_LOGGING|" + (string)VERBOSE_LOGGING, id);
return;
}
// Handle verbose logging broadcast from other scripts
if (num == MSG_VERBOSE_BROADCAST) {
list parts = llParseString2List(str, ["|"], []);
if (llList2String(parts, 0) == "VERBOSE_LOGGING") {
VERBOSE_LOGGING = llList2Integer(parts, 1);
return;
}
}
}
}