Logic Machine Forum
Tags and events - 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: Tags and events (/showthread.php?tid=1790)



Tags and events - Kai-Roger - 17.12.2018

Hi.

If i tag 20 Objects with the same text, will an event script marked with that tag run 20 times?

BR
Kai-Roger


RE: Tags and events - admin - 17.12.2018

No, it will run once. Tags allow mapping one script to more than one group address. You can the use event.dst variable contents to perform actions based on current group address.


RE: Tags and events - Kai-Roger - 17.12.2018

(17.12.2018, 08:41)admin Wrote: No, it will run once. Tags allow mapping one script to more than one group address. You can the use event.dst variable contents to perform actions based on current group address.

Thanks.
What does "event.dst variable contents" mean?


RE: Tags and events - Daniel - 17.12.2018

(17.12.2018, 08:56)Kai-Roger Wrote:
(17.12.2018, 08:41)admin Wrote: No, it will run once. Tags allow mapping one script to more than one group address. You can the use event.dst variable contents to perform actions based on current group address.

Thanks.
What does "event.dst variable contents" mean?

It gives you group address which triggered the script


RE: Tags and events - Kai-Roger - 17.12.2018

(17.12.2018, 09:05)Daniel. Wrote: It gives you group address which triggered the script

Exciting. Will have a look at how i can use this. Maybe there will come some questions about this later.


RE: Tags and events - Kai-Roger - 21.02.2019

(17.12.2018, 09:05)Daniel. Wrote: It gives you group address which triggered the script

Hi.

Is it possible to get an small example of how this is achived? I'm not sure how to write "event.dst variable contents" i a script.

I want something like:

if event.dst == grp.find ('1/1/1') then .....

BR
Kai-Roger


RE: Tags and events - Erwin van der Zwart - 21.02.2019

Hi,

event.dst returns the address so the correct way to compare is:

if event.dst == '1/1/1' then
  —Your action here
end

grp.find returns all object details in a table so you can’t compare that with event.dst that is returned as a string.

BR,

Erwin


RE: Tags and events - Kai-Roger - 21.02.2019

(21.02.2019, 22:12)Erwin van der Zwart Wrote: Hi,

event.dst returns the address so the correct way to compare is:

if event.dst == '1/1/1' then
  —Your action here
end

grp.find returns all object details in a table so you can’t compare that with event.dst that is returned as a string.

BR,

Erwin

Thanks a lot  Smile   I really appreciate the fast response from you guys!


RE: Tags and events - Erwin van der Zwart - 21.02.2019

Tip: try to log your variables to see what they hold, Then you know what to do (:

log(event) -> event table including dst
log(event.dst) -> address
log(grp.find(event.dst)) -> table with object details like updatetime, name etc.

BR,

Erwin