ZoriaRPG

zscript_Errors.txt for ZC 2.55

Nov 25th, 2016
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //v0.67
  2. // 16-JUNE-2016
  3.  
  4. //////////////////////////////////////////////
  5. /// System Limitations, Minimums, Maximums ///
  6. //////////////////////////////////////////////
  7.  
  8. Maximum numeric literal: 214747.9999
  9.  
  10. Ints, Floats, Arrays
  11.  
  12. Maximum float: -214747.9999 to 214747.9999
  13. Maximum int -214747 to 214747
  14. Maximum array size (number of indices): 214747
  15.  
  16. * This further includes arrays with a type of npc, leweapon, eweapon, item, and itemdata.
  17. Maximum value in an array index: Same as float, or int; based on type declaration.
  18. Maximum size of string index: 214747
  19. Maximum string length: 214747
  20. Maximum simultaneous arrays in operation: 4095
  21.  
  22. Counters, Tiles, Combos, Strings
  23.  
  24. Maximum Tiles: 65519
  25. Maximum Combos: 65279
  26. Maximum Counter Value: 0 to 32767
  27. Maximum strings in string editor: ( 65519 )
  28.  
  29. Largest tile ID (ZQ Editors): 32767 ?
  30.  
  31. The largest value that can be referenced in the ZQ item, enemy, and other editors.
  32.  
  33. --> I seem to remember a problem calling high values.
  34.  
  35. Pointers and Objects
  36.  
  37. Maximum number of item pointers (on-screen items) at any one time: 255
  38. Maximum number of lweapon pointers (on-screen lweapons) at any one time: 255
  39. Maximum number of eweapon pointers (on-screen eweapons) at any one time: 255
  40. Maximum number of npc pointers (on-screen NPCs) at any one time: 255
  41. Maximum number of ffc (on-screen FFCs) pointers at any one time: 32
  42. Array Pointers (maximum number of arrays in operation): 4095
  43.  
  44. Maximum total (cumulative) number of 'object' pointers at any one time: 1020
  45. * 255 each, npc, lweapon, eweapon, item + 32 (ffcs)
  46.  
  47. --> ZC separates pointers by class. All pointers are stored in vectors, with pointer IDs ranging from 1 to 255.
  48.  
  49. 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.
  50.  
  51. Compiler
  52.  
  53. Maximum constants (any scope): Unlimited. (Constants are converted to their true value at compilation, and are not preserved by name.)
  54. Maximum global variables: 255*
  55. Maximum global functions: 4,294,967,295 (2^32-1).
  56. Note that this is limited by the filesystem, as each function requires its ASCII size in bytes,
  57. and is stored in the quest file. Many filesystems have a file size limit, that restricts it.
  58. At the smallest function size, max functions would use ~40GB of space.
  59. It is further restricted by the maximum buffer size at between 18MB and 22MB.
  60.  
  61. Script Drawing
  62.  
  63. Maximum number of drawing commands per frame: 1000
  64. Maximum distance (x,y) for drawing, including off-screen areas (and bitmaps): -214747.9999 to 214747.9999 (X and Y)
  65. Maximum Z Height for 3D Drawing: 214747.9999
  66.  
  67. --> Negative Z Height is effectively '0'.
  68.  
  69. Stack Operation
  70.  
  71. Maximum number of concurrent stacks: ?
  72. --> Essentially, the maximum number of concurrent scripts; except that item scripts share one stack.
  73.  
  74. Maximum variables in operation at any given time: 255* (gd1-gd255)
  75. Maximum variables per script: 255*
  76. Maximum function calls per script ( 127* )
  77. *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
  78. *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
  79. --> How are these tabulated at compilation, and is there a strict ratio ( function call:variable ) ?
  80. --> Script-scope variables use gd registers. Thus, you need to retain free registers for scripts to run.
  81.  
  82. Maximum script buffer size: ~18MB, including code imported with the 'import' directive.
  83. --> Maximum line count is also limited, but it is restricted by being a signed int.
  84. --> Thus, max line-count is somewhere around 2,147,483,647 lines, however,
  85. this is still restricted by the 18MB buffer size.
  86.  
  87. Maximum number of instructions: 2^32-1 * Max Scripts
  88. Maximum instructions per script: 4,294,967,295 (2^31 - 1)
  89. Maximum instructions per frame: Effectively unlimited, save by instructions per script.
  90.  
  91. Maximum number of scripts ?
  92. Max ffc scripts at compilation ?
  93. Max Item scripts at compilation ?
  94. Max global scripts at compilation ?
  95. --> I know this is unlikely to ever be reached.
  96.  
  97. Maximum function calls per script: Limited by maximum instructions, and available gd registers.
  98. Maximum local functions per script: ? Effectively unlimited, and tied to maximum functions (see above).
  99.  
  100. Maximum Values (Binary, Hex) for Use as Flags
  101.  
  102. The largest literal that you can use as a flag, binary, is: 110100011010111101
  103. ( dec. 214717, hex 0x346BD )
  104.  
  105. The largest true binary value (all ones) is 11111111111111111
  106. ( dec. 131071, hex 0x1FFFF )
  107.  
  108. While these are certainly possible, the largest absolutely useful value, that maximises all places in
  109. both binary, and hex, and thus is the true flag maximum is: 65535 (decimal).
  110. This becomes 1111111111111111b, or 0XFFFF, which means that you may use each place to its full potential,
  111. at all times.
  112.  
  113. Thus, the maximum useful flags are a width of 16-bit, and are represented below.
  114.  
  115. Max Flag
  116.  
  117. Binary Hexadecimal Decimal
  118. 1111111111111111b 0XFFFF 65535
  119.  
  120.  
  121. //! A list of all known system limitations.
  122.  
  123. ################################
  124. ## COMPILER ERROR DEFINITIONS ##
  125. ################################
  126. These errors are generated by the parser, during compilation.
  127.  
  128. Error codes are broken down by type:
  129. P** Preprocessing errors.
  130. S** Symbol table errors.
  131. T** Type-checking errors.
  132. G** Code Generation Errors
  133. ** Array Errors ---We need to change these to A**
  134.  
  135. Errors of each class are given unique numerical identifiers, ranging from 00 to 41, such as P01, or G33.
  136. The letter code will give you an indication of the type of error, and the full code will give you specific details.
  137.  
  138. In ZQuest v2.50.2 and later, the compiler will report name of the script that generated (where possible).
  139. This applies only to errors caused by scripts, and not errors at a 'global' level, such as global functions.
  140. Thus, if you are using 2.50.2, or later, an error without a script name is likely to be caused at global scope.
  141.  
  142. #####################
  143. ## Specific Errors ##
  144. ## Preprocessing ##
  145. #####################
  146.  
  147. P00: Can't open or parse input file!
  148.  
  149. Your script file contains illegal characters, or is not plain ASCII Text.
  150.  
  151. Otherwise, it is possible that the compiler is unable to write to the disk, that the disk is out of space.
  152.  
  153. Last, your file may be bad, such as a file in the qrong encoding format (not ASCII text).
  154.  
  155. P01: Failure to parse imported file foo.
  156.  
  157. Generally means that you are trying to call a file via the import directive that does not exist; or that
  158. you have a typo in the filename, or path.
  159.  
  160.  
  161. P02: Recursion limit of x hit while preprocessing.
  162.  
  163. Caused by attempting to import a file recursively. For example:
  164.  
  165. If you declare: import "script.z" ... and ... the file 'script.z' has the line: ' import "script.z" ' inside it.
  166.  
  167. This error should no longer exist! Recursive imports should resolve as duplicate finction/variable/script declarations.
  168.  
  169. Error P03: You may only place import statements at file scope.
  170.  
  171. Import directives ( import "file.z" ) may only be declared at a global scope, not within
  172. a function, statement, or script.
  173.  
  174. P35: There is already a constant with name 'foo' defined.
  175. You attempted to define the same constant more than once.
  176. The identifier (declared name) of all constants MUST be UNIQUE.
  177.  
  178.  
  179. #####################
  180. ## Specific Errors ##
  181. ## Symbol Table ##
  182. #####################
  183.  
  184. S04: Function 'foo' was already declared with that type signature.
  185.  
  186. You attempted to declare a function with the same parameters twice, int he same scope.
  187. This can occur when using different types, if the compiler cannot resolve a difference between the signatures.
  188.  
  189. To fix this, remove one function,or change its signature (the arguments inside the parens) so that each is unique or;
  190. If you declare a functiona t a global scope, and the same at a local scope, remove one of the two.
  191.  
  192. Note that return type is NOT enough to distinguish otherwise identical function declarations and that 'int' and 'float'
  193. types are the same type internally, so int/float is identical insofar as the signature is concerned.
  194.  
  195. If two function type signatures are identical except that one has a parameter of type float where the other has the
  196. same parameter of type int, you will have a conflict.
  197.  
  198. There are two additional subtle situations where you might get a conflict:
  199.  
  200. 1. A function declared at file scope might conflict with a function that's implicitly added to file scope
  201. by the preprocessor because of an import statement.
  202. 2. A function might conflict with one already reserved by the ZScript standard library (std.zh).
  203.  
  204. S05: Function parameter 'foo' cannot have void type.
  205.  
  206. You cannot set a parameter (argument of a function) as a void type. e.g.:
  207. int foo(void var){ return var+1; }
  208.  
  209. This is illegal, and the param 'var' muct be changed to a legal type.
  210.  
  211. S06: Duplicate script with name 'foo' already exists.
  212.  
  213. Script names must be wholly unique. For example, if there's already an ffc script named 'my_script' you cannot
  214. declare an item script with the name 'my_script'.
  215.  
  216. S07: Variable 'foo' can't have type void.
  217.  
  218. Variables at any scope may not have a void type. Only functions may have this type.
  219.  
  220. S08: There is already a variable with name 'foo' defined in this scope.
  221.  
  222. Variable identifiers must be unique at any given scope. Thus, this is illegal:
  223.  
  224. ffc script my_ffc(){
  225. void run(int x){
  226. int v = 1;
  227. int w = 10;
  228. int x = 0.5;
  229. int y = 13;
  230. int z = v+w+x+y;
  231. Trace(z);
  232. }
  233. }
  234.  
  235. As the variable 'x' is declared in the params of the run() function, it cannot be declared inside the function with
  236. the same identifier (name).
  237.  
  238.  
  239. S09: Variable 'foo' is undeclared.
  240.  
  241. You attempted to reference a variable identifier (namme) that has not been declared.
  242. Usually this is due to a typo:
  243.  
  244. int var;
  245. if ( val > 0 ) Link->X += var;
  246.  
  247. Here, 'val' will return this error, as it was not declared.
  248.  
  249. A variable with the give name could not be found in the current or any enclosing scope. Keep in mind the following subtleties:
  250. 1. To access a different script's global variables, or to access a global variable from within a function delcared at file scope,
  251. you must use the dot operator: scriptname.varname.
  252. 2. To access the data members of the ffc or item associated with a script, you must use the this pointer: this->varname.
  253. 3. ZScript uses C++-style for loop scoping rules, so variables declared in the header part of the for loop cannot be
  254. accessed outside the loop:
  255.  
  256. Code:
  257.  
  258. for(int i=0; i<5;i++);
  259. i = 2; //NOT legal
  260.  
  261. S10: Function 'foo' is undeclared.
  262.  
  263. You attempted to call a function that was not declared. This is usually due to either a typo in your code, or failing
  264. to import a mandatory header. Check that you are importing 'std.zh' as well, as failing to do this will result in a slew
  265. of this error type.
  266.  
  267. S11: Script 'foo' must implement void run().
  268.  
  269. Every script must implement run() function call. The signature may be empty, or contain arguments.
  270. Zelda Classic uses all the code inside the run() function when executing the script, so a script without
  271. this function would do nothing, and will return an error.
  272.  
  273. S12: Script 'foo's' run() must have return type void.
  274.  
  275. Is this error even implemented? The run() function is automatic, and never declared by type, unless the user tries to declare
  276. a separate run(params) function with a different type.
  277.  
  278. S26: Pointer types (ffc, etc) cannot be declared as global variables.
  279.  
  280. /* It is illegal to declare a global variable (that is, a variable in script scope) or any type other than int, float, and bool.
  281. Why? Recall that global variables are permanent; they persist from frame to frame, screen to screen.
  282. Pointer types, on the other hand, reference ffcs or items that are transitory; they become stale after a single WAITFRAME,
  283. so it makes no sense to try to store them for the long term.
  284. */
  285.  
  286. This explanation may no longer be true, as pointers may no longer be dereferenced by Waitframe(),
  287. and global pointers may also be implemented in a future version.
  288.  
  289.  
  290. S30: Script foo may have only one run method.
  291.  
  292. You may not call a run() function more than once per script.
  293. Your run method may have any type signature, but because of this flexibility, the compiler cannot
  294. determine which run script it the "real" entry point of the script if multiple run methods are declared.
  295.  
  296. S32: Script foo is of illegal type.
  297.  
  298. The only legal script tokens are: global, ffc, and item. You cannot declare other types (such as itemdata script).
  299.  
  300. S38: Script-scope global variable declaration syntax is deprecated; put declarations at file scope instead.
  301. You cannot declare a global variable in a global script, outside the run function.
  302.  
  303. Example:
  304.  
  305. global script active{
  306. int x;
  307. void run(){
  308. x = 16;
  309. }
  310. }
  311.  
  312. This is ILLEGAL. The declaration of variable 'x' must either be at a global scope, or at the scope of the
  313. run function. Do this, instead:
  314.  
  315. int x;
  316. global script active{
  317. void run(){
  318. x = 16;
  319. }
  320. }
  321.  
  322. This creates a global variable at the file scope.
  323.  
  324. S39: Array 'foo' can't have type void.
  325. Arrays may be types of int, float, bool, ffc, item, itemdata, npc, lweapon, or eweapon; but arrays
  326. with a void type are illegal.
  327.  
  328. S40: Pointer types (ffc, etc) cannot be declared as global arrays.
  329. As of 2.50.2, global array declarations may only have the following types:
  330. int, float, bool
  331. Any other type is illegal.
  332.  
  333. S41: There is already an array with name 'foo' defined in this scope.
  334. As with variables, and functions, arrays must have unique identifiers within the same scope.
  335.  
  336. ###################
  337. ## LEXING ERRORS ##
  338. ###################
  339. L24: Too many global variables.
  340.  
  341. The assembly language to which ZScript is compiled has a built-in maximum of 256 global variables. ZScript can't do anything if you exceed this limit.
  342.  
  343. #####################
  344. ## Specific Errors ##
  345. ## Type Checking ##
  346. #####################
  347.  
  348. T13: Script 'foo' has id that's not an integer.
  349.  
  350. /* I do not know what can cause this error, or if it ever occurs. */
  351.  
  352. T14: Script 'foo's' id must be between 0 and 255.
  353.  
  354. Occurs if you try to load more than 256 scripts of any given type at any given time.
  355. /* The maximum number of concurrent scripts (of any given type?) is 256. */
  356.  
  357. T15: Script 'foo's' id is already in use.
  358. You attempted to laod two scripts into the same slot.
  359. /* I do not know if this is EVER possible. */
  360.  
  361. T16: Cast from foo to bar.
  362.  
  363. The only "safe" implicit casts are from int to float and vice-versa (since they are the same type),
  364. and from int (or float) to bool (0 becomes false, anything else true).
  365. The results of any other kind of cast are unspecified.
  366.  
  367. /*
  368. Is this error still in effect? Casting from npc to itemdata, or others, usually results in a different error code.
  369. Further, Cannot cast from wtf to int, is a thing.
  370. */
  371.  
  372. Explicit casts are unimplemented and unnecessary.
  373.  
  374. T17: Cannot cast from foo to bar.
  375.  
  376. You attempted to typecast illegally, such as tyring to typecast from bool to float.
  377.  
  378. T18: Operand is void.
  379. Occurs if you try to use a void type value in an operation.
  380. /* I do not know if this is EVER possible. */
  381.  
  382. T19: Constant division by zero.
  383.  
  384. While constant-folding, the compiler has detected a division by zero
  385.  
  386. Example:
  387. const int MY_CONSTANT = 0;
  388. ffc script foo{
  389. void run(){
  390. int x = 6;
  391. Link->Jump = x / MY_CONSTANT;
  392. }
  393. }
  394.  
  395. Correct the value of your constant. Perhaps you meant to use a variable?
  396.  
  397. Note that only division by a CONSTANT zero can be detected at compile time.
  398. The following code, for instance, compiles with no errors but will generate script errors during execution.
  399.  
  400. Example:
  401.  
  402. int x = 0;
  403. int y;
  404. y = 1/x;
  405.  
  406.  
  407.  
  408.  
  409. T20: Truncation of constant x.
  410.  
  411. Constants can only be specified to four places of decimal precision, withing the legal range of values.
  412. Any extra digits are simply ignored by the compiler, which then issues this warning.
  413.  
  414. Any values greater than MAX_CONSTANT, or less then MIN_CONSTANT will result in this error.
  415.  
  416. ## Applies to variables, but does not throw an error:
  417. Both floats and ints can only be specified to four places of decimal precision.
  418. Any extra digits are simply ignored by the compiler, which then issues this warning.
  419.  
  420. Any values greater than MAX_VARIABLE, or less then MIN_VARIABLE will result in this error.
  421.  
  422. ########
  423.  
  424. T21: Could not match type signature 'foo'.
  425.  
  426. When calling a function, you used the wrong number, or types, of parameters.
  427. The compiler can determine no way of casting the parameters of a function call so that they
  428. match the type signature of a declared function.
  429.  
  430. For instance, in the following snippet
  431. Code:
  432.  
  433. int x = Sin(true);
  434.  
  435. since true cannot be cast to a float, this function call cannot be matched to the library function Sin, triggering this error.
  436.  
  437.  
  438. T22: Two or more functions match type signature 'foo'.
  439.  
  440. If there is ambiguity as to which function declaration a function call should matched to,
  441. the compiler will attempt to determine the "best fit."
  442. These measures are however occasionally still not enough. Consider for instance the following snippet:
  443. Code:
  444.  
  445. void foo(int x, bool y) {}
  446. void foo(bool x, int y) {}
  447. foo(1,1);
  448.  
  449. matching either of the two foo declarations requires one cast, so no match can be made.
  450. In contrast, the following code has no error:
  451. Code:
  452.  
  453. void foo(int x, bool y) {}
  454. void foo(bool x, bool y) {}
  455. foo(1,1);
  456.  
  457. (The first foo function is matched.)
  458.  
  459. It is best to design functions so that noambiguity is possible, by addign extra params, to change the signature or by using
  460. different identifiers (function names) when using more params is not desirable.
  461.  
  462. T23: This function must return a value.
  463.  
  464. All return statements must be followed by an expression if the enclosing function returns a value.
  465. Note that the compiler does NOT attempt to verify that all executions paths of a function with non-void
  466. return type actually returns a value; if you fail to return a value, the return value is undefined.
  467. For instace, the following is a legal (though incorrect) ZScript program:
  468.  
  469. int foo() {}
  470.  
  471. /* I don't believe anythign ever returns this error.
  472. I've seen functions with int/float/bool types, and no returns compile, without errors.
  473. Perhaps we should fix this, and issue a warning during compilation? */
  474.  
  475. T25: Constant bitshift by noninteger amount; truncating to nearest integer.
  476.  
  477. The bitshift operators (<< and >>) require that their second parameters be whole integers.
  478.  
  479. T27: Left of the arrow (->) operator must be a pointer type (ffc, etc).
  480.  
  481. It makes no sense to write "x->foo" if x is of type int.
  482. You may only use the dereference (->) operator on pointer types.
  483.  
  484. T28: That pointer type does not have a function 'foo'.
  485.  
  486. You tried to use the dereference operator (->) to call a function that does not exist for the pointer type being dereferenced.
  487. Check the list of member variables and functions and verify you have not mistyped the function you are trying to call.
  488.  
  489. This generally occurs when calling internal functions, using the incorrect class, or namespace, such as:
  490.  
  491. Game->Rectangle() instead of Screen->Rectangle()
  492.  
  493. The extra std.zh component 'shortcuts.zh' assists in preventing this error type.
  494.  
  495.  
  496. T29: That pointer type does not have a variable 'foo'.
  497.  
  498. You tried to use the dereference operator (->) to call a member variable that does not exist for the pointer type being dereferenced.
  499. Check the list of member variables and verify you have not mistyped the variable you are trying to call.
  500.  
  501. This generally occurs when calling internal variables, using the incorrect class, or namespace, such as:
  502.  
  503. Link->D[] instead of Screen->D[]
  504.  
  505. /* The extra std.zh component 'shortcuts.zh' assists in preventing this error type.
  506. Probaby not, as this requires silly amounts of functions to handle variables with identical identifiers.
  507. C'est la vie. perhaps we'll do it, but I really am not fond of the idea. */
  508.  
  509. As above, but the member variable you tried to access does not exist.
  510.  
  511. Error T31: The index of 'foo' must be an integer.
  512.  
  513. /* This has been deprecated, so who cares? */
  514.  
  515.  
  516. T36: Cannot change the value of constant variable 'foo'.
  517.  
  518. You cannot assign a CONSTANT to another value.
  519.  
  520. T37: Global variables can only be initialized to constants or globals declared in the same script.
  521. You cannot (directly) simultaneously declare, and initialise a global value using the value of a variable at
  522. the scope of another script, or function.
  523.  
  524. Example:
  525. int x = script.a;
  526. ffc script foo{
  527. int a = 6;
  528. void run(){
  529. for ( int q = 9; q < Rand(15); q++ ) a++;
  530. }
  531. }
  532.  
  533. This is ILLEGAL. You cannot initialise the value of the global variable 'x' using the local value
  534. of 'a' in the ffc script 'foo'.
  535.  
  536. /* I believe this is deprecated, as I do not believe that script level declarations remain legal */
  537.  
  538. T45 (old version, T38): Arrays can only be initialized to numerical values
  539. You attempted to declare an array using a floating point value (e.g. 10.5), constant or equation,
  540. rather than a numeric literal.
  541.  
  542.  
  543. Consider that you want to declare an array with an explicit size of '40':
  544. These are ILLEGAL:
  545. int my_arr[26+14];
  546. const int CONSTANT = 30;
  547. int my_arr[CONSTANT];
  548. int my_arr[CONSTANT/2+20]
  549.  
  550. YOu must declare an arrray with a numeric literal:
  551. int my_array[40];
  552. This is the only legal way to declare the size of an array as of 2.50.2.
  553.  
  554.  
  555. #####################
  556. ## Specific Errors ##
  557. ## @Generation ##
  558. #####################
  559.  
  560.  
  561. G33: Break must lie inside of an enclosing for or while loop.
  562.  
  563. The 'break' keyword aborts the loop (in a for, while, or do statement) in which it is called.
  564. You must be in a loop to break out of one, so calling 'break' outside of a loop is illegal.
  565.  
  566.  
  567. G34: Continue must lie inside of an enclosing for or while loop.
  568.  
  569. The 'continue' keyword halts a loop, and repeats the loop from its head (in a for, while, or do statement) in which it is called.
  570. You must be in a loop to continue one, so calling 'continue' outside of a loop is illegal.
  571.  
  572. As the above error, but with the continue keyword. Continue aborts the current iteration of the loop and skips to the next iteration.
  573.  
  574.  
  575. ##################
  576. ## Array Errors ##
  577. ##################
  578.  
  579. Error A42 (old, Error O1): Array is too small. ( Converting to A42 in 2.50.3 )
  580. You attempted to declare an array, with a set of values, where the number of values in the set
  581. exceeds an explicit array size declaration:
  582.  
  583. int foo[4]={1,2,3,4,5};
  584. The declared size is '4', but you tried to initialise it with five elements.
  585.  
  586. /* THis doesn't seem right, as this seems to be covered by Err 02. Check the source to see what causes this. */
  587.  
  588. Error O2: Array initializer larger than specified dimensions. ( Converting to A43 in 2.50.3)
  589. You attempted to initialise an array, with a set of values, where the number of values in the set
  590. exceeds an explicit array size declaration:
  591.  
  592. int foo[4]={1,2,3,4,5};
  593. The declared size is '4', but you tried to initialise it with five elements.
  594.  
  595. Error O3: String array initializer larger than specified dimensions, space must be allocated for NULL terminator.
  596. ( Convering to A44 in 2.50.3 )
  597. YOu attempted to seclare a QUOTEDSTRING of an explicit size, but you didn;t add space
  598. for the NULL terminator; or you used more chars than you allocated:
  599.  
  600. int my_string[17]="This is a string.";
  601. THis allocates only enough indices for the chars, but not for the NULL terminator.
  602. The array size here needs to be 18.
  603. int my_string[12]="THis is a string.";
  604. You tried to initialise a QUOTEDSTRING that is longer than the array size.
  605. The minimum array size for this is '18'.
  606.  
  607. It is generally best either to declare strings with an implicit size (set by the initialiser):
  608. int my_string[]="This is a string";
  609. This reads the nuber of chars, adds one to the count (for NULL), and sizes the array to 18.
  610. ...or...
  611. Declare the string with an arbitrarily large size:
  612. int my_string[256]="This is a string";
  613. This reserves 256 chars. Only 18 are used, and the rest of the indices
  614. are initialised as '0' (NULL). YOu may later populate the unused space, if desired.
  615.  
  616.  
  617. #################
  618. ## Misc Errors ##
  619. #################
  620.  
  621. FATAL FATAL ERROR I0: bad internal error code
  622. A fallback error if no other type matches the problem.
  623.  
  624. /* I have no idea what causes this. Be afraid, very afraid. */
  625.  
  626. /* OTHER ERRORS
  627. Document any further error codes here.
  628. We need to convert the array errors from raw numeric, to A** codes.
  629. */
  630.  
  631. ########################
  632. ## OPERATIONAL ERRORS ##
  633. ###################################################################################################
  634. ## These errors occur only during the operation of script execution (i.e. when running a script, ##
  635. ## in Zelda Classic while playing a quest). ##
  636. ## --------------------------------------------------------------------------------------------- ##
  637. ## In ZC versions 2.50.2, and later, operational script errors will return the ID of the script ##
  638. ## from which they were generated. ##
  639. ###################################################################################################
  640.  
  641. //! These errors will be reported to allegro.log (or the ZConsole) when scripts run.
  642.  
  643.  
  644.  
  645. ////////////////////
  646. /// Stack Errors ///
  647. ////////////////////
  648.  
  649. "Stack over or underflow, stack pointer = %ld\n"
  650.  
  651. * !? How should I describe this, and give examples?
  652.  
  653. "Invalid ZASM command %ld reached\n"
  654.  
  655. Stack instruction countber reached, or exceeded. The stack counter is an unsigned int, so it's maximum value is 65536.
  656. You have isused more instructiosn this frame than the instructon counter can ahndle. Look through your code for
  657. something that may be doing this.
  658.  
  659. ////////////////////
  660. /// Array Errors ///
  661. ////////////////////
  662.  
  663. "Invalid value (%i) passed to '%s'\n"
  664. "Invalid index (%ld) to local array of size %ld\n"
  665.  
  666. You attempted to reference an array index that is either too small, or too large.
  667. Check the size of your array, and try again.
  668. Perhaps you have a for loop, or other loop that is parsing the array, and trying to read beyond its index ranges.
  669.  
  670.  
  671. "Invalid pointer (%i) passed to array (don't change the values of your array pointers)\n"
  672.  
  673. Array pointers values in operation are 1 through 4095, ( and 4096 to 8164? as declared global pointers ?).
  674. An array may not have a pointer of '0', nor may you reference an array for which a pointer does not exist.
  675. Often, this error is caused by attempting to reference an array that you created, without updating the saved game slot
  676. as the old save does not have the array allocated, but the script is attempting to reference its global ID.
  677.  
  678. "Script tried to deallocate memory at invalid address %ld\n"
  679. "Script tried to deallocate memory that was not allocated at address %ld\n"
  680.  
  681. /* Script attempted to change the value of an array index // that does not exist // due to the inability to declare an array
  682. because too many registers are in use?
  683.  
  684.  
  685. "You were trying to reference an out-of-bounds array index for a screen's D[] array (%ld); valid indices are from 0 to 7.\n"
  686. You attempted to read, or write to a Screen->D[register] that was less than 1, or greater than 10.
  687. Check for loops, and vriables that read/write to Screen->D for any that can fall outside the legal range.
  688.  
  689. "Array initialized to invalid size of %d\n"
  690. You attempted to init array to a size less than 1, or a size greater than 214747, or;
  691. You attempted to init array with a constant, a variable, a formula, or with a floating point value.
  692. Arrays may ONLY be initialised with numeric literals (integers only) between 1 and 214747.
  693.  
  694. "%d local arrays already in use, no more can be allocated\n", MAX_ZCARRAY_SIZE-1);
  695. The maximum number of arrays in operation at one time is 4095.
  696.  
  697. "Invalid pointer value of %ld passed to global allocate\n"
  698. !
  699.  
  700. /////////////////////////////
  701. /// Object Pointer Errors ///
  702. /////////////////////////////
  703.  
  704. "Invalid NPC with UID %ld passed to %s\nNPCs on screen have UIDs "
  705. "Invalid item with UID %ld passed to %s\nItems on screen have UIDs "
  706. "Invalid lweapon with UID %ld passed to %s\nLWeapons on screen have UIDs "
  707. "Invalid eweapon with UID %ld passed to %s\nEWeapons on screen have UIDs "
  708.  
  709. "Script attempted to reference a nonexistent NPC!\n"
  710. "You were trying to reference the %s of an NPC with UID = %ld; NPC on screen are UIDs "
  711.  
  712. "Script attempted to reference a nonexistent item!\n"
  713. "You were trying to reference an item with UID = %ld; Items on screen are UIDs: "
  714.  
  715. "Script attempted to reference a nonexistent LWeapon!\n"
  716. "You were trying to reference the %s of an LWeapon with UID = %ld; LWeapons on screen are UIDs "
  717.  
  718. "Script attempted to reference a nonexistent EWeapon!\n"
  719. "You were trying to reference the %s of an EWeapon with UID = %ld; EWeapons on screen are UIDs "
  720.  
  721. You attempted to reference a game object that has a maximum legal range of 1 to 255.
  722. It is possible that you tried to read outside that range, or that the pointer that you were loading is not valid.
  723. Check NumItems(), NumLWeapons(), NumEWeapons(0, and NumNPCs() before referencing them; and verify that the object ->IsValid()
  724. Check for loops that may attempt ro reference items outside of the range that actually exist.
  725. Look for any for loops that access these objects, that start, or end at zero.
  726.  
  727. The best way to ensure this does not occur, is to make a for loop as follows:
  728.  
  729. for ( int q = 1; q < Screen->NumLWeapons; q++ )
  730.  
  731. //or//
  732.  
  733. for ( int q = Screen->NumLWeapons(); q > 0; q-- )
  734.  
  735. ...replacing NumLWeapons() withthe appropriate type that you are attempting to load.
  736.  
  737. You may be attempting to refrence a pointer that has fallen out of scope.
  738. You may be attempting to reference a pointer that is no longer valid, or has been removed.
  739. Check ( pinter->IsValid() ) by itself, to ensure this does not occur:
  740.  
  741. if ( pointer->IsValid ) {
  742. if ( pointer->ID == LW_FIRE ) //Do things.
  743. }
  744.  
  745. This helps to prevent loading invalid pointers.
  746.  
  747. ////////////////////////////////
  748. /// Maths and Logical Errors ///
  749. ////////////////////////////////
  750.  
  751. "Script attempted to divide %ld by zero!\n"
  752. "Script attempted to modulo %ld by zero!\n"
  753.  
  754. "Script attempted to pass %ld into ArcSin!\n"
  755. "Script attempted to pass %ld into ArcCos!\n"
  756. "Script tried to calculate log of 0\n"
  757. "Script tried to calculate log of %f\n"
  758. "Script tried to calculate ln of 0\n"
  759. "Script tried to calculate ln of %f\n"
  760. "Script attempted to calculate 0 to the power 0!\n"
  761. "Script attempted to calculate square root of %ld!\n"
  762.  
  763. Look for scripts that pass a variable into these functions, or use a variable in a mathematical operation, that
  764. may be zero at any point, and correct it to ensure that it is never zero, or that it is never illegal for the type of
  765. mathematical operation you wish to perform.
  766.  
  767. Chweck for any hardcoded values, or constants that are in use with these functions that may be illegal, or irrational.
  768.  
  769. ////////////////////////////////
  770. /// System Limitation Errors ///
  771. ////////////////////////////////
  772.  
  773. "Couldn't create lweapon %ld, screen lweapon limit reached\n"
  774. "Couldn't create eweapon %ld, screen eweapon limit reached\n"
  775. "Couldn't create item \"%s\", screen item limit reached\n"
  776. "Couldn't create NPC \"%s\", screen NPC limit reached\n"
  777.  
  778. You may create a maximum of 255 of any one object type on the screen at any one time.
  779. Look for anything that is generating extra pointers, and add a statement such as:
  780. if ( Screen->NumNPCs() < 255 )
  781.  
  782. "Max draw primitive limit reached\n"
  783. The maximum number of drawing function calls, per frame, is 1,000.
  784.  
  785. /////////////////////
  786. /// String Errors ///
  787. /////////////////////
  788.  
  789. "Array supplied to 'Game->GetDMapMusicFilename' not large enough\n"
  790. "Array supplied to 'Game->GetSaveName' not large enough\n"
  791. "String supplied to 'Game->GetSaveName' too large\n"
  792. "Array supplied to 'Game->GetMessage' not large enough\n"
  793. "Array supplied to 'Game->GetDMapName' not large enough\n"
  794. "Array supplied to 'Game->GetDMapTitle' not large enough\n"
  795. "Array supplied to 'Game->GetDMapIntro' not large enough\n"
  796. "Array supplied to 'itemdata->GetName' not large enough\n"
  797. "Array supplied to 'npc->GetName' not large enough\n"
  798.  
  799. The buffer for these actions must be equal to the size of the text to load into it, plus one, for NULL.
  800.  
  801. If you wish to load a game name, with Game->LoadSaveName(), and the name on the file select is FOO, you must
  802. supply a buffer with a size of [4] to hold it. (Three chars in the name, plus one for NULL.)
  803.  
  804. ////////////////////
  805. /// Misc. Errors ///
  806. ////////////////////
  807.  
  808. "Waitdraw can only be used in the active global script\n"
  809. You attempted to call Waitdrw() in an ffc script, or an item script; or in your global OnContinue,
  810. global OnExit, or ~Init scripts.
  811. You may only use the Waitdraw() function from a global active script.
  812.  
  813. "No other scripts are currently supported\n"
  814. ? You should never see this. May indicate that you have attempted to load more scripts than ZC can handle.
  815.  
  816.  
  817. "Invalid value (%i) passed to '%s'\n"
  818. !? WHat should we put here?
  819.  
  820. "Global scripts currently have no A registers\n"
  821. This error can only occur if you are coding ZASM, and attempt to utilise an Address register with a global script.
  822.  
  823. ////////////////////////
  824. /// Script Reporting ///
  825. ////////////////////////
  826.  
  827. //Events that will be recorded if Quest Rule 'Log Game Events to Allegro.log' is enabled:
  828.  
  829. "Script created lweapon %ld with UID = %ld\n"
  830. "Script created eweapon %ld with UID = %ld\n"
  831. "Script created item \"%s\" with UID = %ld\n"
  832. "Script created NPC \"%s\" with UID = %ld\n"
  833.  
  834. When any new game object is generated by script, and reporting is enabled, the lweapon, and the name of the
  835. script that generated it, will be reported to allegro.log.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×