Calculate distances and pick a hint
THE BASIC LANGUAGE
Math helpers handle small but common gameplay jobs. A gauge can stop at its maximum, while a clue can be chosen from several lines.
FUNCTION Run()
DIM charge = Clamp(89 + 25, 0, 100)
DIM ticks = 17 MOD 6
DIM distance = Distance(Vector3(0,0,0), Vector3(3,0,4))
RETURN [charge, ticks, distance]
END FUNCTIONThe results are 100, 5 and 5. Clamp keeps charge in bounds, MOD gives the remainder, and Distance measures a 3–4–5 displacement between two 3D positions.
FUNCTION Run()
DIM clues = ["The ink is fresh.", "The latch is warm."]
DIM pick = RandomInt(0, 1)
RETURN clues[pick]
END FUNCTIONRandomInt includes both ends. There are two possible indexes here, 0 and 1. For a list that changes size, use RandomInt(0, Len(clues) - 1) after checking the list contains at least one entry.
Use Floor, Ceil and Round when converting a fraction to a whole step. Store a randomly chosen puzzle answer in game state if players should still get the same answer after loading.
