Different behavior in a conditional code execution (if...) 1.21 vs 1.22

  • Hi Klaus, congratulations on the new version.
    I have to report a problem between version 1.21 and the new version 1.22.
    Using exactly the same code, there is a completely different behavior in a conditional code execution (if...).
    I take a variable ("mytag") and compare it with the value of another variable passed by an argument. in version 1.22 the "if" condition is not executed, while in version 1.21 it works correctly.
    To test the different behavior, click on the two icons on the right to activate or deactivate the colored icons on the map.

    Code
            for(set(i,1), i LT 21, inc(i),
                if(hotspot[calc('spot_' + get(i))].mytag == get(var1), 
                    switch(hotspot[calc('spot_' + get(i))].visible);
                 );
            );

    Below I have attached both projects with both versions.
    Link Projects:

    Version 1.21 (works correctly)
    Version 1.22

    Please, where is the problem...???

    Marco

  • klaus.krpano November 4, 2024 at 2:27 PM

    Added the label Bug
  • Thanks for reporting!

    This is unfortunately a bug related to the internal String handling.
    There will be very soon a fixed version (1.22.1).

    The actual reason was related to this new feature:

    Quote

    New: The functions from krpano.functions.* can now also be called from Javascript. Previously, some of the functions that returned a string had special characters added to the return string to avoid an unwanted string-to-number conversion. This has now been removed when calling the functions directly from Javascript.

    To make the internal expression functions also usable by Javascript, some parts of the internal String handling were changed and so caused this side-effect.

    Best regards,
    Klaus

  • klaus.krpano November 8, 2024 at 6:16 PM

    Added the label Fixed

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!