State in a deck, like a score counter, needs to live in a widget, on some card.
The straightforward way to have a global score counter would be to make a field (or slider) widget somewhere on a specific card; let's call the card "inventory" and the field "score". Scripts on another card can then refer to that field by one of its "fully-qualified" names:
deck.cards.inventory.widgets.score inventory.widgets.score
For example, to add 100 points to the score, a button script might be
on click do inventory.widgets.score.data:100+inventory.widgets.score.data end
Or, using a local variable to reduce repetition,
on click do s:inventory.widgets.score s.data:100+s.data end
In fact, if you're referring to this widget constantly throughout your deck, you might consider setting up an alias in the deck-level script:
scoreCounter:deck.cards.inventory.widgets.score
After which point you could just use the name "scoreCounter" in any script, on any card.
Each card could have their own "score" field (perhaps volatile) that is drawn from the central source-of-truth score counter and updated when the card gets a view[] event:
on view do score.data:scoreCounter.data end
(Note that when you change the score counter you will generally also want to call view[] to perform this update.)
Does that make sense?
If you're interested in making this even tidier- at the cost of some additional up-front complexity- I could describe how to use a contraption to build a "game HUD" that behaves like a single object shared across many cards.






























