1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

detecting x of blocks around target block

Discussion in 'Skript' started by Jakub Psiak, Jan 22, 2022.

Thread Status:
Not open for further replies.
  1. Jakub Psiak

    Jakub Psiak New Member

    Joined:
    Jan 4, 2022
    Messages:
    5
    Likes Received:
    0
    Hello, will someone help me with script to detect the number of bookshelfs around the enchant table?
    my line currently detecting bookshelf but not detecting quantity, e.g. 15:
    if blocks around target block in radius 3 contains 15 of bookshelf:

    all code:
    Code (Text):
    1.  
    2. on inventory click:
    3.     clicked inventory is not player's inventory
    4.     if name of player's current inventory is "&6&lSmyf &7|| &5&lEnchanting":
    5.         cancel event
    6.         if clicked slot is barrier:
    7.             wait 1 tick
    8.             close inventory of player
    9.         if clicked slot is 1:
    10.             if blocks around target block in radius 3 contains 15 of bookshelf:
    11.                 if player's level is higher or equal to 3:
    12.                     if player has 1 of lapis lazuli:
    13.                         if player's tool is any pickaxe:
    14.                             wait 1 tick
    15.                             close inventory of player
    16.                             remove 1 of lapis lazuli from player
    17.                             remove 3 from player's level
    18.                             play sound "block_enchantment_table_use" at player for player
    19.                             enchant player's tool with efficiency 1
    20.                             stop
    21.                         else:
    22.                             send "&cW twojej rece musi znajdowac sie kilof!" to player
    23.                     else:
    24.                         send "&cNie masz wystarczajacej ilosci lapisu!" to player  
    25.                 else:
    26.                     send "&cNie masz za niski poziom doswiadczenia!" to player  
    27.             else:
    28.                 send "&cW poblizu znajduje sie za malo biblioteczek!" to player
     
  2. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    size of (blocks)
     
  3. Jakub Psiak

    Jakub Psiak New Member

    Joined:
    Jan 4, 2022
    Messages:
    5
    Likes Received:
    0
    could you write me a line using
    "if blocks around target block in radius 3 contains 15 of bookshelf:"
    and your "size of <blocks>"? Because I do not know how to use it properly, it only crashes me errors ... thank you :c
     
  4. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    You would do
    Code (Text):
    1. if size of blocks around target block in radius 3 >= 15:
     
  5. Jakub Psiak

    Jakub Psiak New Member

    Joined:
    Jan 4, 2022
    Messages:
    5
    Likes Received:
    0
    the formula works fine, but as if it checks all blocks, not just the given type, namely bookshelf:. what would i have to add?
     
  6. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    429
    Likes Received:
    30
    Oh, that's my bad! You can use blocks around target block in radius 3 where [input is bookshelf] to get all the bookshelves.
    https://skripthub.net/docs/?id=2619 Filter Input is an expression that allows you to quickly loop through every item in a list and filter it.
     
  7. Jakub Psiak

    Jakub Psiak New Member

    Joined:
    Jan 4, 2022
    Messages:
    5
    Likes Received:
    0
    forgive me for writing again, but still no formula either does not catch or the script does not understand the formula:

    with these script doesn't understand the formula:
    if blocks around target block in radius 3 >= 15 where [input is bookshelf]

    and with these script it doesn't catch that it's 15 and gives me from if: "you don't have enough bookshelves"

    if size of blocks around target block in radius 3 where [input is bookshelf] >= 15
    if size of blocks around target block in radius 3 >= 15 where [input is bookshelf]
    if size of blocks around target block in radius 3 where [input is bookshelf] contains 15
    if blocks around target block in radius 3 where [input is bookshelf] contains 15
     
Thread Status:
Not open for further replies.

Share This Page

Loading...