Posts: 232
Threads: 57
Joined: May 2018
Reputation:
3
Hi.
If i tag 20 Objects with the same text, will an event script marked with that tag run 20 times?
BR
Kai-Roger
Posts: 7764
Threads: 42
Joined: Jun 2015
Reputation:
447
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.
Posts: 4646
Threads: 24
Joined: Aug 2017
Reputation:
207
(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
------------------------------
Ctrl+F5
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
21.02.2019, 22:12
(This post was last modified: 21.02.2019, 22:13 by Erwin van der Zwart.)
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
Posts: 1764
Threads: 6
Joined: Jul 2015
Reputation:
117
21.02.2019, 23:07
(This post was last modified: 21.02.2019, 23:09 by Erwin van der Zwart.)
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