Skip to main content

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

How would one go about creating an inventory, or at least a tracker to ensure you've already clicked something? I tried going about it like this

on click do
t+1
if  t>1
alert["You already grabbed the pie tin!"]
alert[t]
else
 t+1
 alert["You found the pie tin! Weirdcat put it out for you already, it looks like!"]
 alert[t]
 end
end

, but I don't want all the clicks to set t:1, and it doesn't look like it's storing it in other widgets?
 

If you want to increment a local variable, like "t" in your example, you must use the assignment operator ":" (read aloud "becomes" or "gets") like so:

t:t+1

Local variables exist only within the lifespan of a single event.

Persistent state, like an inventory or a system for tracking a user's action, must reside in a widget somewhere. This has been discussed many times and places within this forum. I recommend starting with this thread: https://itch.io/t/2702720/how-to-have-interaction-between-cards