An object is something that has properties. PCC offers all game data in the form of objects. For example, there is an object for each ship, whose properties describe that ship's type, name, mission, and so on.
Accessing Objects
To access the built-in objects, you use the Context functions. For example,
Ship(13) Beam(Ship(13).Beam$)
You can also create your own objects using the Struct and Dim commands.
Struct Pair First, Second EndStruct Dim p As Pair % p now is an object
Accessing Object Properties
There are several ways to access object properties.
Directly: write the object name, followed by a dot, and the property name.
Print Ship(13).Name Print Beam(Ship(13).Beam$).Name
Because the dot can also be part of a name, this does not work when the object is just a name. p.First would be interpreted as a single variable, not as a property of p. Therefore, you can also use -> instead of the dot:
Print p->First Print p->Second
Using With: You can use the With statement to temporarily bring object properties into scope:
With Ship(13) Do Print Name % prints the ship's name EndWith With p Do Print First % prints p->First EndWith
Using ForEach: For context functions, you can use ForEach to iterate over all objects of that type.
ForEach Ship Do Print Name % print the names of all ships Next