Script Outline

The general outline of a Pikt script is:

<script name>
        init
               <statement>
                 ...
        begin
               <statement>
                 ...
        rule
               <statement>
                 ...
        ...
        end
               <statement>
                 ...
Of the script components listed above, just about everything is optional.  For alarm scripts (appearing in .alt files and registered in alarms.cfg), what is essential is a script name (in the left-most column), followed optionally by various combinations of (indented) script sections.  Here are the possibilities:
        name
        name begin
        name end
        name begin end
        name init begin
        name init end
        name init begin end
        name init rules
        name init begin rules
        name init rules end
        name init begin rules end
For standalone scripts (appearing as .pkt files and registered in programs.cfg), the only essentials are programs statements.  See the Standalone Scripts section following for more details.

As an example of just about the most bare-bones Pikt script possible, here is the obligatory "Hello World" script:

Birth begin output "Hello, world!"
Or, if you prefer, and using a more sensible and readable layout:
Death
        end
               output "Goodbye, cruel world!"
When run from the command line, either script simply outputs the indicated text to stdout.

Note that both scripts comply with the requirement that the script name appear in the left-most column, with the subsequent script material either following on the same line or in subsequent indented lines.  Pikt is not in general sensitive to script layout.

Script components will be described in greater detail below.  Viewing sample scripts will also give you a better feel for what is and is not acceptable.  (Look, too, at the test validation scripts for some occasionally far-fetched examples.)

prev page 1st page next page
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
Learn about
Pikt script
numerical
functions