How to check if a door is open

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

NivekGnal

Member
Jun 20, 2022
4
0
1
24
I have been searching for the last hours on how to check if a door is open at a specific location have not found anything yet.

Version: 1.16.2 Paper
 
I just found this on the forums:


Code:
if target block of player is door:
        set {_block} to "%target block of player%"
        if {_block} contains "open":
                send "[Debug] The door you're looking at is open." to player
    else:
        send "[Debug] The door you're looking at is closed." to player


You could change it to:

Code:
if block at location(location) is a door:
  set {_block} to event-block
  if {_block} contains "open":
    do stuff
  else:
     do other stuff
 
I just found this on the forums:


Code:
if target block of player is door:
        set {_block} to "%target block of player%"
        if {_block} contains "open":
                send "[Debug] The door you're looking at is open." to player
    else:
        send "[Debug] The door you're looking at is closed." to player


You could change it to:

Code:
if block at location(location) is a door:
  set {_block} to event-block
  if {_block} contains "open":
    do stuff
  else:
     do other stuff

This is not working right now i have
Code:
command /doorgui:
    trigger:
        open chest with 3 rows named "&3DOOR GUI" to player
        if block at location(-24.5, 4, -253.5, world) is a door:
            set {_block1} to event-block
            if {_block1} contains "open":
                format slot 0 of player with green wool named "&rTest Door" to close then run "door1"
            else:
                format slot 0 of player with red wool named "&rTest Door" to close then run "door1"

It will always show the red wool
 
This is not working right now i have
Code:
command /doorgui:
    trigger:
        open chest with 3 rows named "&3DOOR GUI" to player
        if block at location(-24.5, 4, -253.5, world) is a door:
            set {_block1} to event-block
            if {_block1} contains "open":
                format slot 0 of player with green wool named "&rTest Door" to close then run "door1"
            else:
                format slot 0 of player with red wool named "&rTest Door" to close then run "door1"

It will always show the red wool


Do you have SkQuery installed? With the right version? (Matching your Skript version)
 
Status
Not open for further replies.