- Fixed LSL syntax errors caused by unsupported ternary operator (condition ? value1 : value2) - Replaced all ternary operators with proper if/else statements in verbose logging toggles - Ensures 'ENABLED'/'DISABLED' messages display correctly without compilation errors - Updated files: Bot_Manager.lsl, Controller_Memory.lsl, Controller_MessageHandler.lsl, Floater_Manager.lsl, Game_Calculator.lsl, Game_Manager.lsl, Game_Scoreboard_Manager_Linkset.lsl, Leaderboard_Communication_Linkset.lsl, Main_Controller_Linkset.lsl, NumberPicker_DialogHandler.lsl, Player_DialogHandler.lsl, Roll_ConfettiModule.lsl, System_Debugger.lsl, XyzzyText_Dice_Bridge_Linkset.lsl - Updated WARP.md with latest v2.8.4 release information and fixes documentation
142 lines
5.5 KiB
Text
142 lines
5.5 KiB
Text
// XyzzyText Bridge Script - Dice Display Bridge (Linkset Version)
|
|
// This script goes in link 73 of the linkset
|
|
// Works with simple XyzzyText v1.0 script (like leaderboard)
|
|
// Handles dice roll display across 2 prims (20 characters total)
|
|
|
|
// =============================================================================
|
|
// LINKSET COMMUNICATION - NO DISCOVERY NEEDED
|
|
// =============================================================================
|
|
|
|
// Verbose logging control
|
|
integer VERBOSE_LOGGING = TRUE; // Global flag for verbose debug logs
|
|
integer MSG_TOGGLE_VERBOSE_LOGS = 9998; // Message to toggle verbose logging
|
|
|
|
// Message constants for link communication
|
|
// Dice messages (from link 1 - controller)
|
|
integer MSG_DICE_ROLL = 3020;
|
|
integer MSG_CLEAR_DICE = 3021;
|
|
|
|
integer DISPLAY_STRING = 204000;
|
|
|
|
// Dice prim links
|
|
integer DICE_PRIM_1 = 73; // First dice prim (characters 0-9)
|
|
integer DICE_PRIM_2 = 74; // Second dice prim (characters 10-19)
|
|
|
|
// Function to display dice text across both prims
|
|
displayDiceText(string text) {
|
|
// Ensure exactly 20 characters
|
|
while (llStringLength(text) < 20) {
|
|
text += " ";
|
|
}
|
|
if (llStringLength(text) > 20) {
|
|
text = llGetSubString(text, 0, 19);
|
|
}
|
|
|
|
// Split into 10-character chunks for each prim
|
|
string leftText = llGetSubString(text, 0, 9); // Characters 0-9
|
|
string rightText = llGetSubString(text, 10, 19); // Characters 10-19
|
|
|
|
// Send to individual XyzzyText prims
|
|
llMessageLinked(DICE_PRIM_1, DISPLAY_STRING, leftText, "");
|
|
llMessageLinked(DICE_PRIM_2, DISPLAY_STRING, rightText, "");
|
|
|
|
if (VERBOSE_LOGGING) {
|
|
llOwnerSay("🎲 Dice display updated: '" + text + "'");
|
|
}
|
|
}
|
|
|
|
default {
|
|
state_entry() {
|
|
if (VERBOSE_LOGGING) {
|
|
llOwnerSay("🎲 Dice Display Bridge ready! (Linkset Version)");
|
|
llOwnerSay("🎲 This is link " + (string)llGetLinkNumber() + " - should be link 73");
|
|
llOwnerSay("🎲 Managing dice display links 73-74 (2 prims total)");
|
|
llOwnerSay("✅ Linkset communication active - listening for messages from link 1!");
|
|
}
|
|
|
|
// Initialize dice display with blank text (10 spaces each prim)
|
|
displayDiceText(" "); // 20 spaces
|
|
|
|
if (VERBOSE_LOGGING) {
|
|
llOwnerSay("Dice display initialized - using simple XyzzyText v1.0 (like leaderboard)");
|
|
}
|
|
}
|
|
|
|
link_message(integer sender, integer num, string str, key id) {
|
|
// Handle verbose logging toggle
|
|
if (num == MSG_TOGGLE_VERBOSE_LOGS) {
|
|
VERBOSE_LOGGING = !VERBOSE_LOGGING;
|
|
if (VERBOSE_LOGGING) {
|
|
llOwnerSay("🔊 [Dice Bridge] Verbose logging ENABLED");
|
|
} else {
|
|
llOwnerSay("🔊 [Dice Bridge] Verbose logging DISABLED");
|
|
}
|
|
return;
|
|
}
|
|
|
|
// Only listen to messages from the main controller (link 1)
|
|
if (sender != 1) return;
|
|
|
|
if (num == MSG_DICE_ROLL) {
|
|
// Handle different message formats
|
|
list parts = llParseString2List(str, ["|"], []);
|
|
|
|
if (llGetListLength(parts) >= 3) {
|
|
// Format: "player|result|dicetype" - single die roll
|
|
string player = llList2String(parts, 0);
|
|
string result = llList2String(parts, 1);
|
|
string diceType = llList2String(parts, 2);
|
|
|
|
// Create dice display: "Player1: rolled 4 "
|
|
string displayText = player;
|
|
if (llStringLength(displayText) > 8) {
|
|
displayText = llGetSubString(displayText, 0, 7);
|
|
}
|
|
displayText += ": rolled " + result;
|
|
|
|
displayDiceText(displayText);
|
|
}
|
|
else {
|
|
// Treat as direct display text
|
|
displayDiceText(str);
|
|
}
|
|
}
|
|
else if (num == MSG_CLEAR_DICE) {
|
|
// Clear dice display (20 spaces)
|
|
displayDiceText(" ");
|
|
if (VERBOSE_LOGGING) {
|
|
llOwnerSay("🎲 Dice display cleared");
|
|
}
|
|
}
|
|
}
|
|
|
|
touch_start(integer total_number) {
|
|
// Owner can get debug info and test display by touching dice
|
|
if (llDetectedKey(0) == llGetOwner()) {
|
|
llOwnerSay("🎲 Dice Display Status:");
|
|
llOwnerSay(" Link Number: " + (string)llGetLinkNumber());
|
|
llOwnerSay(" Total prims in linkset: " + (string)llGetNumberOfPrims());
|
|
llOwnerSay(" Managing links 73-74 (2 XyzzyText prims)");
|
|
llOwnerSay(" Listening for messages from link 1 (controller)");
|
|
llOwnerSay(" Using simple XyzzyText v1.0 (like leaderboard)");
|
|
|
|
// Test display - 20 characters total
|
|
displayDiceText("TEST: Player1 -> 6 ");
|
|
llOwnerSay("🎲 Test display sent: 'TEST: Player1 -> 6 '");
|
|
llOwnerSay("🎲 Touch again in 3 seconds to clear test");
|
|
|
|
// Set timer to clear test display
|
|
llSetTimerEvent(3.0);
|
|
} else {
|
|
// Non-owner touch - show friendly message
|
|
llSay(0, "🎲 Dice display shows the latest rolls! Watch for game actions!");
|
|
}
|
|
}
|
|
|
|
timer() {
|
|
// Clear test display
|
|
llSetTimerEvent(0.0); // Stop timer
|
|
displayDiceText(" "); // 20 spaces
|
|
llOwnerSay("🎲 Test display cleared");
|
|
}
|
|
}
|