Bringing bits together

I’ve now got what’s shaping up to be a pretty good UI system:

  • The UI styling is defined via data in space-format (JSONish)
  • The layout of the UI is then defined by a second space-format file:
  • Then the “actions”, in the case above the single button, are defined in a space-script file:

    Basically, the UI Layout says the button will execute the function named “SeedButton”. That function creates a new button that will execute the function named “OutputNum”.

This all works well, surprisingly. The only gap is that every “execution” of the script, or execution of a function in the script, is completely independent of any other execution. Meaning that I can’t store information between button presses, at least not in the script.

To get around this, I’ll likely implement a key-store as a regular Engine Function so that scripts can store information for later use, even when it’s only ever needed by the script.

I didn’t think of this before because I only ever imagined scripting things like enemy behaviour, which would just access and set what it needed to.