Page 1 of 1

Trigger exvars as tables

Posted: Mon May 12, 2008 5:18 pm
by Parallax
I was reading the documentation on the wiki for RTC users and I have a question about this:
A message chain (dsb_msg_chain) can also be used to emulate some of the simpler behavior of RTC's "WALLITEM_RELAY," but a more thorough implementation of this is given by the "x_relay" arch. For details, see base/objects.lua. For really complex relays, you're best off just converting their functionality to Lua code.

However, one of the most common applications of relays, increasing the number of targets and/or changing the message type, is not even needed in DSB: while RTC has a maximum of eight targets per trigger and they must all be sent the same message, DSB allows an effectively unlimited number, and in addition, each target can have a different message. For example:

exvar[trigger_id] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }
The question is: can I use a table for the delay exvar as well, so the various messages are fired each with their own, taylored delay? For instance:
exvar[trigger_id] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE}, delay = {10, 3, 0} }

Posted: Mon May 12, 2008 6:55 pm
by Sophia
Yes you can.