Jump to content

detect broken event-block


AIGLE25

Recommended Posts

Posted (edited)

Skript : 2.6.5

skript : Event-block condition

Description:

Hi, is there a way to detect if i broke the event-block i've placed to cancel the "break event-block" ?

Here is my current script:

on place of sponge:
     "%region at event-location%" contains "test" or "redleft" or "redright" or "redTOP" or "blueleft" or "blueright" or "blueTOP"
    wait 26 ticks
    if event-block is sponge:
        break event-block

 

Edited by AIGLE25
? forgotten
Link to comment
Share on other sites

4 hours ago, Jeghurtig said:

Have you tried 
"set event-block to air"?

 

thats not what i want , my script is working but i want to add a condition that if i broke the block i placed , it would cancel the break event-block effect

 

Link to comment
Share on other sites

  • 2 weeks later...

Event-block won't change, but the block at the location of the event-block can. Try checking if the block at the location of event-block is sponge. Let me know if that works.

Link to comment
Share on other sites

On 6/7/2024 at 7:08 PM, Polilla said:

Event-block won't change, but the block at the location of the event-block can. Try checking if the block at the location of event-block is sponge. Let me know if that works.

a event block could be used with lots of things

 

 

on block break:

 set event-block to air

 

on block place:

cancel event

set event-block to air

 

(not real code, just examples if your going to use this make sure to indent it)

Link to comment
Share on other sites

  • 2 weeks later...
On 6/8/2024 at 9:09 PM, Ccr1t said:

a event block could be used with lots of things

When you set the event-block to something, event-block will still return its previous state. That was the point I was trying to get across, and I apologize if it wasn't interpreted as such.

If you set event-block to air, and ask what event-block is (or, "was", as Skript likes to think of it) it'll still return sponge, in this example, regardless of what the block in that position is currently. You can test this yourself, and it's why the above script doesn't work as intended.

Sorry it took me a bit to respond, too. I didn't get a notification until recently 😕

Link to comment
Share on other sites

13 hours ago, Polilla said:

When you set the event-block to something, event-block will still return its previous state. That was the point I was trying to get across, and I apologize if it wasn't interpreted as such.

If you set event-block to air, and ask what event-block is (or, "was", as Skript likes to think of it) it'll still return sponge, in this example, regardless of what the block in that position is currently. You can test this yourself, and it's why the above script doesn't work as intended.

Sorry it took me a bit to respond, too. I didn't get a notification until recently 😕

Yes, With "cancel event" it prevents the block from ever being broken.

Link to comment
Share on other sites

on place of sponge:
    "%region at event-location%" contains "test" or "redleft" or "redright" or "redTOP" or "blueleft" or "blueright" or "blueTOP"
    set {_oldloc} to location of event-block
    wait 26 ticks
    if block at {_oldloc} is sponge:
        set block at {_oldloc} to air


hope this helps. Just shows using a local var to store the old location, and comparing it after with what it was, and then breaking the block if that's the case.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...