I use Docklight to simulate a serial device. Sending predefined answers using your “Receive Sequence” function works pretty well. But what if I want dynamic answers, instead of sending the same static answer all the time?

I use Docklight to simulate a serial device. Sending predefined answers using your “Receive Sequence” function works pretty well. But what if I want dynamic answers, instead of sending the same static answer all the time?

Applies to: Docklight Scripting, Article ID: dl_faq022

The OnSend / OnReceive features in Docklight Scripting can help out here. Basically there two different alternatives:

1.) Use a DL_OnReceive() procedure to decide what to do after Docklight receives a request for data from the other device.
Inside the DL_OnReceive() function, you can decide for yourself what Send Sequence should be transmitted, or if you
want to provide random data for a Send Sequence with wildcards.

2.) If you prefer to have something like a “Send” button that spits out a different sequence every time it is pushed,
have a look at the “Flexible Answers” demo script provided below. This example project and script shows how you can build a
list of individual sequences that are assigned to a “master” button. Each time the master button is pressed,
a different sequence is transmitted.

Docklight Sample Script – Flexible Answers to incoming requests using DL_OnSend()

Docklight Scripting Manual – Sub DL_OnReceive(), Evaluating Receive Sequence Data

Docklight Scripting Manual – Sub DL_OnSend(), Send Sequence Data Manipulation