Logic Machine Forum
Resident script halt - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Resident script halt (/showthread.php?tid=5778)



Resident script halt - Kapudan - 06.12.2024

Hi all,

I'm using some event-based scripts to enable/disable the relevant scripts (to switch from a resident script to another).
For example resident script #1 performs a cyclic rotation of red and green lights every 5 secs while resident script #2 performs a cyclic rotation of red and blue lights every 15 secs.

All works fine but... the problem is that when by means of the event-based script I disable a resident script it doesn't stop immidiately ("halt") but instead it ends its cycle beforeĀ 
the other resident script starts.


This is one of the the event-based scripts, where r_script* is a resident script:

value = grp.getvalue('7/1/1')
if (value == true) then
script.disable('r_scritp1')
script.enable('r_script2')
end


Is there a better way to do this? Is there a command to immediately stop e running resident script?
Thanks


RE: Resident script halt - admin - 09.12.2024

You have a typo in script name: it should be r_script1 instead of r_scritp1.

You can forcefully kill a resident script this way:
Code:
item = script.get('r_script1')
script.kill(item.id)
script.disable('r_script1')