Software Overview  |  Sitemap  |  Downloads  |  Developers  |  Forums

Console: Reading History

The Console page has a screen in the middle of it, and the screen shows commands and responses. If you run a Script, add or delete a wire, or restart the system, it will show up on the Console screen.

The Console screen displays a text version of the all Script clicking and Wiring operations from the Script and Wires pages. The text version is equivalent to Script and Wires page operations, so one can either build systems from the Script and Wires pages or from the Console. Generally, it's easier to work from the Script and Wires pages.

The Console is best used as a way of understanding and possibly remembering what has been done, and for running things that are harder or impossible to run from the Script and Wires pages.

On power up of the system the Console is initially empty. If there is a startup Script for the system, the Console will still be empty. The Console displays what Scripts and wiring a user has performed. What has been done on startup is available in the startup Script.

Command Lines

In a typical Console display, every other line is a command line, and every other line (the other lines) is a status line. The Console always begins with a command and ends with a status line, as every command has a status immediately after it.

There are a number of possible commands from the Console. We won't cover them all here, as this section describes how to read what has been done by the Script and Wires screens. To learn the more details, see the Console learning and control sections.

Command for Running a Script

The most common command is the run_script command. It's common, because every time one runs a Script, a run_script command is displayed in the console. Below is a typical run_script command.

run_script("Scripts/Device/Virtual/Logic/Combinational/Inverter", id:"inverter", inputs:"1", outputs:"1S")

The command is running a Script which builds an Inverter. The double quoted text string immediately following "run_script(" is the Script name one sees in the Scripts list on the Scripts page. After the Script name, there are 3 parameters, each with a name, a colon, and a double quoted string. These are called named parameters. The 3 named parameters are the "id", "inputs", and "outputs" parameters. For each parameter, the value following the colon is the parameter value. This particular run_script command is building an Inverter with an ID of "inverter", and an "inputs" terminal called "1" and an "outputs" terminal called "1S".

Whenever one clicks on and runs a Script on the Scripts page, a similar command line will result. Note that the parameters on the command line are the same as the parameter names in the dialog box one sees when one clicks on a Script.

Wires Commands

Each time one creates or deletes a Wire on the Wires page, a wiring command appears on the Console. We'll add a wire connecting the Inverter we just created's output to its input (generally a bad idea).

wire("inverter:1", "inverter:1S")

Wires create a wire command with 2 parameters. They are 2 double quoted strings, and each string is a terminal name. Terminal names are a device's ID, followed by a colon, followed by a terminal name.

Before anything bad happens, we'll delete the wire we just created.

unwire("inverter:1", "inverter:1S")

The unwire command takes the same parameters as the wire command.

Status Lines

We can't tell if the run_script, wire, or unwire commands were successful unless we read the line following them on the console. The run_script command returned:


Without more description, one might guess that the run_script command was successful. As a contrast, here is what happens if we run run the same command again.

run_script("Scripts/Device/Virtual/Logic/Combinational/Inverter", id:"inverter", inputs:"1", outputs:"1S")
[nil,"Error running user script, , line 1: Error running user script, Scripts/Device/Virtual/Logic/Combinational/Inverter, line 9: #Error: method \"add_device\" failed.  Error: ID \"inverter\" already exists\n\n"]

Here one can see how a failing command looks. (We can't create two devices with the same "ID".)

In general, every run_script, wire, and unwire command returns two values in a pair of brackets. The first value is whether the command succeeds or fails. Success is a true value. Failure is a nil or false value. The second value of the pair is a message. If things succeed, the message is usually terse (true). If there is a failure, the message attempts to point out the problem.

Restart Command

One last thing of note is what happens when one clicks on the "Restart" button at the bottom of the Scripts page.


Clicking on the "Restart" button runs the restart command. When the command is complete, it returns a status value of true.

Catalina Computing, LLC.

Copyright © Catalina Computing, LLC. (2013-2018)

Page last updated: Thu Apr 3 02:20:48 2014 (UTC)