feat: Add link-aware script placement to Traditional_Updater
- Map each script to its correct link number - installScriptToLink() handles single and multi-link installations - Special handling for xyzzy_Master_script (links 35-82, 48 copies) - Uses start_param in llRemoteLoadScriptPin to target specific links - Inventory check shows script → link mapping - Progress tracking for complex multi-link installations
This commit is contained in:
parent
e90be2ca57
commit
b7171ddb81
1 changed files with 77 additions and 17 deletions
|
|
@ -22,9 +22,32 @@ list scriptList = [];
|
||||||
integer currentScriptIndex = 0;
|
integer currentScriptIndex = 0;
|
||||||
string currentOperation = "";
|
string currentOperation = "";
|
||||||
|
|
||||||
// Script names that should be in this updater's inventory
|
// Script to link mapping - each script knows where it belongs
|
||||||
list REQUIRED_SCRIPTS = [
|
list SCRIPT_LINK_MAP = [
|
||||||
// Root prim scripts (Link 1)
|
// Root prim scripts (Link 1)
|
||||||
|
"Main_Controller_Linkset", "1",
|
||||||
|
"Game_Manager", "1",
|
||||||
|
"Controller_Memory", "1",
|
||||||
|
"Controller_MessageHandler", "1",
|
||||||
|
"Player_RegistrationManager", "1",
|
||||||
|
"Player_DialogHandler", "1",
|
||||||
|
"NumberPicker_DialogHandler", "1",
|
||||||
|
"Floater_Manager", "1",
|
||||||
|
"Roll_ConfettiModule", "1",
|
||||||
|
"Bot_Manager", "1",
|
||||||
|
"Game_Calculator", "1",
|
||||||
|
"Verbose_Logger", "1",
|
||||||
|
"System_Debugger", "1",
|
||||||
|
"Update_Receiver", "1",
|
||||||
|
// Other link scripts
|
||||||
|
"Game_Scoreboard_Manager_Linkset", "12",
|
||||||
|
"Leaderboard_Communication_Linkset", "35",
|
||||||
|
"XyzzyText_Dice_Bridge_Linkset", "83",
|
||||||
|
"xyzzy_Master_script", "35-82" // Special case - multiple links
|
||||||
|
];
|
||||||
|
|
||||||
|
// Extract unique script names for inventory checking
|
||||||
|
list REQUIRED_SCRIPTS = [
|
||||||
"Main_Controller_Linkset",
|
"Main_Controller_Linkset",
|
||||||
"Game_Manager",
|
"Game_Manager",
|
||||||
"Controller_Memory",
|
"Controller_Memory",
|
||||||
|
|
@ -39,11 +62,10 @@ list REQUIRED_SCRIPTS = [
|
||||||
"Verbose_Logger",
|
"Verbose_Logger",
|
||||||
"System_Debugger",
|
"System_Debugger",
|
||||||
"Update_Receiver",
|
"Update_Receiver",
|
||||||
// Other link scripts
|
"Game_Scoreboard_Manager_Linkset",
|
||||||
"Game_Scoreboard_Manager_Linkset", // Link 12
|
"Leaderboard_Communication_Linkset",
|
||||||
"Leaderboard_Communication_Linkset", // Link 35
|
"XyzzyText_Dice_Bridge_Linkset",
|
||||||
"XyzzyText_Dice_Bridge_Linkset", // Link 83
|
"xyzzy_Master_script"
|
||||||
"xyzzy_Master_script" // Links 35-82 (we'll copy this multiple times)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Memory reporting
|
// Memory reporting
|
||||||
|
|
@ -55,23 +77,56 @@ reportMemoryUsage(string scriptName) {
|
||||||
llGetSubString((string)memoryPercent, 0, 4) + "% memory)");
|
llGetSubString((string)memoryPercent, 0, 4) + "% memory)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get target link number for a script
|
||||||
|
string getTargetLink(string scriptName) {
|
||||||
|
integer i;
|
||||||
|
for (i = 0; i < llGetListLength(SCRIPT_LINK_MAP); i += 2) {
|
||||||
|
if (llList2String(SCRIPT_LINK_MAP, i) == scriptName) {
|
||||||
|
return llList2String(SCRIPT_LINK_MAP, i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "1"; // Default to root prim if not found
|
||||||
|
}
|
||||||
|
|
||||||
|
// Install script to specific link using llRemoteLoadScriptPin
|
||||||
|
installScriptToLink(string scriptName, string targetLink) {
|
||||||
|
if (targetLink == "35-82") {
|
||||||
|
// Special case: install xyzzy_Master_script to multiple links
|
||||||
|
llOwnerSay("🔄 Installing " + scriptName + " to links 35-82 (48 copies)...");
|
||||||
|
integer i;
|
||||||
|
for (i = 35; i <= 82; i++) {
|
||||||
|
// Use link number as start_param to target specific link
|
||||||
|
llRemoteLoadScriptPin(targetGameKey, scriptName, updatePin, TRUE, i);
|
||||||
|
llOwnerSay("✅ Installed " + scriptName + " to link " + (string)i);
|
||||||
|
llSleep(0.1); // Brief pause between installations
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Regular installation to single link
|
||||||
|
integer linkNum = (integer)targetLink;
|
||||||
|
llOwnerSay("📝 Installing " + scriptName + " to link " + targetLink);
|
||||||
|
llRemoteLoadScriptPin(targetGameKey, scriptName, updatePin, TRUE, linkNum);
|
||||||
|
llOwnerSay("✅ Installed " + scriptName + " to link " + targetLink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check which scripts are available in inventory
|
// Check which scripts are available in inventory
|
||||||
checkInventory() {
|
checkInventory() {
|
||||||
integer totalScripts = 0;
|
integer totalScripts = 0;
|
||||||
integer availableScripts = 0;
|
integer availableScripts = 0;
|
||||||
|
|
||||||
llOwnerSay("📋 Checking updater inventory...");
|
llOwnerSay("📋 Checking updater inventory with link mapping...");
|
||||||
|
|
||||||
integer i;
|
integer i;
|
||||||
for (i = 0; i < llGetListLength(REQUIRED_SCRIPTS); i++) {
|
for (i = 0; i < llGetListLength(REQUIRED_SCRIPTS); i++) {
|
||||||
string scriptName = llList2String(REQUIRED_SCRIPTS, i);
|
string scriptName = llList2String(REQUIRED_SCRIPTS, i);
|
||||||
|
string targetLink = getTargetLink(scriptName);
|
||||||
totalScripts++;
|
totalScripts++;
|
||||||
|
|
||||||
if (llGetInventoryType(scriptName) == INVENTORY_SCRIPT) {
|
if (llGetInventoryType(scriptName) == INVENTORY_SCRIPT) {
|
||||||
availableScripts++;
|
availableScripts++;
|
||||||
llOwnerSay("✅ " + scriptName + " - Ready");
|
llOwnerSay("✅ " + scriptName + " → Link " + targetLink + " - Ready");
|
||||||
} else {
|
} else {
|
||||||
llOwnerSay("❌ " + scriptName + " - MISSING");
|
llOwnerSay("❌ " + scriptName + " → Link " + targetLink + " - MISSING");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,6 +134,7 @@ checkInventory() {
|
||||||
|
|
||||||
if (availableScripts == totalScripts) {
|
if (availableScripts == totalScripts) {
|
||||||
llOwnerSay("✅ All required scripts present - updater ready!");
|
llOwnerSay("✅ All required scripts present - updater ready!");
|
||||||
|
llOwnerSay("🔗 Scripts will be installed to their correct links automatically");
|
||||||
} else {
|
} else {
|
||||||
llOwnerSay("⚠️ Missing scripts - please add them to updater inventory");
|
llOwnerSay("⚠️ Missing scripts - please add them to updater inventory");
|
||||||
}
|
}
|
||||||
|
|
@ -119,18 +175,22 @@ installNextScript() {
|
||||||
}
|
}
|
||||||
|
|
||||||
string scriptName = llList2String(scriptList, currentScriptIndex);
|
string scriptName = llList2String(scriptList, currentScriptIndex);
|
||||||
|
string targetLink = getTargetLink(scriptName);
|
||||||
|
|
||||||
llOwnerSay("📝 Installing " + scriptName + " (" + (string)(currentScriptIndex + 1) +
|
llOwnerSay("🚀 Progress: " + (string)(currentScriptIndex + 1) + "/" + (string)llGetListLength(scriptList));
|
||||||
"/" + (string)llGetListLength(scriptList) + ")");
|
|
||||||
|
|
||||||
// Use llRemoteLoadScriptPin to copy script from our inventory to target
|
// Install script to correct link(s)
|
||||||
llRemoteLoadScriptPin(targetGameKey, scriptName, updatePin, TRUE, 0);
|
installScriptToLink(scriptName, targetLink);
|
||||||
|
|
||||||
llOwnerSay("✅ Copied " + scriptName + " to target game");
|
|
||||||
|
|
||||||
// Move to next script
|
// Move to next script
|
||||||
currentScriptIndex++;
|
currentScriptIndex++;
|
||||||
llSetTimerEvent(2.0); // Brief pause between installations
|
|
||||||
|
// Longer pause for xyzzy_Master_script (48 installations)
|
||||||
|
if (targetLink == "35-82") {
|
||||||
|
llSetTimerEvent(10.0); // Extra time for multiple installations
|
||||||
|
} else {
|
||||||
|
llSetTimerEvent(2.0); // Normal pause
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Complete the update process
|
// Complete the update process
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue