In Decker, persistent state lives in widgets. If you want to remember anything beyond the scope of an event handler, it should be stored in a widget. For example:
Type of Data to Store | Appropriate Representations |
String | Field text |
Ranged Number | Slider value |
Arbitrary Number | Field text |
Boolean (true or false) | Button value, any Widget's visibility |
Image | Canvas, Rich Text Field (encoded as inline image) |
Table | Grid value, Field text (encoded as CSV) |
Dictionary or List | Field text (encoded as JSON) |
Position or Size | any Widget's bounding box |
If you want to remember something without showing it to a user, you could use invisible widgets, or widgets on a hidden card.
The walkthrough and examples in this thread might be helpful to you.
I recommend checking out The Listener as a way of interactively trying short snippets of code. You can use the Listener to poke and prod at the contents of a deck or card and verify behaviors before you write a script.
The print[] and show[] Built-In Functions can be used to log information (formatted text or arbitrary Lil values, respectively) to the Listener for debugging. The alert[] function can sometimes be handy for debugging because it pauses the current script and displays text to the user. The panic[] function stops scripts completely, but can likewise be a tool for peering into the workings of complex scripts.
Does any of that help?