Skip to reading
PCA Script Programming

3. Lines, indentation and comments

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Write one instruction on each line. A block opens with a word such as if or function and closes with

end. Indentation makes the block readable; it does not replace end. There are no C-style braces around a block and no semicolons at the ends of instructions.

Code example
language 1.0
# This comment takes up a whole line.
function run()
    let points = 5  // This comment follows an instruction.
    let address = "https://example.test/#door"
    return points
end

Both # and // begin a comment outside a quoted string. The address above keeps its slashes and hash because they are inside quotes. There is no separate multiline comment delimiter: put a comment marker on each line.

Keep a function call, array or dictionary on one physical line. The parser is line-oriented; spreading its arguments over several lines is not a supported continuation style. A long action is easier to read if you build its options dictionary a field at a time.

Code example
function run()
    let options = {}
    options["text"] = "The workshop is quiet."
    options["duration"] = 2
    show_message(options)
end

Names are case-insensitive when the language looks up variables, functions and records. Text inside quotes is preserved. Use a consistent spelling anyway: door_open is much easier to follow than three versions of the same name.

Page 10 of 357Permalink
Go to page