Skip to content

Script command reference ​

Every field, screen and result here was checked on the v1.3.3 (Windows) Release build.

This reference covers every script command, one page each. Each page covers, in order: what the command is for, its screen, the JSON form with a field table, how its result is decided, a sample you can download, and things to watch out for.

If you are new to the basics of scripts (cases, rounds, PASS/FAIL, variables), read the Script tutorial and Script concepts first.

How to use the examples ​

  1. Each example is a complete script file. Download it (.json) from the box at the end of its page.
  2. Open one Roach Modbus Tool window, switch to Slave mode and click Listen (default 127.0.0.1:502, Slave ID 1). The examples write whatever data they need, so there is nothing to set up in the registers.
  3. Open a second window, switch to Script, click Open JSON to open the example, and click Run.
  4. Case names and messages in the examples are in English, and that is the text you see on screen.

Each example uses its own address block (for example, Read starts at 0x0100 and While uses 0x0500), so they do not interfere with each other and can run one after another against the same Slave.

Contents ​

GroupCommands
Read and writeWrite · Read · Wait Until
FlowIf / Else / End If · Repeat · While · End Case · End Round · Verdict
SubroutinesSubroutine · Call · Return
VariablesSet
Timing and interactionWait · Log · Pause · Ask
OtherCommon fields · Unsupported syntax · Script file top-level fields

Conventions ​

  • Each step is a JSON object keyed by the command name, for example {"write": {...}} or {"log": "..."}.
  • Addresses and values can be decimal (256) or a hex string ("0x0100").
  • Fields marked "expression allowed" accept expressions such as "0x0400 + ${i}". The rules are in Concepts › 7. Expressions.
  • Variable names start with a letter or _, followed by letters, digits or _, up to 31 characters. now is a built-in variable and cannot be set.

Next steps ​

Roach Modbus Tool by Mr.Roach