From 79040c66f3effb1dc00491f29fba3568af882f20 Mon Sep 17 00:00:00 2001 From: RebeccaNod1 Date: Thu, 2 Oct 2025 13:02:09 -0500 Subject: [PATCH] feat: Implement commercial-style updater with script removal/replacement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- Peril_Dice_Updater.lsl | 14 ++++++++++---- Update_Receiver.lsl | 10 ++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Peril_Dice_Updater.lsl b/Peril_Dice_Updater.lsl index efbb36c..e11c782 100644 --- a/Peril_Dice_Updater.lsl +++ b/Peril_Dice_Updater.lsl @@ -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 diff --git a/Update_Receiver.lsl b/Update_Receiver.lsl index fc9e33e..c2ef66d 100644 --- a/Update_Receiver.lsl +++ b/Update_Receiver.lsl @@ -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 + } } }