Difference between revisions of "DSB/DSB for RTC users"

From DmWiki
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
 
It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.
 
It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.
  
If you want to rapidly enable and disable something, the best way is to continue using the RTC idiom of sending it two toggle messages. In RTC, this was necessary to avoid using a relay; in DSB, this is not the case (see WALLITEM_RELAY below) but sending an activate and a deactivate that arrive in the same tick may arrive in the wrong order, leading to undesired results.
+
As of DSB 0.45 or so, the DSB message queue has been changed so that messages arriving from the same originator will arrive in order. This means that to rapidly enable and then disable something, you can continue using the RTC idiom of sending it two Toggle messages (necessary in RTC to avoid using a relay) but you can also send it an Activate and then a Deactivate and it will work properly.
 +
 
 +
To summarize:
 +
* <b>Multiple messages from the same originator to the same target</b> - Will arrive in the order sent
 +
* <b>Multiple messages from the same originator to different targets</b> - Will arrive in the order sent
 +
* <b>Multiple messages from different originators to the same target</b> - No guarantees are made as to order
  
 
==Alcoves==
 
==Alcoves==
Line 17: Line 22:
  
 
<code>
 
<code>
exvar~[[trigger_id]] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }
+
exvar[trigger_id] = { target = {id1, id2, id3}, msg = {M_ACTIVATE, M_TOGGLE, M_DEACTIVATE} }
 
</code>
 
</code>
  

Latest revision as of 18:41, 16 April 2011

Here are some tips and tricks for using DSB if you're used to using RTC.

Floor Triggers

Unlike in RTC, DSB floor triggers need not be on the CENTER of the tile. By placing them on one of the other directions, you can respond only to objects that are in that position.

It may also be important to note that unlike in RTC (I think?), no guarantee is made as to the order that multiple triggers on one tile will execute. If you need to do a complex set of tasks in a specific order, write some custom Lua code. You can also use one trigger linked to multiple targets, but you should also be aware that there is no guarantee of the order that two messages arriving in the same tick will be processed.

As of DSB 0.45 or so, the DSB message queue has been changed so that messages arriving from the same originator will arrive in order. This means that to rapidly enable and then disable something, you can continue using the RTC idiom of sending it two Toggle messages (necessary in RTC to avoid using a relay) but you can also send it an Activate and then a Deactivate and it will work properly.

To summarize:

  • Multiple messages from the same originator to the same target - Will arrive in the order sent
  • Multiple messages from the same originator to different targets - Will arrive in the order sent
  • Multiple messages from different originators to the same target - No guarantees are made as to order

Alcoves

DSB alcoves are, in general, much simpler than RTC alcoves. To do complicated things in response to objects put into an alcove, put a floor trigger on the same square as the alcove and use that instead. In particular, DSB alcoves have no concept of constant weight; you will need to use a floor trigger. A CENTER'd floor trigger will respond to anything put in any alcove on that tile. To respond only to a single alcove on a tile with multiple alcoves, put the trigger on the same direction as the alcove. (That is, to respond only to the alcove on the NORTH side of the tile, put the floor trigger in the NORTH tile position, not in the CENTER)

WALLITEM_RELAY

The "x_relay" arch is designed to be an accurate emulation of RTC's WALLITEM_RELAY, but for new dungeons, DSB's own native "msg_sender" arch includes more functionality, including the ability to specify a repeat rate. 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} }

This will cause trigger_id to send M_ACTIVATE to id1, M_TOGGLE to id2, and M_DEACTIVATE to id3.

ESB's target editor takes care of all of this automatically.

Door Buttons

DSB door buttons are treated the same as any other button. Unlike RTC door buttons, they must be explicitly given a message and a target if you create them by hand. ESB will take care of automatically linking door buttons with their doors. Of course, the upside to this slightly greater complexity is that door buttons in DSB can do anything that any other button can do, not just open a door on the same tile.

Wallsets

RTC wallsets should work, unmodified, in DSB as "ext wallsets," using dsb_make_wallset_ext.

PNG and Alpha Channels

DSB supports PNG images now, so they also should work unmodified.