Skip to reading
PCA Script Programming

5. Values and types

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
Source table from 5. Values and types, page 12
TypeExampleUse
integer5Whole counts, indices, slots
number2.5Seconds, speeds, measurements
text"Archive Key"Speech, IDs, entered text
booleantrue, falseA yes/no puzzle fact
nullnullNo value / not found
array["key", "note"]Ordered values
dictionary{"open": false}Named values
vector2vector2(10, 20)Two coordinates
vector3vector3(2, 0, -1)3D coordinates
colorcolor("#88bbff")A color value
recordcharacters.eliasA live reference to a project record
Code example
function run()
    let count: integer = 3
    let delay: number = 0.5
    let title: text = "Parts tray"
    let ready: boolean = true
    let items: array = ["key", "note"]
    return type_of(items)
end

Type annotations are optional, but useful on public functions. A typed declaration can catch the accidental text "3" where you intended the number 3. Use str(), integer(), number() and boolean() when you intend a conversion. Do not expect boolean("false") to parse an English answer: compare the entered text with "true" or "yes" yourself.

Page 12 of 357Permalink
Go to page