I have tried myself at using Expressions for quickly throwing together some simple functionality right in the editor, without opening the script editor. I just export an array of Strings. But apparently assignment is not allowed in these expressions! Method calls are fine, but assignment doesn’t seem to be okay. Here is what this looks like:

The method calls actually work perfectly fine here, but the assignments (with = in the line) do not seem to work. It seems to complain about there missing another = even though it is already there. Does someone have an idea on why this might happen?

  • popcar2@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    6 months ago

    Most variables have setters for situations like this. Rather than using get_tree().paused = false, try get_tree.set_pause(false). There’s also Input.set_mouse_mode(), you’ll see them under the variable names in the docs.

  • stickyShift@midwest.social
    link
    fedilink
    English
    arrow-up
    7
    arrow-down
    1
    ·
    6 months ago

    I am not familiar with the feature you’re using, but an “expression” is just some code that evaluates to a value; in other words, it’s the right side of the equals sign.

    • Smorty [she/her]@lemmy.blahaj.zoneOP
      link
      fedilink
      arrow-up
      5
      ·
      6 months ago

      Oh yeah, that makes sense. In the documentation the only actual example they give for expressions is a math equasion, so I guess the code-executing features just came naturally… So I guess I will have to write methods for everything now…