Names identify things. Many programming languages therefore call them identifiers. A name can contain letters, digits, and the special characters "." (dot), "$" (dollar), and "_" (underscore); it may not start with a digit or dot, and may not end with a dot, though. PCC predefines many names you can use in various ways. Those are called properties (properties of objects, such as the name of a ship) and functions. You can also define your own names: variables and subroutines.

The meaning of a name depends on the current context. For example, the word Mission can stand for the mission of a ship or for the mission of a starbase, which are governed by completely different rules. However, names have been chosen in such a way that similar things are represented by similar names. For example, you can use Name="Ares" to search for ships and planets having that name, and Owner$=7 searches for everything owned by player 7.

The current context is determined by the place you're invoking a script from. For example, a planet label expression is always evaluated in the context of the planet. A search expression is evaluated in all possible contexts, as defined by your selection in the search dialog.

Contexts stack. You can temporarily open another context to look at another object's properties. For example, using the Find function to find a ship, as in Find(Ship, Name="Ares", Id), will evaluate the test and return expressions (second and third parameter) in ship context. Likewise, the With command will execute commands in a specified context.

Contexts are not only established by objects. The "outermost" context always contains all global variables. Each executing function, subroutine or script will establish a context for its local variables. Every name is looked up in the innermost context first. If it is not found there, the outer contexts are considered until one provides a definition.

There are important exceptions to these rules. For example, in Sin(30), Sin always means the sine function, no matter what context is active. Those exceptions are:

Those always mean the same thing, regardless of the current context, and cannot be redefined.

Namespaces

In PCC2, all functions, subroutines, structures, and variables share a single namespace. That is, if you have a global variable A, you cannot have a function named A at the same time. (You can, however, have a local variable A, and that will "shadow" the global one due to the context stack.)

In contrast, in PCC 1.x, subroutines and variables had separate namespaces, so you could have a subroutines named the same as a variable. However, this is confusing and hard to use, so it should be avoided.

In both versions, the following have namespaces separate from variables and subroutines:

That is, defining a keymap ShipScreen will not interfere with a command, variable or hook named ShipScreen.