Skip to main content

Castle Variables

Castle scripts are able to interact with the same Castle variables used in Rules.

Deck Variables

You can access any deck play or persistent variables using deck.variables.. Here's an example where we add 1 to the variable "var1" every frame:

This deck has a varible "var1". It also has the default "Wall" blueprint with a script added and a Text blueprint that displays the value of "var1".

As you can see in the example above, we can both read and write the variable.

Local Variables

Scripts can also access local variables. Here's an example of setting a deck variable from a local variable:

This deck has a varible "var1". It also has the default "Wall" blueprint with a script added and a Text blueprint that displays the value of "var1".

Tickers

Tickers can be read the same way as deck variables, but you can't update a ticker by setting it directly. You can use castle.updateTicker to update a ticker.

This deck has a ticker "ticker1". It also has the default "Wall" blueprint with a script added and a Text blueprint that displays the value of "ticker1".