Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I'm not sure yet whether the overall behaviour around widgets in the outside bits of contraptions is intended or not, but I do know that one of the design considerations on Decker is that decks should still be usable on touch-only devices, and not require keyboard input. So I think the intent is to not be able to have keypresses without a corresponding clickable button.

Hiding a button off screen might work as a workaround though if you really want to do it. But if you're targeting web decker and don't mind diving into the danger zone, there's also functionality in the forbidden library to read keypresses directly from javascript.

To be clear, I do have a clickable button, it’s just that I’m using a canvas so I can get the click event as well as the release event. I figured that, like regular buttons, it would be nice to support shortcuts as well as clicks.

I’m not currently targeting Web Decker, but it’s cool that getting key-down events is at least sometimes possible. Thanks for letting me know!

(+2)

I suspect the "hide offscreen" workaround may work for buttons inside contraptions too tbh, which keeps things a bit neater. If you set the position manually using the console you should be able to position it to be sure it's offscreen even if the contraption is up against a corner in the outside world.

It looks like it does! Thanks!

I had hoped I could check "card"=typeof card.parent to see if contraption was being used on a card (in which case, the button needs to be moved out of the way) or if the prototype was being edited (in which case, leave the button where it is so we can edit it). Unfortunately it seems like a prototype’s parent is always some card, even if that card does not contain any contraptions.

Still, if I really need to, I can still bring the button back on-screen by setting its position in the Listener.

(+2)

You can also use the Widgets -> Order... menu option to select from a text list of widgets (including any that may be hiding offscreen) so you can edit its script and properties without needing to actually see it

(+2)

If you really want to distinguish a prototype from a contraption, you could check the typeof "card" rather than "card.parent". There are other visible api differences, like contraption.def and prototype.widgets, but most of the time it's desirable for them to seem the same during prototype editing.