Zelda Classic 2.55.0 Alpha 13 for Windows
Includes ZLaunch, 2.6.12removing an extraneous option, and fixing the default ZQuest options tab.
Changelog for 2.55 on GitHub.


Highlights

  1. Fixes Issues and Crashes when taking screenshots (ZC Player, and ZQuest Editor)
  2. Fixes crashes (ZC Player) when using the Lens item on some secret types.
  3. This build fixes a number of issues with the ZScript parser/compiler.


It does not fix other known issues, nor does it synchronise with the improvements made to 2.53 in Gamma; but we will close those gaps next.

Parser/Compiler Fixes and Improvements

1. You can now declare any type globally.
  • Previously, only int, float, and bool were legal.

2. You can now declare untyped variables, and arrays.
  • Previously, the untyped type was reserved for internal use.

3. You can now have a function return type of 'untyped'.
  • Previously, the untyped type was reserved for internal use.


4. Typedef now works across multiple files.

  • Previously, you would need to re-invoke typedef.


5. Added type 'const untyped'.

  • Can only be initialised with a numeric literal, or const float/int, but typecasts to all datatypes.

6. Added type 'const bool'.
  • Cannot yet be initialised with true/false). t/b/a


7. Fixed Division Bugs
  • Fixed a bug where division of a constant would result in truncation that did not occur in 2.50.x and issues with division by an integer, where values would be truncated.

8. Added #option TRUNCATE_DIVISION_BY_LITERAL_BUG as a Compiler Flag

This is OFF by default.
#option TRUNCATE_DIVISION_BY_LITERAL_BUG on
Forces old 2.50 behaviour (truncate division by a literal).
#option TRUNCATE_DIVISION_BY_LITERAL_BUG off
Use new behaviour (never truncate)
9. Added Escape Character Sequences to SINGLECHAR
Code:
    \a             Alert (Beep, Bell)
    \b            Backspace
    \f             Formfeed Page Break
    \n             Newline (Line Feed); see notes below
    \r             Carriage Return
    \t             Horizontal Tab
    \v             Vertical Tab
    \\             Backslash
    \'             Single quotation mark
    \"             Double quotation mark
    \?             Question mark (used to avoid trigraphs)
    \x0 to \xFF       Normal ANSI characters, as hex value.

10. Fixed Scope Resolution
  • At some point in 2.55, we broke scope resolution for identifiers and variables when used across imported files. This build restores the correct behaviour.

Example:
Code:
        //buffer



        import "bar.zs"

        void foo()

        {

            scrid.bar();

        }

        ////////////////////end of buffer

        

        //bar.zs

        

        ffc script scrid

        {

            void run(){}

            void bar(){ Trace(1); }

        }

This worked in 2.50.x, but broke at some point in 2.55, and the correct behaviour has been restored.

Scoped identifiers must be read-in, in linear order. Thus, this would not be valid:

Code:
        //buffer



        void foo()

        {

            scrid.bar();

        }

        

        import "bar.zs"

        ////////////////////end of buffer

        

        //bar.zs

        

        ffc script scrid

        {

            void run(){}

            void bar(){ Trace(1); }

        }
The import directive containing the token that you are resolving must be declared first, or be processed first, before it can be used.


11. Revised Visual Style of Error Messages
  • Script errors will now give line and column references prior to the error type.


Old:
Error S007: Variable X can't have type VOID.
@ LINE 4 COLUMNS 1-11


New:
LINE 4 @ COLUMNS 1-11 - ERROR S007: Variable X can't have type VOID.


13. Error Carryovers
  • Fixed some issues where compiler errors improperly carried over.

14. Fixed import Directive Pathing with Backslashes

  • Importing in zscript with a path such as scripts\scriptfile.z used to work, in prior versions.
  • As of 2.55, it reads \ as an escape character, and parses the file path improperly.
  • This has now been corrected, so that you may use / or \ as a valid path token, however, / is the better option.


15. Added Ternary Expressions
  • ZScript now supports C-style ternary expressions, although some limitations for order of operations apply that may not apply in C.

Code:
int x = Rand(6,8);

int y = x > 7 ? 1 : 0;
Assigns, and operations inside ternary blocks must be in parens:

Code:
bool V = true;

int b;

int a = V ? ( b =  5 ) ? ( b = 4 );

        

int c = V ? ( b -= 2 ) ? 0;

        

int y; int z;

int x = (y += 10) ? (z = 5) : (a -= 2);
In all of these cases, parens are mandatory.

Further, compound ternary expressions should be placed in parens:
Code:
int a = (V ? 1 : 0) ? 5 : 6

The default, is to evaluate in a linear sequence.

Thus: bool ? int : int ? bool : int

...would evaluate as: bool ? int : (int ? bool : int)

Using parens to define your order of operations and scope, is prudent.