Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Toggle Multiple Fields with One Input

A topic by Salty P. Slug created 6 days ago Views: 65 Replies: 2
Viewing posts 1 to 2
(1 edit) (+1)

Hello all,

Forgive me if this is a basic question but I’m having a hard time figuring out how to toggle more than one object with a single button. I’m using “onclick do” with a “field.toggle[“transparent”]” argument, but I also need to (simultaneously) enable another field and set that one to “solid.”

I am not familiar with Decker’s programming language whatsoever so I really have no idea how to get it working or if it’s possible.

(+2)

You can just keep on writing instructions in Lil, as long as there's a space between them.

(Though I'd strongly recommend hitting enter and putting new things on new lines for ease of reading and editing later. And you can add even more than that if it makes it easier for you to read what you're working on.)

So this is totally fine:

on click do
thing1.toggle["solid"]
thing2.toggle["solid"]
end

And if you ever need to set something to a specific visibility no matter what, instead of toggling it you can also use .show -- though it's written a little differently:

thing1.show:"solid"

I hope this helps, let me know if you have any trouble!

(1 edit) (+2)

That’s helpful and solved my problem. I had tried this exact thing but I’d put a comma in between the two objects. Thank you so much!