Kode wheel segment Math/Functions
Style Math
Modifiers max / min
Primarily WHEN/DO DO
Pre-made brains that use it Unknown

Math> Functions > clamp


This tile is a Math tile. It sets a range that a number can be using min and max modifier tiles.


Example Code

WHEN [A][pressed] DO [numvar:number1][increment by][1]

WHEN DO [numvar:number1][=][clamp][min][1][max][7][numvar:number1]

When A is pressed the number will increase until it gets to 7, then it will no longer increase.


max: The highest number this variable can be

min: The lowest number this variable can be

Other Uses

This is most useful when setting up a menu using number variables to select different words or objects on screen.

Clamp your selection variable so that a player cannot keep adding to or subtracting from the selector number, and create a number that is higher or lower than the number of possible selections.

See Fast Track Checkpoints (by list) tutorial for an example of this.

Mescad Tutorial

Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: