Fix LSL validation errors in Game_Calculator, Leaderboard_Communication_Linkset, and Player_DialogHandler

- 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)
This commit is contained in:
RebeccaNod1 2025-09-18 12:32:13 -05:00
parent 7e8de1cc01
commit 15318d8292
3 changed files with 73 additions and 73 deletions

View file

@ -54,19 +54,19 @@ integer getDiceType(integer playerCount) {
// Determine how many picks a player should make based on the peril player's lives // Determine how many picks a player should make based on the peril player's lives
integer getPicksRequiredFromName(string name) { integer getPicksRequiredFromName(string name) {
integer idx = llListFindList(names, [name]); integer nameIdx = llListFindList(names, [name]);
if (idx == -1) { if (nameIdx == -1) {
integer i; integer j;
for (i = 0; i < llGetListLength(names); i++) { for (j = 0; j < llGetListLength(names); j++) {
string testName = llList2String(names, i); string checkName = llList2String(names, j);
if (llSubStringIndex(testName, name) != -1) { if (llSubStringIndex(checkName, name) != -1) {
idx = i; nameIdx = j;
i = llGetListLength(names); j = llGetListLength(names);
} }
} }
} }
if (idx == -1) return 0; if (nameIdx == -1) return 0;
integer lifeCount = (integer)llList2String(lives, idx); 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) // Pick count = 4 - peril player's lives (3 lives=1 pick, 2 lives=2 picks, 1 life=3 picks)
return 4 - lifeCount; return 4 - lifeCount;
} }
@ -90,20 +90,20 @@ integer showPickManager(string player, key id) {
searchName = llList2String(parts, 1); searchName = llList2String(parts, 1);
} }
integer idx = llListFindList(names, [searchName]); integer searchIdx = llListFindList(names, [searchName]);
if (idx == -1) { if (searchIdx == -1) {
integer i; integer k;
for (i = 0; i < llGetListLength(names); i++) { for (k = 0; k < llGetListLength(names); k++) {
string testName = llList2String(names, i); string matchName = llList2String(names, k);
if (llSubStringIndex(testName, searchName) != -1) { if (llSubStringIndex(matchName, searchName) != -1) {
idx = i; searchIdx = k;
if (VERBOSE_LOGGING) { 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) { if (VERBOSE_LOGGING) {
llOwnerSay("⚠️ Could not find player: " + player); 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); string currentData = llList2String(picksData, searchIdx);
list parts = llParseString2List(currentData, ["|"], []); list dataParts = llParseString2List(currentData, ["|"], []);
list currentPicks = []; list currentPicks = [];
if (llGetListLength(parts) > 1) { if (llGetListLength(dataParts) > 1) {
currentPicks = llParseString2List(llList2String(parts, 1), [","], []); currentPicks = llParseString2List(llList2String(dataParts, 1), [","], []);
} }
list buttons = []; list buttons = [];
integer i; integer buttonIdx;
for (i = 1; i <= 6; i++) { for (buttonIdx = 1; buttonIdx <= 6; buttonIdx++) {
string numStr = (string)i; string numStr = (string)buttonIdx;
if (llListFindList(currentPicks, [numStr]) != -1) { if (llListFindList(currentPicks, [numStr]) != -1) {
buttons += ["❌ " + numStr]; buttons += ["❌ " + numStr];
} else if (llGetListLength(currentPicks) < maxPicks) { } else if (llGetListLength(currentPicks) < maxPicks) {

View file

@ -78,26 +78,26 @@ distributeFullText(string text) {
// Legacy function for single bank distribution // Legacy function for single bank distribution
distributeToBank(string text, list linkNumbers) { 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 is empty, create a list of empty strings to clear all prims
if (text == "") { if (text == "") {
integer numPrims = llGetListLength(linkNumbers); integer numPrims = llGetListLength(linkNumbers);
integer i; integer j;
for (i = 0; i < numPrims; i++) { for (j = 0; j < numPrims; j++) {
lines += [" "]; // 10 spaces to clear each line bankLines += [" "]; // 10 spaces to clear each line
} }
} else { } else {
lines = llParseString2List(text, ["\n"], []); bankLines = llParseString2List(text, ["\n"], []);
} }
// Send text to each prim in the bank // Send text to each prim in the bank
integer i; integer k;
for (i = 0; i < llGetListLength(linkNumbers); i++) { for (k = 0; k < llGetListLength(linkNumbers); k++) {
string line; string line;
if (i < llGetListLength(lines)) { if (k < llGetListLength(bankLines)) {
line = llList2String(lines, i); line = llList2String(bankLines, k);
} else { } else {
line = " "; // 10 spaces for empty lines line = " "; // 10 spaces for empty lines
} }
@ -109,8 +109,8 @@ distributeToBank(string text, list linkNumbers) {
line = line + llGetSubString(" ", 0, 9 - llStringLength(line)); line = line + llGetSubString(" ", 0, 9 - llStringLength(line));
} }
integer linkNum = llList2Integer(linkNumbers, i); integer primLink = llList2Integer(linkNumbers, k);
llMessageLinked(linkNum, DISPLAY_STRING, line, ""); llMessageLinked(primLink, DISPLAY_STRING, line, "");
} }
} }

View file

@ -239,27 +239,27 @@ list kickDisplayNames = []; // What the user sees in the dialog
list kickOriginalNames = []; // The actual player names list kickOriginalNames = []; // The actual player names
showPickManageMenu(key id, list playerNames) { showPickManageMenu(key id, list playerNames) {
list options = []; list pickOptions = [];
integer i; integer j;
for (i = 0; i < llGetListLength(playerNames); i++) { for (j = 0; j < llGetListLength(playerNames); j++) {
string pname = llList2String(playerNames, i); string pname = llList2String(playerNames, j);
options += ["🛠 " + pname]; pickOptions += ["🛠 " + pname];
} }
options += ["⬅️ Back"]; pickOptions += ["⬅️ Back"];
llDialog(id, "📋 Manage Picks for: ", options, DIALOG_CHANNEL); llDialog(id, "📋 Manage Picks for: ", pickOptions, DIALOG_CHANNEL);
} }
showPickListMenu(key id) { showPickListMenu(key id) {
list options = []; list listOptions = [];
integer i; integer k;
for (i = 0; i < llGetListLength(currentPickList); i++) { for (k = 0; k < llGetListLength(currentPickList); k++) {
string pick = llList2String(currentPickList, i); string pick = llList2String(currentPickList, k);
if (llStringLength(pick) > 0) { if (llStringLength(pick) > 0) {
options += ["REMOVE: " + pick]; listOptions += ["REMOVE: " + pick];
} }
} }
options += ["Add Pick", "⬅️ Back"]; listOptions += ["Add Pick", "⬅️ Back"];
llDialog(id, "🛠 Picks for: " + currentPickTarget, options, DIALOG_CHANNEL); llDialog(id, "🛠 Picks for: " + currentPickTarget, listOptions, DIALOG_CHANNEL);
} }
askForNewPick(key id) { askForNewPick(key id) {
@ -274,53 +274,53 @@ showKickPlayerMenu(key id, list playerNames) {
return; return;
} }
list options = []; list kickOptions = [];
kickDisplayNames = []; // Reset mapping kickDisplayNames = []; // Reset mapping
kickOriginalNames = []; kickOriginalNames = [];
integer i; integer m;
for (i = 0; i < llGetListLength(playerNames); i++) { for (m = 0; m < llGetListLength(playerNames); m++) {
string originalName = llList2String(playerNames, i); string originalName = llList2String(playerNames, m);
string displayName = originalName; string kickDisplayName = originalName;
// Truncate long names to fit within 24 character button limit ("👢 " = 3 chars) // Truncate long names to fit within 24 character button limit ("👢 " = 3 chars)
if (llStringLength(displayName) > 21) { if (llStringLength(kickDisplayName) > 21) {
displayName = llGetSubString(displayName, 0, 18) + "..."; kickDisplayName = llGetSubString(kickDisplayName, 0, 18) + "...";
} }
string buttonLabel = "👢 " + displayName; string buttonLabel = "👢 " + kickDisplayName;
// Debug: Check button length // Debug: Check button length
llOwnerSay("🔍 Debug kick button: '" + buttonLabel + "' = " + (string)llStringLength(buttonLabel) + " chars"); llOwnerSay("🔍 Debug kick button: '" + buttonLabel + "' = " + (string)llStringLength(buttonLabel) + " chars");
options += [buttonLabel]; kickOptions += [buttonLabel];
kickDisplayNames += [buttonLabel]; // Store the full button label kickDisplayNames += [buttonLabel]; // Store the full button label
kickOriginalNames += [originalName]; // Store the original name kickOriginalNames += [originalName]; // Store the original name
} }
options += ["⬅️ Back"]; kickOptions += ["⬅️ Back"];
llDialog(id, "👢 Select player to kick from game:", options, DIALOG_CHANNEL); llDialog(id, "👢 Select player to kick from game:", kickOptions, DIALOG_CHANNEL);
} }
// Show menu for unregistered owner // Show menu for unregistered owner
showUnregisteredOwnerMenu(key id, integer canStartGame) { showUnregisteredOwnerMenu(key id, integer canStartGame) {
list options = []; list ownerOptions = [];
string menuText = "👑 Owner Options:\n\n"; string ownerMenuText = "👑 Owner Options:\n\n";
// Always allow owner to join // Always allow owner to join
options += ["Join Game"]; ownerOptions += ["Join Game"];
menuText += "🎮 Join Game - Register as a player\n"; ownerMenuText += "🎮 Join Game - Register as a player\n";
// Allow starting game if there are enough players (even if all bots) // Allow starting game if there are enough players (even if all bots)
if (canStartGame) { if (canStartGame) {
options += ["Start Game"]; ownerOptions += ["Start Game"];
menuText += "⚡ Start Game - Begin with current players\n"; ownerMenuText += "⚡ Start Game - Begin with current players\n";
} }
// Always allow owner menu access // Always allow owner menu access
options += ["Owner Menu"]; ownerOptions += ["Owner Menu"];
menuText += "🔧 Owner Menu - Admin functions"; ownerMenuText += "🔧 Owner Menu - Admin functions";
llDialog(id, menuText, options, DIALOG_CHANNEL); llDialog(id, ownerMenuText, ownerOptions, DIALOG_CHANNEL);
} }
default { default {