3.3. The Script Log

The Script Log displays output from Gamma scripts, and can also be used to conduct interactive sessions, like a terminal. You can open this window in either of two ways:

The Script Log should appear on your desktop:

You can use the text entry field at the bottom to send code to Gamma. Try the following:

  1. Type: a = 5; and press Enter
    You should see the following on the screen:
    --> a = 5;
    5
    You have just created a symbol (a) and assigned it a value (5). That symbol is a variable, and is now available to Gamma until the DataHub shuts down. Notice that the Script Log inserts a prompt (-->) and shows your command to help you identify what you typed in.
  2. Press the Clear button to clear the Script Log. Press the Close button to close the Script Log window, then reopen it.
  3. Type: a; and press Enter
    You should see the following on the screen:
    --> a;
    5
    Sure enough, the value of a is still in Gamma
  4. Type: princ("Hello world.\n"); and view the results:
    --> princ("Hello world.\n");
    Hello world.
    t
    Why the t? It is the return value from the princ function, a logically true value. Every Gamma function returns a value. The string 'Hello world.' is the byproduct or result of running the function, but the actual return value is t. For more details on Gamma programming, please refer to the Gamma manual.
  5. Now, let's see a value in the DataHub. Start DataSim, then type: $DataSim:Sine; and press Enter. You should see something like this:
    --> $DataSim:Sine;
    -0.47552825816976968
    This was the value of the Sine point in the DataSim domain of the DataHub at the moment you pressed the Enter key.
    [Note]

    The colon character (:) is used to divide the domain name from the point name. The dollar sign character ($) tells Gamma that the colon is part of the variable name, not a sytactic element.

  6. You can re-enter up to the last 10 commands by pressing the down arrow on your keyboard. Try it now. Press the down arrow until you see the last command, $DataSim:Sine;, and press Enter. Try it several times. You will get different values because the DataSim program is running.

This gives you a taste of working with Gamma, but to accomplish anything really useful and to save your work, you'll need a script. The following sections will explain how to access and edit scripts, and create your own.