This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Tags and events
#1
Hi.

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

BR
Kai-Roger
Reply
#2
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.
Reply
#3
(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?
Reply
#4
(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
Reply
#5
(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.
Reply
#6
(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
Reply
#7
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
Reply
#8
(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!
Reply
#9
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
Reply


Forum Jump: