[extension_name] MickFX Slice [extension_info] Slice effect for MickFX. Slices webcam in half with sword animation. [extension_version] 1.0.0 [insert_external]
Starting MickFX Slice in 5...
`; statusDiv.parentNode.insertBefore(completeContainer, statusDiv.nextSibling); // Start 5 second timer with countdown let timeLeft = 5; const countdownElement = document.getElementById('MickFX-Slice-Countdown'); const timer = setInterval(() => { timeLeft--; if (timeLeft > 0) { countdownElement.textContent = `Starting MickFX Slice in ${timeLeft}...`; } else { clearInterval(timer); MickFXSliceCompleteInstall(); } }, 1000); // Store timer ID so it can be cancelled if button is clicked statusDiv.dataset.completeTimer = timer; return; } } catch (error) { console.error('[MickFX Slice] Error processing download stage:', error); } }); } function MickFXSliceIniCheck() { const settingsPath = MickFX_MainDirectory + "/Information/fxsettings.ini"; Promise.all([ SAMMI.loadIni(settingsPath, "Slice", "Timer", "number"), SAMMI.loadIni(settingsPath, "Slice", "Frame Choice", "number"), SAMMI.loadIni(settingsPath, "Slice", "ToT", "number") ]) .then(([timer, frameChoice, toggleType]) => { document.getElementById('MickFX-Slice-Timer').value = parseInt(timer.Value); // Update Frame Choice and its display const frameChoiceSelect = document.getElementById('MickFX-Slice-FrameChoice'); // Changed frameChoiceSelect.value = String(parseInt(frameChoice.Value) || 0); // More explicit conversion // Update the dropdown display text const frameChoiceGroup = frameChoiceSelect.closest('.MickFX-FXSection-Group'); // Changed const frameChoiceSelected = frameChoiceGroup.querySelector('.MickFX-OptionSelected span'); // Changed // Set the correct text based on VTuberMode const baseText = MickFX_VTuberMode === 1 ? 'VTuber' : 'Camera'; frameChoiceSelected.textContent = parseInt(frameChoice.Value) === 1 ? 'Include Frame' : `Only ${baseText}`; // Update effect type and its display const toggleTypeSelect = document.getElementById('MickFX-Slice-EffectType'); toggleTypeSelect.value = toggleType.Value || "0"; const toggleTypeGroup = toggleTypeSelect.closest('.MickFX-FXSection-Group'); // Better name const selectedText = toggleTypeGroup.querySelector('.MickFX-OptionSelected span'); selectedText.textContent = toggleType.Value === 1 ? "Manual Toggle" : "Timed Toggle"; // Handle timer visibility const timerGroup = document.getElementById('MickFX-Slice-Timer-Group'); timerGroup.style.display = toggleType.Value === 1 ? 'none' : 'block'; }) .catch(error => { console.error('[MickFX Slice] Settings Load Error:', error); }); } function MickFXSliceInstallClicked() { MickFX_SliceInstalling = true; let statusDiv = document.getElementById('MickFX-Slice-Popup'); const installButton = document.getElementById('MickFX-Slice-InstallButton'); // Create or reset status elements if (!statusDiv) { statusDiv = document.createElement('div'); statusDiv.id = 'MickFX-Slice-Popup'; statusDiv.className = 'MickFX-Popup-ContainerFX'; statusDiv.innerHTML = ` Please wait. Setting up MickFX Slice `; installButton.parentNode.insertBefore(statusDiv, installButton); } else { // Reset existing status div statusDiv.innerHTML = ` Please wait. Setting up MickFX Slice `; } // Show status message and hide install button statusDiv.style.display = 'block'; installButton.style.display = 'none'; SAMMI.triggerButton('MickFXSliceInstall') .catch(error => console.error('[MickFX Slice] Install error:', error)); } function MickFXSliceCompleteInstall() { MickFX_SliceInstalling = false; MickFX_SliceInstalled = 1; // Clear any existing timer const timer = document.getElementById('MickFX-Slice-Popup')?.dataset.completeTimer; if (timer) clearInterval(Number(timer)); // Remove the complete container (which includes button and countdown) const completeContainer = document.getElementById('MickFX-Slice-CompleteContainer'); if (completeContainer) completeContainer.remove(); // Let BaseCheck handle the rest of the UI state MickFXSliceInit(); } function MickFXSliceSaveSettings() { const settingsPath = MickFX_MainDirectory + "/Information/fxsettings.ini"; const toggleType = document.getElementById('MickFX-Slice-EffectType').value; const timer = Math.max(0, parseInt(document.getElementById('MickFX-Slice-Timer').value) || 0); const frameChoice = document.getElementById('MickFX-Slice-FrameChoice').value; Promise.all([ SAMMI.saveIni(settingsPath, "Slice", "ToT", toggleType, "number"), SAMMI.saveIni(settingsPath, "Slice", "Timer", timer, "number"), SAMMI.saveIni(settingsPath, "Slice", "Frame Choice", frameChoice, "number") ]).then(() => { MickFXHandleButton('MickFX-Slice-FXSaveButton', 'success'); }).catch(error => { console.error('[MickFX Slice] Error saving settings:', error); MickFXHandleButton('MickFX-Slice-FXSaveButton', 'error'); }); } function MickFXSliceUninstall() { const button = document.getElementById('MickFX-Slice-UninstallFXButton'); if (!button) return; if (!button.hasAttribute('data-warning-state')) { button.setAttribute('data-warning-state', 'true'); MickFXHandleButton('MickFX-Slice-UninstallFXButton', 'warning', { originalText: 'Uninstall Effect' }); } else { MickFXHandleButton('MickFX-Slice-UninstallFXButton', 'uninstalling', { duration: 0 // No auto-reset }); SAMMI.triggerButton('MickFXSliceUninstall') .catch(error => { console.error('[MickFX Slice] Error triggering uninstall:', error); MickFXHandleButton('MickFX-Slice-UninstallFXButton', 'error', { originalText: 'Uninstall Effect' }); }); } } function MickFXSliceCRCheck() { const channelPointsPath = MickFX_MainDirectory + "/Information/channelpoints.ini"; MickFXCRCallback = null; SAMMI.loadIni(channelPointsPath, "Slice", "Point ID", "string") .then((pointID) => { const createDiv = document.getElementById('MickFX-Slice-CPoints-Create'); const settingsDiv = document.getElementById('MickFX-Slice-CPoints-Settings'); if (!pointID.Value) { createDiv.style.display = 'block'; settingsDiv.style.display = 'none'; } else { createDiv.style.display = 'none'; settingsDiv.style.display = 'block'; // Load and set CP settings Promise.all([ SAMMI.loadIni(channelPointsPath, "Slice", "Cost", "number"), SAMMI.loadIni(channelPointsPath, "Slice", "Timer", "number"), SAMMI.loadIni(channelPointsPath, "Slice", "Name", "string"), SAMMI.loadIni(channelPointsPath, "Slice", "Description", "string") ]).then(([cost, timer, name, description]) => { const nameInput = document.getElementById('MickFX-Slice-CPoints-Name'); nameInput.value = name.Value || ''; nameInput.dataset.originalName = name.Value || ''; // Store original name in the element document.getElementById('MickFX-Slice-CPoints-Cost').value = parseInt(cost.Value); document.getElementById('MickFX-Slice-CPoints-Timer').value = parseInt(timer.Value); document.getElementById('MickFX-Slice-CPoints-Description').value = description.Value || ''; }); } const cpContainer = document.getElementById('MickFX-Slice-Discord-ChannelPoints-Container'); if (cpContainer) { // Check current Discord settings to see if we should show it const screenshotEnabled = document.getElementById('MickFX-Slice-Discord-Enable')?.checked; const overrideEnabled = document.getElementById('MickFX-Slice-Discord-Override')?.checked; const channelPointRewardExists = settingsDiv.style.display !== 'none'; cpContainer.style.display = (screenshotEnabled && overrideEnabled && channelPointRewardExists) ? 'flex' : 'none'; } }) .catch(error => { console.error('[MickFX Slice] Channel Points Error:', error); }); } function MickFXSliceCRCreateReward() { const buttonId = 'MickFX-Slice-CPoints-CreateButton'; MickFXHandleButton(buttonId, 'creating', { duration: 2000}); const channelPointsPath = MickFX_MainDirectory + "/Information/channelpoints.ini"; MickFXCRCallback = (exists) => { if (exists) { MickFXShowChoice( buttonId, "Reward name 'Slice!' already exists or you reached the max reward limit of 50. Delete the previous reward, or use a different name.", "Go Back", "Let Me Name The Reward", MickFXSliceCRGoBack, MickFXSliceCRShowNameInput, 15000, [30, 70] // Width distribution for buttons ); MickFXHandleButton(buttonId, 'error', { duration: 15000, text: 'Creation Failed' }); } else { SAMMI.saveIni(channelPointsPath, "Slice", "Reward Choice", 1, "number") .then(() => { SAMMI.triggerButton('MickFXSliceCRSave'); MickFXHandleButton(buttonId, 'success', { text: 'Reward Created!' }); MickFXCRCallback = null; }) .catch(error => { console.error('[MickFX Slice] Channel Points Error:', error); SAMMI.alert('Failed to create channel point reward'); MickFXHandleButton(buttonId, 'error', { text: 'Creation Failed' }); }); } }; // First save the Reward Choice, then trigger the extension SAMMI.saveIni(channelPointsPath, "Slice", "Reward Choice", 1, "number") .then(() => { SAMMI.triggerButton('MickFXSliceCRSave'); }) .catch(error => { console.error('[MickFX Slice] Error setting initial Reward Choice:', error); MickFXHandleButton(buttonId, 'error', { text: 'Creation Failed' }); }); } function MickFXSliceCRShowNameInput() { const createSection = document.getElementById('MickFX-Slice-CPoints-Create'); const createButton = document.getElementById('MickFX-Slice-CPoints-CreateButton'); // Remove any existing choice container const choiceId = `${createButton.id}-choice`; const existingChoice = document.getElementById(choiceId); if (existingChoice) { existingChoice.remove(); } // Create custom name input container const inputContainer = document.createElement('div'); inputContainer.id = 'MickFXSliceCRNameContainer'; inputContainer.innerHTML = `