Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+3)

Contraptions are independent, encapsulated units. Events generated inside a contraption do not automatically bubble up to a deck script in the way  events bubble up from widget -> card -> deck. Functions declared in a deck script (or for that matter a card or widget script) are not directly accessible as attributes. By designing contraptions not to specifically depend on the structure of the deck, they're more reusable.

You can, however, explicitly send an event to the deck with "deck.event[]". Given your deck-level declaration, from anywhere you have access to "deck" you can do something like

deck.event["stat_to_mod" 20]

Which will return "5". Using the same approach for sending events to cards or widgets can be extremely useful. For example, simulating a user's click on a button:

mybutton.event["click"]

Does that make sense?

(+1)

Yes, it does. In fact, I had even already tried to use deck.event, but forgot the quotation marks and assumed it didn't work. Thank you so much!