Does anyone know how to split a numerical value with a maximum of 5 characters (maximum amount of 99999) into five seperate variables? I want to make a sprite based counter for my game.
Use the DIV and MOD instructions. DIV returns the integer division of two values and MOD returns the remainder of the integer division. You can employ these two operators in a way that you can get each individual digit in a number.
For example...
10298 MOD 10 will return 8.
10298 DIV 10 will return 1029. 1029 MOD 10 will return 9.
10298 DIV 100 will return 102. Etc.
This might be easier:
DEF DIGITS N% OUT A%,B%,C%,D%,E%
VAR S$=FORMAT$("%05D",N%)
A%=VAL(S$[0])
B%=VAL(S$[1])
C%=VAL(S$[2])
D%=VAL(S$[3])
E%=VAL(S$[4])
END