You’re almost there, but unfortunately Decker doesn’t allow you to add a pressed attribute to a button like that. If you want to keep track of a flag like “treasure taken”, the easiest thing would be to make a button in the puzzle-room called treasuretaken, configure it to be a checkbox, and “Show None”. Then the button that takes the treasure can do:
on click do
treasuretaken.value:1
end
(note that you have to say 1, not true: Decker’s scripting language Lil does not recognise true and false specially, and treats them both as undefined variables)
…and the button that checks for taken treasures can do:
on click do
if puzzleroom1.treasuretaken.value & puzzleroom2.treasuretaken.value
dd.open[deck]
dd.say["You successfully stolen all treasures!"]
dd.close[]
go["end"]
else
alert["You must collect all treasures to leave!"]
end
end
(note that the way to say “both these things must be true” is & not and - Lil does not recognise and either)