Skip to content

Syntax error in variables while editing script #5

Closed

Description

@QinomeD

Issue type:

  • 🐛 Bug

Short description:

When adding a reassignment (smth like let str = "test"; str = "test 2"), the variable card gives me a syntax error (for example in display panels). Reinserting the variable card solves the issue (it's still annoying regardless).

Steps to reproduce the problem:

  1. Add a variable to your script, for example let str = "Hi InDy"
  2. Use this variable in a variable card and insert it into a connected display panel
  3. The variable's value is displayed properly
  4. Reassign the variable in your script, like str += " and InScripting!"
  5. Display Panel shows an X, hovering over the X in display panel's GUI shows that it's a SyntaxError (depends on what type of variable you are reassigning)

Expected behaviour:

New value displays correctly.


Versions:

  • This mod: 1.19.2-1.0.0
  • Minecraft: 1.19.2
  • Forge: 43.3.7

Log file:

Activity

  1. rubensworks commented on Feb 7, 2024

    @rubensworks
    Member

    Thanks for reporting!

  2. rubensworks commented on Feb 7, 2024

    @rubensworks
    Member

    Could you share the syntax error message you're getting?

  3. QinomeD commented on Feb 7, 2024

    @QinomeD
    Author

    Sure, one sec!

  4. QinomeD commented on Feb 7, 2024

    @QinomeD
    Author

    image
    image
    This is for the number type, for some reason syntax error says there's no ar symbol, but I use arr, so idk

  5. QinomeD commented on Feb 7, 2024

    @QinomeD
    Author

    image
    image
    This happens for reassigning array values

  6. rubensworks commented on Feb 7, 2024

    @rubensworks
    Member

    The script variable probably got updated while you were typing, at which point the line was not complete yet and would result in a syntax error.
    So I don't think the re-assignment itself is the problem.

    Not sure yet what a good solution to this could be...

  7. QinomeD commented on Feb 7, 2024

    @QinomeD
    Author

    oh yeah, it's actually not only reassigning, I just didn't really test anything, since just changing the value manually didn't trigger the error

    maybe the variable should be updated when the player stops writing?

  8. rubensworks commented on Feb 7, 2024

    @rubensworks
    Member

    Note to self: consider invalidating errored variables, but only those that errored due to the currently edited script.

  9. changed the title [-]Syntax error on reassigning a variable in script[/-] [+]Syntax error in variables while editing script[/+] on Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions