Icon representing a recipe

Recipe: Bravo GUI Interrupt using Notes

created by bravosk8erboy

Profile


Name
Bravo GUI Interrupt using Notes
ID
109148
Shared with
Public
Parent
None
Children
Created on
August 25, 2025 at 15:04 PM UTC
Updated on
August 27, 2025 at 19:06 PM UTC
Description

Best for


Code


-- Proof of concept for interrupting a Recipe to acess the GUI again. ----------------- How to Use ------------------------ -- Recipe will save and delete all existing notes, and restore them at clean up / end of recipe. -- while the recipe is running you can use tab to pull up the segment info and add a note to call up a GUI Interrupt. -- note: Interrupt trigger might take time depending on where and how often in the recipe you call it. function main() print(" Start Main") print(" While recipe is running use tab to add a note to any segment to call GUI again") initialize() call_GUI() while true do --infinite loop just to prove the point if GUI_Interrupt_Check() then if call_GUI() then -- graceful exit main with GUI cancel button to end recipe return end end behavior.SetClashImportance(CI) structure.WiggleAll(25, true, true) structure.ShakeSidechainsAll(1) end end function call_GUI() local ask = dialog.CreateDialog("Proof of Concept") ask.l = dialog.AddLabel(" Select Clashing Importance") ask.CI = dialog.AddSlider(" CI: ",CI,0,1,2) ask.ok = dialog.AddButton ( "OK" , 1 ) ask.cancel = dialog.AddButton ( "Cancel" , 0 ) if ( dialog.Show ( ask ) > 0 ) then CI = ask.CI.value return false else -- graceful recipe end using cancel button print(" GUI Cancel") return true -- to exit main end end function initialize() print(" initialize") segmentCount = structure.GetCount() CI = 1.00 save_all_notes() end function save_all_notes() print(" save_all_notes") segment_notes = {} for i = 1, segmentCount do segment_notes[i] = structure.GetNote(i) structure.SetNote(i, "") end end function restore_all_notes() print(" restore_all_notes") for i = 1, segmentCount do structure.SetNote(i, segment_notes[i]) end end function GUI_Interrupt_Check() print(" GUI_Interrupt_Check") for i = 1, segmentCount do -- checks all notes for any text. if structure.GetNote(i) ~= "" then print(" GUI_Interrupt segment: " .. i ) -- reset note so Interrupt isn't repeated structure.SetNote(i, "") return true end end return false end function clean_up() print(" clean_up") restore_all_notes() end -- Error handler function function error_handler(err) print(" Error: " .. err) clean_up() return end xpcall(main, error_handler) clean_up()

Comments


bravosk8erboy Lv 1

might be possible to use user created bands or remove all bands as an alternative method of detection mid run instead of notes.