Global Variables

58 views
Skip to first unread message

An E

unread,
Feb 13, 2023, 12:16:05 PM2/13/23
to PuzzleScript
There could probably be a new section for variables that affect everything on the board, if there are rules for that. And maybe you could set a default value for the variables, which gets set at the start of a level. A good example for a use for this would be a door that opens when something is on a button. So:

~~VARIABLES~~
buttonpress 0
~~RULES~~
[ Button Player ] -> buttonpress 1
buttonpress 1 [ Door ] -> [ OpenDoor ]
buttonpress 0 [ OpenDoor ] -> [ Door ]

An E

unread,
Feb 13, 2023, 1:21:12 PM2/13/23
to PuzzleScript
For anyone who doesn't understand, in the VARIABLES section, a "buttonpress" variable is made with a default value of 0, which makes the variable be 0 at the start of a level.
In the RULES section, if Button and Player are on top of each other, then the "buttonpress" variable is set to a value of 1.
The 2 rules below act if the "buttonpress" variable is a set value (so if buttonpress is 1, then every Door becomes an OpenDoor, and if buttonpress is 0, then every OpenDoor becomes a Door.)

ThumpBaconBacon1

unread,
Feb 13, 2023, 6:40:35 PM2/13/23
to PuzzleScript
That would honestly be pretty useful in base puzzlescript. That said, I don't think it's coming. For now, transparent markers will do.

I can't verify this as I haven't messed around with Pattern:Script, but it would probably be pretty easy to do something similar in Pattern:Script.

David Bennett

unread,
Feb 20, 2023, 12:52:21 AM2/20/23
to PuzzleScript
Can I ask you to log an issue with one of the main forks: https://github.com/Auroriax/PuzzleScriptPlus or https://github.com/ClementSparrow/Pattern-Script. We are listening.
Reply all
Reply to author
Forward
0 new messages