Files
gymkhana-actions/game/rooms/room09/esc/closet_left.esc
2022-03-09 08:02:23 +01:00

79 lines
2.2 KiB
Plaintext
Executable File

# Magical closet: the object is always in the LAST opened closet
# We want "use" and "open" to give the same end result
# so we duplicate everything for use and open
:use
> [left_closet_open]
# The closet is already open, so exit the command
stop
set_global left_closet_open true
# Increment the counter of the number of open closets
inc_global open_closets 1
# Animate the door opening
set_state r9_closet_left open_door
> [eq open_closets 3]
# After opening this one, we have 3 closets open
# Activate the magic bottle in this particular closet
> [i/r9_bottle]
# If they've already picked up the bottle, don't make it appear
stop
> [r9_puzzle_complete]
# If they've already completed the puzzle, don't make it appear
stop
set_active r9_bottle_left true
# Note which cupboard the bottle is in in case the player
# exits then reenters the room
set_global r9_bottle_closet 1
stop
:open
> [left_closet_open]
# The closet is already open, so exit the command
stop
set_global left_closet_open true
# Increment the counter of the number of open closets
inc_global open_closets 1
# Animate the door opening
set_state r9_closet_left open_door
> [eq open_closets 3]
# After opening this one, we have 3 closets open
# Activate the magic bottle in this particular closet
> [i/r9_bottle]
# If they've already picked up the bottle, don't make it appear
stop
> [r9_puzzle_complete]
# If they've already completed the puzzle, don't make it appear
stop
set_active r9_bottle_left true
# Note which cupboard the bottle is in in case the player
# exits then reenters the room
set_global r9_bottle_closet 1
stop
:close
> [!left_closet_open]
# If the closet isn't open, ignore the close command
stop
> [eq open_closets 3]
# If there's 3 closets open, the bottle was made active
# We don't know which closet it was activated in so lets
# deactivate all of them
set_active r9_bottle_left false
set_active r9_bottle_middle false
set_active r9_bottle_right false
# Animate the door closing
set_state r9_closet_left close_door
set_global left_closet_open false
# Decrement the counter of closets open (used to determine when to show
# the magic bottle)
dec_global open_closets 1