Skip to main content

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

In Lil, expressions are evaluated from right to left unless overridden with parentheses. The expression

checkbox1.value + checkbox2.value = 2

Is equivalent to

checkbox2.value + (checkbox2.value = 2)

What you probably mean is

2 = checkbox1.value + checkbox2.value

Which is equivalent to

2 = (checkbox1.value + checkbox2.value)

You might find it slightly simpler to use "&" (minimum/logical AND), which for a pair of 0/1 values will be 1 if and only if both inputs were 1:

checkbox1.value & checkbox2.value

If you have a whole bunch of checkboxes, you could make a list of them, extract each of their values, and take the minimum:

min (c1,c2,c3,c4)..value

You can use Decker's Listener to test out expressions like the above while you work; it's a very handy tool!

It's also worth noting that even if a button isn't visibly a checkbox, it still has a ".value" field like a checkbox, so you could simplify things by tracking clicks in the buttons themselves:

on click do
 me.value:1
 card.event["yeah"]
end 

If the "yeah[]" function is defined on the same card as the widget, (or in the deck script) it can be called directly, instead of triggered through an event (either way is fine. Using events is necessary if you're calling a function defined on a different card or widget):

on click do
 me.value:1
 yeah[]
end

Does that help?

(+2)

This is great, thanks a lot! As a straight up rookie, your answers are pure gold. It's feels great to learn so many new things so quickly.