Skip to main content

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

Hi! I've been having a fun time messing around in Decker, and am now attempting something more game-y.

Specifically, I'd like to know if these are possible to do:

  • When Button X is clicked, have Button Y on a different card disappear/become hidden
  • When Button Z is clicked, unlock new dialogue on a different card (with the Dialogizer module)
I'm assuming it would be something like, "on click do: Button X = true"—but I'm not sure exactly what terms to use, so I would appreciate any help. Thanks!
(+1)

Widgets have an attribute called "show" which controls their visibility; this can be "solid" (the default), "invert" (an alternate color-scheme), "transparent", or "none".

Suppose the button X is on card C1 and the button Y is on card C2.

You could give X a script for toggling Y's visibility:

on click do
 C2.widgets.Y.toggle["solid"]
end

Or a simpler version that just makes Y visible:

on click do
 C2.widgets.Y.show:"solid"
end

There are several other examples of doing this sort of thing in this thread.

To make clicking a button "unlock" dialogue or behavior elsewhere in the deck, you'll need to remember that the button has been clicked, and consult that record at a later time.

Checkboxes are just a special visual appearance for a button, so every button widget has a "value" attribute that can store a single boolean (0 or 1) value. Thus, we can use the button itself to keep track of whether it's been clicked. Suppose you've given the button Z on card C1 a script like so:

on click do
 me.value:1
end

A script on another card could reset Z's value,

C1.widgets.Z.value:0

Or test its value in a conditional:

if C1.widgets.Z.value
  # do something special
end

If you have lots of "flags" like this, it may be a good idea to centralize them in some kind of "backstage" card so you can keep track of them easily, and perhaps to give yourself a script for resetting the state of the deck.

Does that make sense?

(+1)

Makes sense! Thank you for the detailed walkthrough, that was all very helpful :)

is it possible to have something special unlocked only when two buttons are checked at once?🤔...

(+1)

That would be a logical "and", produced with the & operator:

if C1.widgets.Z.value & C1.widgets.W.value
 # ...
end