#I need help for on interact for my garage blocks

1 messages · Page 1 of 1 (latest)

neat moat
#

I'm working on garage open and close door mechanic but the fill command on script doesn't work well and my code has no errors and there's no issues on it but it doesn't work the fill command on script only the send message works

you can check the video here and also the code thanks

zealous cloak
# neat moat

There is no dimension property in the onPlayerInteract Event Listener.

neat moat
#

okay I'll try

#

hmm it doesn't work but I guess it must be "player.dimension"

zealous cloak
#

Oh wait, my bad, I was looking at the wrong thing; apologies for that.

neat moat
#

it's okay

zealous cloak
# neat moat I'm working on garage open and close door mechanic but the fill command on scrip...

Perhaps we could narrow down the issue. Here try doing something like this; where you add the sendMessage() method in a few areas, to see if the code is actually running in the various sections.

const GarageDoorInteractComponent = {
  onPlayerInteract(event) {
      // rest of code

    world.sendMessage(`A`);

    if (blockOpenState) {
      world.sendMessage(`B`);

      // rest of code
    } else {
      world.sendMessage(`C`);

      // rest of code
    }
  }
};
#

Also, as for something else to check. Are you sure the type ids for the blocks in the various runCommandAsync() methods, where you're using the fill command, are written correctly?

neat moat
#

hmm i did it but the fill command not working

zealous cloak
#

That would be beneficial to know, considering it would assist in narrowing down the issue.

neat moat
zealous cloak
#

Sorry, what?

zealous cloak
neat moat
#

the if else works by using also the 'world.sendMessage'

zealous cloak
#

Oh okay, I see.

neat moat
#

yup

zealous cloak
#

Yeah, that's strange; I don't see anything noticeably wrong with the use of the runCommandAsync() methods.

zealous cloak
# neat moat here you go

As a side note, something I did notice relates to the use of the playanimation command. Since you're running the command off of the dimension, the radius parameter won't behave as you want. I'm assuming you want all garage door entities within a radius of 5 around the block the player interacted with. As it is now, that won't occur as expected.

Anyway, sorry I couldn't be of any assistance with your main issue. I hope you're able to figure out the source of the issue soon, and get it solved.

neat moat
neat moat
#

here's thew updated code:

#

the fill command wasn't work like on json