Logic Machine Forum
Creating event scripts - 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: Creating event scripts (/showthread.php?tid=332)



Creating event scripts - rocfusion - 25.06.2016

Hi,

It would be nice when we create an event based script,  that there is the checkbox "Execute on group read:", so that we can enable this straightaway.  This would save time and prevent mistakes.


Thanks,

Roger


RE: Creating event scripts - mlaudren - 28.06.2016

Hi,

Don't know I you seen it but
in the Last FW, hL1.5 / sL1.2, you have the 'run script' function inside the editor that allow you to execute the script with a specific value.

I'm not sure it's exactly what you want, but it should do the trick.


RE: Creating event scripts - admin - 28.06.2016

Enabling exec on read by default will lead to more errors as most users won't bother with checking event.type in their scripts.


RE: Creating event scripts - rocfusion - 28.06.2016

Hi,

I know that.  That's why I am saying add the "option" to enable it, see screenshot.  By default it would be unchecked.

   

This will simply save a lot of time on those event based script that are only used for providing feedback on the bus.

thanks,


Roger


RE: Creating event scripts - Erwin van der Zwart - 28.06.2016

Hi Roger

Why do you need it? 

I have seen a huge amount of HL/SL projects and the only time i have seen it used is for 3th party app where you need the objects respond like a object server.

I agree with admin as it would bring a lot more support for a almost never used feature.

BR,

Erwin


RE: Creating event scripts - rocfusion - 28.06.2016

Hi Erwin,

Yes I need to make the objects respond like an object server. Then simply make this option available to be enabled in the lm settings screen. so by default it won't be available, but for the installers that do need it, then it can be enabled. Then everyone is happy.


Thanks,

Roger


RE: Creating event scripts - Erwin van der Zwart - 28.06.2016

Hi Roger,

Make one event based script and put it to the TAG for example "Read Request" and turn on the execute read checkbox just once for this single script (;

Add this script in it:

Code:
-- only reply to group read requests
if event.type == 'groupread' then
 obj = grp.find(event.dst)
    -- object found and has datatype set
 if obj and obj.decoded then
   grp.response(event.dst, obj.value, obj.datatype)
 end
end

With mass edit you can add the TAG ''Read Request" to all your object and you are done. 

BR,

Erwin van der Zwart