SCRMaps
/
Sign in

There is only one kind of value

Every epScript variable is a 32-bit unsigned integer. There is no such thing as a string variable.

6 min read

Coming from another language, this is the first thing that catches you. epScript has exactly one value type: a 32-bit unsigned integer. No floats, no separate boolean, and no string variables at all.

The reason is in an earlier lesson: a variable is the number field of a trigger action, and that field is a four byte integer. The language is not designed this way so much as there is nowhere else to put anything.

Declarations
varA variable whose value changes in game. It occupies a trigger.
constA name assigned once. It may hold a runtime value but cannot be reassigned.
staticDeclared inside a function but surviving between calls - the alternative to a row of numbered globals.

Values are unsigned. Zero minus one is 4,294,967,295, not -1. And subtraction floors at zero, so which operation you used changes the answer - this is the most common bug in EUD code that deals with negatives.

A function can return several values as a compile-time tuple, and you pick one out with double brackets.

function minmax(a, b) {
    if (a < b) { return a, b; }
    return b, a;
}
const lo = minmax(x, y)[[0]];
const hi = minmax(x, y)[[1]];
This is a compile-time selection, not a runtime array.
Sign in to track your progress