feat: Implement commercial-style updater with script removal/replacement
- Add REMOVE_SCRIPT command to delete old scripts before update - Add RENAME_SCRIPT command for future script name management - Use 3-step process: remove old → install new → rename - Update_Receiver now handles script inventory management - Follows commercial SL updater patterns with remove-then-replace
This commit is contained in:
parent
3987b970ba
commit
79040c66f3
2 changed files with 20 additions and 4 deletions
|
|
@ -130,20 +130,26 @@ downloadNextScript() {
|
|||
currentHttpRequest = llHTTPRequest(url, [HTTP_METHOD, "GET"], "");
|
||||
}
|
||||
|
||||
// Install downloaded script using llRemoteLoadScriptPin
|
||||
// Install downloaded script - commercial updater approach
|
||||
installScript(string scriptContent, string scriptName, integer linkNumber) {
|
||||
llOwnerSay("📥 Installing " + scriptName + " (" + (string)llStringLength(scriptContent) + " chars)");
|
||||
llOwnerSay("🎯 Target: " + (string)targetGameKey + " | PIN: " + (string)updatePin);
|
||||
|
||||
// Use llRemoteLoadScriptPin to install the script
|
||||
// This creates a new script in the target object with the downloaded content
|
||||
// Step 1: Tell target to remove old script (if it exists)
|
||||
llRegionSayTo(targetGameKey, UPDATER_CHANNEL, "REMOVE_SCRIPT|" + scriptName);
|
||||
|
||||
// Step 2: Install new script content with llRemoteLoadScriptPin
|
||||
// The script will be created with an auto-generated name like "New Script"
|
||||
llRemoteLoadScriptPin(targetGameKey, scriptContent, updatePin, TRUE, 0);
|
||||
|
||||
// Step 3: Tell target to rename the new script to correct name
|
||||
llRegionSayTo(targetGameKey, UPDATER_CHANNEL, "RENAME_SCRIPT|" + scriptName);
|
||||
|
||||
llOwnerSay("✅ Sent " + scriptName + " to target game");
|
||||
|
||||
// Move to next script
|
||||
currentScriptIndex++;
|
||||
llSetTimerEvent(2.0); // Brief pause between installations
|
||||
llSetTimerEvent(3.0); // Longer pause for script processing
|
||||
}
|
||||
|
||||
// Complete the update process
|
||||
|
|
|
|||
|
|
@ -299,6 +299,16 @@ default {
|
|||
else if (command == "UPDATE_BUSY") {
|
||||
llOwnerSay("⏳ Updater is busy with another installation");
|
||||
}
|
||||
else if (command == "REMOVE_SCRIPT") {
|
||||
string scriptToRemove = llList2String(parts, 1);
|
||||
llOwnerSay("🗑️ Removing old script: " + scriptToRemove);
|
||||
llRemoveInventory(scriptToRemove);
|
||||
}
|
||||
else if (command == "RENAME_SCRIPT") {
|
||||
string targetName = llList2String(parts, 1);
|
||||
llOwnerSay("🏷️ Looking for new script to rename to: " + targetName);
|
||||
// Note: LSL doesn't have direct script renaming, this is for future enhancement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue