From 15318d82923a75a60f6fea2ed6c4142decf06148 Mon Sep 17 00:00:00 2001 From: RebeccaNod1 Date: Thu, 18 Sep 2025 12:32:13 -0500 Subject: [PATCH] Fix LSL validation errors in Game_Calculator, Leaderboard_Communication_Linkset, and Player_DialogHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Game_Calculator.lsl: Fixed 6 variable name conflicts (i, idx, testName, parts) - Leaderboard_Communication_Linkset.lsl: Fixed 3 variable name conflicts (lines, i, linkNum) - Player_DialogHandler.lsl: Fixed 8 variable name conflicts (options, i, displayName, menuText) - Progress: 115 → 91 total errors (-24 total, -8 this batch) --- Game_Calculator.lsl | 56 +++++++++++----------- Leaderboard_Communication_Linkset.lsl | 22 ++++----- Player_DialogHandler.lsl | 68 +++++++++++++-------------- 3 files changed, 73 insertions(+), 73 deletions(-) diff --git a/Game_Calculator.lsl b/Game_Calculator.lsl index e8f4741..2692128 100644 --- a/Game_Calculator.lsl +++ b/Game_Calculator.lsl @@ -54,19 +54,19 @@ integer getDiceType(integer playerCount) { // Determine how many picks a player should make based on the peril player's lives integer getPicksRequiredFromName(string name) { - integer idx = llListFindList(names, [name]); - if (idx == -1) { - integer i; - for (i = 0; i < llGetListLength(names); i++) { - string testName = llList2String(names, i); - if (llSubStringIndex(testName, name) != -1) { - idx = i; - i = llGetListLength(names); + integer nameIdx = llListFindList(names, [name]); + if (nameIdx == -1) { + integer j; + for (j = 0; j < llGetListLength(names); j++) { + string checkName = llList2String(names, j); + if (llSubStringIndex(checkName, name) != -1) { + nameIdx = j; + j = llGetListLength(names); } } } - if (idx == -1) return 0; - integer lifeCount = (integer)llList2String(lives, idx); + if (nameIdx == -1) return 0; + integer lifeCount = (integer)llList2String(lives, nameIdx); // Pick count = 4 - peril player's lives (3 lives=1 pick, 2 lives=2 picks, 1 life=3 picks) return 4 - lifeCount; } @@ -90,20 +90,20 @@ integer showPickManager(string player, key id) { searchName = llList2String(parts, 1); } - integer idx = llListFindList(names, [searchName]); - if (idx == -1) { - integer i; - for (i = 0; i < llGetListLength(names); i++) { - string testName = llList2String(names, i); - if (llSubStringIndex(testName, searchName) != -1) { - idx = i; + integer searchIdx = llListFindList(names, [searchName]); + if (searchIdx == -1) { + integer k; + for (k = 0; k < llGetListLength(names); k++) { + string matchName = llList2String(names, k); + if (llSubStringIndex(matchName, searchName) != -1) { + searchIdx = k; if (VERBOSE_LOGGING) { - llOwnerSay("✅ Matched pick list for: " + testName); + llOwnerSay("✅ Matched pick list for: " + matchName); } - i = llGetListLength(names); + k = llGetListLength(names); } } - if (idx == -1) { + if (searchIdx == -1) { if (VERBOSE_LOGGING) { llOwnerSay("⚠️ Could not find player: " + player); } @@ -111,19 +111,19 @@ integer showPickManager(string player, key id) { } } - integer maxPicks = getPicksRequiredFromName(llList2String(names, idx)); + integer maxPicks = getPicksRequiredFromName(llList2String(names, searchIdx)); - string currentData = llList2String(picksData, idx); - list parts = llParseString2List(currentData, ["|"], []); + string currentData = llList2String(picksData, searchIdx); + list dataParts = llParseString2List(currentData, ["|"], []); list currentPicks = []; - if (llGetListLength(parts) > 1) { - currentPicks = llParseString2List(llList2String(parts, 1), [","], []); + if (llGetListLength(dataParts) > 1) { + currentPicks = llParseString2List(llList2String(dataParts, 1), [","], []); } list buttons = []; - integer i; - for (i = 1; i <= 6; i++) { - string numStr = (string)i; + integer buttonIdx; + for (buttonIdx = 1; buttonIdx <= 6; buttonIdx++) { + string numStr = (string)buttonIdx; if (llListFindList(currentPicks, [numStr]) != -1) { buttons += ["❌ " + numStr]; } else if (llGetListLength(currentPicks) < maxPicks) { diff --git a/Leaderboard_Communication_Linkset.lsl b/Leaderboard_Communication_Linkset.lsl index b37763e..ed2001c 100644 --- a/Leaderboard_Communication_Linkset.lsl +++ b/Leaderboard_Communication_Linkset.lsl @@ -78,26 +78,26 @@ distributeFullText(string text) { // Legacy function for single bank distribution distributeToBank(string text, list linkNumbers) { - list lines; + list bankLines; // If text is empty, create a list of empty strings to clear all prims if (text == "") { integer numPrims = llGetListLength(linkNumbers); - integer i; - for (i = 0; i < numPrims; i++) { - lines += [" "]; // 10 spaces to clear each line + integer j; + for (j = 0; j < numPrims; j++) { + bankLines += [" "]; // 10 spaces to clear each line } } else { - lines = llParseString2List(text, ["\n"], []); + bankLines = llParseString2List(text, ["\n"], []); } // Send text to each prim in the bank - integer i; - for (i = 0; i < llGetListLength(linkNumbers); i++) { + integer k; + for (k = 0; k < llGetListLength(linkNumbers); k++) { string line; - if (i < llGetListLength(lines)) { - line = llList2String(lines, i); + if (k < llGetListLength(bankLines)) { + line = llList2String(bankLines, k); } else { line = " "; // 10 spaces for empty lines } @@ -109,8 +109,8 @@ distributeToBank(string text, list linkNumbers) { line = line + llGetSubString(" ", 0, 9 - llStringLength(line)); } - integer linkNum = llList2Integer(linkNumbers, i); - llMessageLinked(linkNum, DISPLAY_STRING, line, ""); + integer primLink = llList2Integer(linkNumbers, k); + llMessageLinked(primLink, DISPLAY_STRING, line, ""); } } diff --git a/Player_DialogHandler.lsl b/Player_DialogHandler.lsl index 94aaf5d..09af225 100644 --- a/Player_DialogHandler.lsl +++ b/Player_DialogHandler.lsl @@ -239,27 +239,27 @@ list kickDisplayNames = []; // What the user sees in the dialog list kickOriginalNames = []; // The actual player names showPickManageMenu(key id, list playerNames) { - list options = []; - integer i; - for (i = 0; i < llGetListLength(playerNames); i++) { - string pname = llList2String(playerNames, i); - options += ["🛠 " + pname]; + list pickOptions = []; + integer j; + for (j = 0; j < llGetListLength(playerNames); j++) { + string pname = llList2String(playerNames, j); + pickOptions += ["🛠 " + pname]; } - options += ["⬅️ Back"]; - llDialog(id, "📋 Manage Picks for: ", options, DIALOG_CHANNEL); + pickOptions += ["⬅️ Back"]; + llDialog(id, "📋 Manage Picks for: ", pickOptions, DIALOG_CHANNEL); } showPickListMenu(key id) { - list options = []; - integer i; - for (i = 0; i < llGetListLength(currentPickList); i++) { - string pick = llList2String(currentPickList, i); + list listOptions = []; + integer k; + for (k = 0; k < llGetListLength(currentPickList); k++) { + string pick = llList2String(currentPickList, k); if (llStringLength(pick) > 0) { - options += ["REMOVE: " + pick]; + listOptions += ["REMOVE: " + pick]; } } - options += ["Add Pick", "⬅️ Back"]; - llDialog(id, "🛠 Picks for: " + currentPickTarget, options, DIALOG_CHANNEL); + listOptions += ["Add Pick", "⬅️ Back"]; + llDialog(id, "🛠 Picks for: " + currentPickTarget, listOptions, DIALOG_CHANNEL); } askForNewPick(key id) { @@ -274,53 +274,53 @@ showKickPlayerMenu(key id, list playerNames) { return; } - list options = []; + list kickOptions = []; kickDisplayNames = []; // Reset mapping kickOriginalNames = []; - integer i; - for (i = 0; i < llGetListLength(playerNames); i++) { - string originalName = llList2String(playerNames, i); - string displayName = originalName; + integer m; + for (m = 0; m < llGetListLength(playerNames); m++) { + string originalName = llList2String(playerNames, m); + string kickDisplayName = originalName; // Truncate long names to fit within 24 character button limit ("👢 " = 3 chars) - if (llStringLength(displayName) > 21) { - displayName = llGetSubString(displayName, 0, 18) + "..."; + if (llStringLength(kickDisplayName) > 21) { + kickDisplayName = llGetSubString(kickDisplayName, 0, 18) + "..."; } - string buttonLabel = "👢 " + displayName; + string buttonLabel = "👢 " + kickDisplayName; // Debug: Check button length llOwnerSay("🔍 Debug kick button: '" + buttonLabel + "' = " + (string)llStringLength(buttonLabel) + " chars"); - options += [buttonLabel]; + kickOptions += [buttonLabel]; kickDisplayNames += [buttonLabel]; // Store the full button label kickOriginalNames += [originalName]; // Store the original name } - options += ["⬅️ Back"]; - llDialog(id, "👢 Select player to kick from game:", options, DIALOG_CHANNEL); + kickOptions += ["⬅️ Back"]; + llDialog(id, "👢 Select player to kick from game:", kickOptions, DIALOG_CHANNEL); } // Show menu for unregistered owner showUnregisteredOwnerMenu(key id, integer canStartGame) { - list options = []; - string menuText = "👑 Owner Options:\n\n"; + list ownerOptions = []; + string ownerMenuText = "👑 Owner Options:\n\n"; // Always allow owner to join - options += ["Join Game"]; - menuText += "🎮 Join Game - Register as a player\n"; + ownerOptions += ["Join Game"]; + ownerMenuText += "🎮 Join Game - Register as a player\n"; // Allow starting game if there are enough players (even if all bots) if (canStartGame) { - options += ["Start Game"]; - menuText += "⚡ Start Game - Begin with current players\n"; + ownerOptions += ["Start Game"]; + ownerMenuText += "⚡ Start Game - Begin with current players\n"; } // Always allow owner menu access - options += ["Owner Menu"]; - menuText += "🔧 Owner Menu - Admin functions"; + ownerOptions += ["Owner Menu"]; + ownerMenuText += "🔧 Owner Menu - Admin functions"; - llDialog(id, menuText, options, DIALOG_CHANNEL); + llDialog(id, ownerMenuText, ownerOptions, DIALOG_CHANNEL); } default {