Skip to reading
PCA Script Programming

4. Quotes, escapes and record names

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

Single and double quotes make text values. Choose the outer quote that leaves the sentence easiest to read. Backticks have a different job: they quote a record name or ID that would otherwise contain spaces, punctuation or a reserved word.

Code example
function run()
    let line1 = "It's locked."
    let line2 = 'The label says "Clockmaker".'
    let line3 = "He said \"come in\"."
    let lines = "First line\nSecond line"
    let tabbed = "Name\tScore"
    let slash = "one\\two"
    return line1
end
Source table from 4. Quotes, escapes and record names, page 11
Escape in sourceStored character
\nNew line
\rCarriage return
\tTab
\\Backslash
\"Double quote
\'Single quote

A string cannot continue through a literal newline in the source. Use inside it. For a regular expression, the language consumes one level of backslashes: a regex digit group is written "\d+" in PCA source.

Code example
function run()
    let door = objects.`Archive Door`
    return door.name
end

These three are different: "archive_door" is text containing an ID; objects.archive_door is a record reference; a backtick-quoted identifier lets the parser recognize a name. A backtick does not display a speech line.

Page 11 of 357Permalink
Go to page