Linked commands work in the same way than acknowledge commands. In this example we use the WaitFor command to demonstrate the capabilities of linked commands. The WaitFor command wait for a given time code and proceed with the next command in the task if the time code is reached. The SOLOIST player in this example send the current time code as response if the TIMECODE command was sent. So we start implementing the WaitFor command as shown below.
As you can see we have a parameter Timecode, but we don't use it in the script. The script uses DP1 only, because the SOLOIST doesn't know that we wait for a position.
ScriptResult = DP1 + “ TIMECODE” + Chr(13) effectuates that the SOLOIST send the current time code position as response. The next step is to implement an acknowledge command that reads the response and check if the desired position is reached.
The script is quite complex, because the time code format of the SOLOIST is a little confusing.
01 Dim TC,HH,MM,SS,FF,tmp As String 02 03 tmp = NthField(IOResult,Chr(13),2) 04 HH = NthField(tmp,":",1) 05 MM = NthField(tmp,":",2) 06 SS = NthField(tmp,":",3) 07 FF = NthField(tmp,".",2) 08 HH = Mid(HH,3) 09 SS = Left(SS,2) 10 If Len(HH) < 2 Then HH = "0" + HH 11 FF = Left(ff,2) 12 TC = HH+"-"+MM+"-"+SS+"-"+FF 13 14 If TC < P1 Then 15 NextCmd = "WaitFor" 16 ScriptResult = "CountdownTC;" + P1 + ";"+TC 17 Else 18 NextCmd = "" 19 ScriptResult = TC 20 End 21 22 ACK = True
If the SOLOIST receives the TIMECODE command, the result string is “OK”+chr(13)+chr(10)+ “ ” + H:MM:SS.FF+chr(13)+chr(10). In V-Control the Time code format is HH-MM-SS-FF, so the lines 1 - 12 convert the SOLOIST response to a valid time code format.
Line 14 checks if the desired time code is reached. As you can see, P1 is used as reference value, but P1 is not defined in ACK_WaitFor, only in WaitFor. But that is not a mistake, because V-Control forward the content of all parameters to an acknowledge command. Again, if ACK_WaitFor is and acknowledge command from WaitFor, then all parameters valid in WaitFor forwarded to ACK_WaitFor.
If the current time code position is lower than the time code we are waiting for, then the script continues in line 15. There, the variable NextCmd (Next command) is set to “WaitFor”. This causes the call of WaitFor again, with the same parameters as used the last time. Line 16 initiates a count down for the acknowledge list.
If the desired position is reached, the script proceeds in line 18. In this case we don't have to call the WaitFor command again, so the variable NextCmd is set to “”.
Line 22 tells V-Control that we have a valid acknowledge. This is important because otherwise V-Control will proceed with the next command in the current task without waiting for the time code.
The last step is to tell the WaitFor command to use the ACK_WaitFor command as acknowledge command.
Don't forget Update Cmd and Compile