Script Type Function Block

Overview

Script type function blocks (also commonly called function block scripts) allow you to create custom programs in Vehicle Spy. The script is a list of steps for Vehicle Spy to perform; you can think of it as being like a recipe, listing what you want to happen, in a specific sequence, with specific "ingredients" (parameters).

You choose from a set of commands for each step, including commands to transmit messages, wait for events such as the receipt of messages, change internal variables, and control the operation of the script itself.

To help with more complex scripts, Vehicle Spy provides debugging features to help you find and eliminate problems.

Applications

Potential uses for script function blocks include simulation, diagnostics and automated testing.

Creating a Function Block Script

Renaming a Function Block Script

Script Tab

Script Grid

Each new script begins with ten steps, one of which contains a default prompt comment, with the others blank. You can make larger scripts by adding new script steps using the toolbar. There is no predefined limit to the size of a script.

Blank steps are skipped with no effect, but you can remove them for clarity if you wish. The toolbar will also let you rearrange steps in the grid if necessary.

Script Grid Columns

  • Step: The step number for the command. Steps are always shown in numerical order.

  • Description: The description of the command, which is actually a code word for the command itself. Double-click in this column for a particular step to choose from the available script commands.

  • Value: Parameters for the selected command. Double-clicking here allows the selection of parameters for the command, which will be shown in the field after they are chosen. The entry in the Value column depends on the command, and may be blank if no parameters are required.

  • Comment: Documentation of the step's function or purpose. This is only for reference and does not impact script operation.

You can drag the dividers between the columns to change their size.

Note that there is also an additional column to the left of Step that is used for monitoring and debugging scripts.

Script Operation and Example

When Vehicle Spy goes online, it will begin running the script based on the Start Type selected for it. Normally each step will be executed in sequence, but certain commands (such as the If / Else / Else If / End If complex, or Jump To) can alter the flow of the script, possibly based on message or signal values.

Scripts loop automatically by default; when the last step is executed, the script will begin running again. If this behavior is not desired, a script can be terminated using the Stop command.

If you have defined multiple function block scripts, each runs independently of the other, with the status of each script shown in the Function Block List.

As an example, Figure 2 shows a script that waits for a certain signal value, transmits a message, clears stats, and then repeats.

Last updated