Can you check if a key is equal to an integer?

There’s a number of solutions to this:

  • make each slot a User Widget, have it carry a isFocusable flag, with its own index and have it detect key presses; since a slot is a self-contained entity, there’s no need to copy / paste anything. The functionality is handled by the slot instance.

or

  • create a Key | Widget (slot type) Map (dictionary) in the widget housing the slots, something like this:

And find it by key-press:

Ideally, combine both for the best results.


There are more ways, of course. If it’s supposed to be super simple, you could use what KitKat suggested (kind of since there’s no real need for an extra array). Get Key display name, convert to Int and fetch a child from the container holding the slots, by index. You’d need to add script to catch out-of-range ints.

Or convert key to Int and Switch on Int - this will result in delicious blueprint spaghetti, though.