detecting x of blocks around target block

  • 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 our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

Jakub Psiak

New Member
Jan 4, 2022
5
0
1
21
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:
on inventory click:
    clicked inventory is not player's inventory
    if name of player's current inventory is "&6&lSmyf &7|| &5&lEnchanting":
        cancel event
        if clicked slot is barrier:
            wait 1 tick
            close inventory of player
        if clicked slot is 1:
            if blocks around target block in radius 3 contains 15 of bookshelf:
                if player's level is higher or equal to 3:
                    if player has 1 of lapis lazuli:
                        if player's tool is any pickaxe:
                            wait 1 tick
                            close inventory of player
                            remove 1 of lapis lazuli from player
                            remove 3 from player's level
                            play sound "block_enchantment_table_use" at player for player
                            enchant player's tool with efficiency 1
                            stop
                        else:
                            send "&cW twojej rece musi znajdowac sie kilof!" to player
                    else:
                        send "&cNie masz wystarczajacej ilosci lapisu!" to player  
                else:
                    send "&cNie masz za niski poziom doswiadczenia!" to player  
            else:
                send "&cW poblizu znajduje sie za malo biblioteczek!" to player
 
size of (blocks)
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
 
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
You would do
Code:
if size of blocks around target block in radius 3 >= 15:
 
the formula works fine, but as if it checks all blocks, not just the given type, namely bookshelf:. what would i have to add?
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.
 
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.
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
 
Status
Not open for further replies.