Covers Desktop Interface 2.0.0 · Webserver Interface 2.0.0
DCode Editor
Edit scripts, understand saved versus active code, and find runtime errors.
DCode is DARTWIC’s automation language for calculations, device control, event conditions, and procedures. Open Scripts in the left sidebar to work with it. This guide covers opening or creating a script, the editor’s language tools, choosing what to build, and activating changes in the Engine.
Open or Create a Script
Open Scripts and select an existing file, or right-click its resource list and choose Create Resource to name a new script. The file opens in an editor tab.
Add your code or start with an example from the DCode guides below. Create any channels or other inputs required by the example first. Check the file’s save/synchronization status while editing; saving and activating are separate steps.
Editor
The editor provides language help while you write, so you can check syntax, look up arguments, and follow references without leaving your script.
Syntax Checking
Error and warning markers identify problems in the script. Hover a marker to read its message and locate the affected code. Correct reported problems before activation; activation results and runtime events may reveal additional issues.
For example, spelling the keyword transition incorrectly.
Autocomplete
As you type, suggestions help complete keywords, runtime blocks, fields, functions, variables, and channel references where supported. Function calls also show argument hints, including the parameter you are currently entering. Available plugin functions depend on the installed plugins.
For example, writing channel names using pipes || will pull up a list of the current matched channels the engine has in memory.
Hover Help and Docstrings
Hover a supported function, keyword, or field to read its documentation: what it does, its signature and arguments, and examples where provided. These inline descriptions and docstrings help you use a feature without memorizing its syntax. The DCode reference provides the full catalog.
Hovering most keywords or blocks will show its documentation.
Hover a channel reference such as |tank_pressure| to inspect its live value and related information while editing.
Ctrl-Click Navigation
Hold Ctrl and click a supported reference to follow it. Variables and functions can lead to their definitions; imports and YAML parameter paths open related files. Channel references open Channels, task references open their task view, and native plugin references open the plugin’s settings where available.
Control Clicking the import shown will open its YAML file.
Gutter Icons
The gutter is the strip beside the line numbers. Icons mark runtime declarations such as tasks, loops, calculations, and events. Hover an icon for its name and current status, or click it to open the corresponding runtime view.
Colors help you spot activity: green generally means active or registered, grey means inactive, and yellow can indicate a held task or work needing activation. Calculations can show red for an error. Read the tooltip for the exact state.
Templates also have gutter controls to expand or collapse their generated code. In a YAML parameter file, gutter links open the scripts that use those entries.
Line Followers
For some runtime blocks, a line follower will show the current section of the block that is executing.
DCode Features
Start with the DCode overview and Common Syntax and Functions for the language basics. Use Values and Scope for variables and shared state, then choose a guide for the job you want to do.
One file can define several pieces of Engine-managed work, called runtime blocks.
| You want to… | Create… | Main guide |
|---|---|---|
| Repeat control logic, move between stages, or run an ordered procedure | A periodic, state-machine, or sequence task. | DCode Tasks |
| Schedule actions during a countdown | A timeline with actions before and after T0. | Timelines |
| Repeat a small background operation | A loop that starts on activation. | Loops |
| Scale a measurement or derive a value | A channel calculation. | Channel Calculations |
| Report a condition needing attention | An event, such as a pressure warning. | DCode Events |
| Expose a reusable procedure to another caller | A callback. | Callbacks |
| Coordinate several tasks | A task group. | Task Groups |
| Generate similar work from a configuration list | A template driven by YAML parameters. | Templates and Configuration |
The linked guides provide syntax and working examples. Choose an example, add it to your project, and activate it when ready.
Activation and Replacement
The Engine can keep running the last activated version while you edit. Saving stores the file; activation asks the Engine to use it. Choose Run script or press Ctrl+R to save and activate, then wait for the result.
The toolbar’s execution mode selects DCode · Lua or native C++ execution. Start with Lua for the language examples; native execution requires Builder setup.
Check the loaded-code indicator and gutter icons after activation. A newly defined task may still need Start in Tasks; loops start on activation.
Running again replaces the file’s runtime definitions, including unchanged ones, and creates fresh runtime state. Tasks that were running can restart; they do not continue from their previous procedure position. Closing the editor does not stop the installed work. See Activation and Replacement for each block’s lifecycle and what remains afterward.
Template Activation
A template can generate similar work for several devices using a YAML configuration file. Edit its parameters alongside the script. The YAML editor’s Run saves the YAML and activates its dependent scripts, replacing their generated work too.
Follow Templates and Configuration for parameter files and generated declarations.
Script and Activation Errors
Read the activation result before assuming the edited version is running. Follow reported file/line links and check the node’s events and logs for execution failures. For native compilation errors, open Project → Builder logs and inspect DARTWIC BUILDER output.
Correct the problem, reactivate, and check the affected task and channels. See Activation Errors and Limits for failure behavior, or export logs when sharing a diagnosis.