Maximum values (ZScript)
Maximum values for ZScript
A list of the maximum values in ZScript.
- Maximum numeric literal: 214747.9999
Ints, Floats, Arrays
- Maximum float: -214747.9999 to 214747.9999
- Maximum int -214747 to 214747
- Maximum array size (number of indices): 214747
--> This further includes arrays with a type of npc, leweapon, eweapon, item, and itemdata.
- Maximum value in an array index: Same as float, or int; based on type declaration.
- Maximum size of string index: 214747
- Maximum string length: 214747
- Maximum simultaneous arrays in operation: 4095
Counters, Tiles, Combos, Strings
- Maximum Tiles: 65519
- Maximum Combos: 65279
- Maximum Counter Value: -32767 to 32767
- Maximum strings in string editor: ( 65519 )
- Largest tile ID (ZQ Editors): 32767 ?
The largest value that can be referenced in the ZQ item, enemy, and other editors.
--> I seem to remember a problem calling high values.
Pointers and Objects
- Maximum number of item pointers (on-screen items) at any one time: 255
- Maximum number of lweapon pointers (on-screen lweapons) at any one time: 255
- Maximum number of eweapon pointers (on-screen eweapons) at any one time: 255
- Maximum number of npc pointers (on-screen NPCs) at any one time: 255
- Maximum number of ffc (on-screen FFCs) pointers at any one time: 32
- Array Pointers (maximum number of arrays in operation): 4095
- Maximum total (cumulative) number of 'object' pointers at any one time: 1020 (255 each, npc, lweapon, eweapon, item) + 32 (ffcs)
--> ZC separates pointers by class. All pointers are stored in vectors, with pointer IDs ranging from 1 to 255.
- Maximum Z Height of a Screen Object (npc, weapon, item) or Link: 32767. Values above this wrap to -32767, which is reset to 0 every frame.
- Maximum constants (any scope): Unlimited. (Constants are converted to their true value at compilation, and are not preserved by name.)
- Maximum global variables: 255*
- Maximum global functions: 4,294,967,295 (2^32-1). Note that this is limited by the filesystem, as each function requires its ASCII size in bytes, and is stored in the quest file. Many filesystems have a file size limit, that restricts it. At the smallest function size, max functions would use ~40GB of space.
- Maximum number of drawing commands per frame: 1000
- Maximum distance (x,y) for drawing, including off-screen areas (and bitmaps): -214747.9999 to 214747.9999 (X and Y)
- Maximum Z Height for 3D Drawing: 214747.9999
--> Negative Z Height is effectively '0'.
- Maximum number of concurrent stacks: ?
--> Essentially, the maximum number of concurrent scripts; except that item scripts share one stack.
- Maximum variables in operation at any given time: 255* (gd1-gd255)
- Maximum variables per script: 255*
- Maximum function calls per script ( 127* )
- *Note: 255 variables will compile, but fail to run. A safe maximum is closer to 245, to allow instructions and function calls on the stack
- *Note: Both variables, and function calls share registers (global variables are gd registers), and thus cumulatively count against their combined caps (within a register type). See: ZASM_Registers
--> How are these tabulated at compilation, and is there a strict ratio ( function call:variable ) ? --> Script-scope variables use gd registers. Thus, you need to retain free registers for scripts to run.
- Maximum script buffer size: ~18MB, including code imported with the 'import' directive.
--> Maximum line count is also limited, but it is restricted by being a signed int. --> Thus, max line-count is somewhere around 2,147,483,647 lines, however, this is still restricted by the 18MB buffer size.
- Maximum number of instructions: 2^32-1 * Max Scripts
- Maximum instructions per script: 4,294,967,295 (2^31 - 1)
- Maximum instructions per frame: Effectively unlimited, save by instructions per script.
- Maximum number of scripts ?
- Max ffc scripts at compilation ?
- Max Item scripts at compilation ?
- Max global scripts at compilation ?
--> I know this is unlikely to ever be reached.
- Maximum function calls per script: Limited by maximum instructions, and available gd registers.
- Maximum local functions per script: ? Effectively unlimited, and tied to maximum functions (see above).
Maximum Values (Binary, Hex) for Use as Flags
The largest literal that you can use as a flag, binary, is: 110100011010111101 ( dec. 214717, hex 0x346BD ) The largest true binary value (all ones) is 11111111111111111 ( dec. 131071, hex 0x1FFFF )
While these are certainly possible, the largest absolutely useful value, that maximises all places in both binary, and hex, and thus is the true flag maximum is: 65535 (decimal). This becomes 1111111111111111b, or 0XFFFF, which means that you may use each place to its full potential, at all times.
Thus, the maximum useful flags are a width of 16-bit, and are represented below.
Binary Hexadecimal Decimal 1111111111111111b 0XFFFF 65535