Check for specific block layout help

  • 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.

Gerlif

New Member
Apr 23, 2017
8
0
0
31
Hey, so what I want to do is basically check if a certain build is present when right-clicking it.

The build is pretty simple, from above would look like:

-xxx-
x---x
x---x
x---x
-xxx-

Where X = Obsidian

So, what I need help with is how to detect this "frame" of obsidian in a Skript?
I want players to be able to right-click any block of the frame, and then it triggers an event.
 
Hey, so what I want to do is basically check if a certain build is present when right-clicking it.

The build is pretty simple, from above would look like:

-xxx-
x---x
x---x
x---x
-xxx-

Where X = Obsidian

So, what I need help with is how to detect this "frame" of obsidian in a Skript?
I want players to be able to right-click any block of the frame, and then it triggers an event.
What is the value of -? Any blocks including air?
 
I don't know what you really want but I assumed that your portal's orientation is vertical and the blocks inside that obsidian portal are all air. Anyways I'll provide a code, please keep in mind that you should test this first because I am just imagining here the code structure and there may be some typo.
code_language.skript:
on right click on obsidian:
    # SIDE CHECKING
    # In this root condition, we are checking if the side of the clicked block
    # is at the center. Variable {_n}, {_s}, {_w}, {_e} represents the direction of the portal
    # which is equivalent to north, south, east and west. And these variable's
    # are located in the center of the assumed portal.
    if block 1 meter above event-block is obsidian:
        if block 1 meter below event-block is obsidian:
            set {_n} to blocks 2 meters north of event-block
            set {_s} to blocks 2 meters south of event-block
            set {_w} to blocks 2 meters west of event-block
            set {_e} to blocks 2 meters east of event-block
            # In this condition, we checked first the north side of the clicked obsidian to
            # assess if there is an existing portal.
            if block 2 meters above {_n} is obsidian:
                set {_n2} to block 2 meters above {_n}
                if block 1 meter north of {_n2} is obsidian:
                    if block 1 meter south of {_n2} is obsidian:
                        # If the condition has passed these conditions above. Then we can
                        # conclude that there are 3 obsidians above the assumed portal on
                        # the north side. Same thing goes below for the other sides of the
                        # portal.
                        if block 2 meters below {_n} is obsidian:
                            set {_n2} to block 2 meters below {_n}
                            if block 1 meter north of {_n2} is obsidian:
                                if block 1 meter south of {_n2} is obsidian:
                                    if block 2 meters north of {_n} is obsidian:
                                        set {_n2} to block 2 meters north of {_n}
                                        if block 1 meter above {_n2} is obsidian:
                                            if block 1 meter below {_n2} is obsidian:
                                                # And lastly, if the checking reached at this bottom part
                                                # of the checks, we can conclude that there is a REAL
                                                # portal. Insert some code here that you want to execute.
                                                add 1 to {_portals}
            # The process here is repeated from above and the only changes are the directions.
            if block 2 meters above {_s} is obsidian:
                set {_s2} to block 2 meters above {_s}
                if block 1 meter north of {_s2} is obsidian:
                    if block 1 meter south of {_s2} is obsidian:
                        if block 2 meters below {_s} is obsidian:
                            set {_s2} to block 2 meters below {_s}
                            if block 1 meter north of {_s2} is obsidian:
                                if block 1 meter south of {_s2} is obsidian:
                                    if block 2 meters south of {_s} is obsidian:
                                        set {_s2} to block 2 meters south of {_n}
                                        if block 1 meter above {_s2} is obsidian:
                                            if block 1 meter below {_s2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_e} is obsidian:
                set {_e2} to block 2 meters above {_e}
                if block 1 meter east of {_e2} is obsidian:
                    if block 1 meter west of {_e2} is obsidian:
                        if block 2 meters below {_e} is obsidian:
                            set {_e2} to block 2 meters below {_e}
                            if block 1 meter east of {_e2} is obsidian:
                                if block 1 meter west of {_e2} is obsidian:
                                    if block 2 meters east of {_e} is obsidian:
                                        set {_e2} to block 2 meters east of {_e}
                                        if block 1 meter above {_e2} is obsidian:
                                            if block 1 meter below {_e2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_w} is obsidian:
                set {_w2} to block 2 meters above {_w}
                if block 1 meter east of {_w2} is obsidian:
                    if block 1 meter west of {_w2} is obsidian:
                        if block 2 meters below {_w} is obsidian:
                            set {_w2} to block 2 meters below {_e}
                            if block 1 meter east of {_w2} is obsidian:
                                if block 1 meter west of {_w2} is obsidian:
                                    if block 2 meters west of {_w} is obsidian:
                                        set {_w2} to block 2 meters west of {_w}
                                        if block 1 meter above {_w2} is obsidian:
                                            if block 1 meter below {_w2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
    # Here the clicked block is located on the top portion of the portal side.
    if block 1 meter below event-block is obsidian:                                   
        if block 2 meters below event-block is obsidian:
            set {_block} to block 1 meter below event-block
            set {_n} to blocks 2 meters north of {_block}
            set {_s} to blocks 2 meters south of {_block}
            set {_w} to blocks 2 meters west of {_block}
            set {_e} to blocks 2 meters east of {_block}
            if block 2 meters above {_n} is obsidian:
                set {_n2} to block 2 meters above {_n}
                if block 1 meter north of {_n2} is obsidian:
                    if block 1 meter south of {_n2} is obsidian:
                        if block 2 meters below {_n} is obsidian:
                            set {_n2} to block 2 meters below {_n}
                            if block 1 meter north of {_n2} is obsidian:
                                if block 1 meter south of {_n2} is obsidian:
                                    if block 2 meters north of {_n} is obsidian:
                                        set {_n2} to block 2 meters north of {_n}
                                        if block 1 meter above {_n2} is obsidian:
                                            if block 1 meter below {_n2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_s} is obsidian:
                set {_s2} to block 2 meters above {_s}
                if block 1 meter north of {_s2} is obsidian:
                    if block 1 meter south of {_s2} is obsidian:
                        if block 2 meters below {_s} is obsidian:
                            set {_s2} to block 2 meters below {_s}
                            if block 1 meter north of {_s2} is obsidian:
                                if block 1 meter south of {_s2} is obsidian:
                                    if block 2 meters south of {_s} is obsidian:
                                        set {_s2} to block 2 meters south of {_n}
                                        if block 1 meter above {_s2} is obsidian:
                                            if block 1 meter below {_s2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_e} is obsidian:
                set {_e2} to block 2 meters above {_e}
                if block 1 meter east of {_e2} is obsidian:
                    if block 1 meter west of {_e2} is obsidian:
                        if block 2 meters below {_e} is obsidian:
                            set {_e2} to block 2 meters below {_e}
                            if block 1 meter east of {_e2} is obsidian:
                                if block 1 meter west of {_e2} is obsidian:
                                    if block 2 meters east of {_e} is obsidian:
                                        set {_e2} to block 2 meters east of {_e}
                                        if block 1 meter above {_e2} is obsidian:
                                            if block 1 meter below {_e2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_w} is obsidian:
                set {_w2} to block 2 meters above {_w}
                if block 1 meter east of {_w2} is obsidian:
                    if block 1 meter west of {_w2} is obsidian:
                        if block 2 meters below {_w} is obsidian:
                            set {_w2} to block 2 meters below {_e}
                            if block 1 meter east of {_w2} is obsidian:
                                if block 1 meter west of {_w2} is obsidian:
                                    if block 2 meters west of {_w} is obsidian:
                                        set {_w2} to block 2 meters west of {_w}
                                        if block 1 meter above {_w2} is obsidian:
                                            if block 1 meter below {_w2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
    # Here the clicked block is located on the bottom portion of the portal side.
    if block 1 meter above event-block is obsidian:                                   
        if block 2 meters above event-block is obsidian:
            set {_block} to block 1 meter above event-block
            set {_n} to blocks 2 meters north of {_block}
            set {_s} to blocks 2 meters south of {_block}
            set {_w} to blocks 2 meters west of {_block}
            set {_e} to blocks 2 meters east of {_block}
            if block 2 meters above {_n} is obsidian:
                set {_n2} to block 2 meters above {_n}
                if block 1 meter north of {_n2} is obsidian:
                    if block 1 meter south of {_n2} is obsidian:
                        if block 2 meters below {_n} is obsidian:
                            set {_n2} to block 2 meters below {_n}
                            if block 1 meter north of {_n2} is obsidian:
                                if block 1 meter south of {_n2} is obsidian:
                                    if block 2 meters north of {_n} is obsidian:
                                        set {_n2} to block 2 meters north of {_n}
                                        if block 1 meter above {_n2} is obsidian:
                                            if block 1 meter below {_n2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_s} is obsidian:
                set {_s2} to block 2 meters above {_s}
                if block 1 meter north of {_s2} is obsidian:
                    if block 1 meter south of {_s2} is obsidian:
                        if block 2 meters below {_s} is obsidian:
                            set {_s2} to block 2 meters below {_s}
                            if block 1 meter north of {_s2} is obsidian:
                                if block 1 meter south of {_s2} is obsidian:
                                    if block 2 meters south of {_s} is obsidian:
                                        set {_s2} to block 2 meters south of {_n}
                                        if block 1 meter above {_s2} is obsidian:
                                            if block 1 meter below {_s2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_e} is obsidian:
                set {_e2} to block 2 meters above {_e}
                if block 1 meter east of {_e2} is obsidian:
                    if block 1 meter west of {_e2} is obsidian:
                        if block 2 meters below {_e} is obsidian:
                            set {_e2} to block 2 meters below {_e}
                            if block 1 meter east of {_e2} is obsidian:
                                if block 1 meter west of {_e2} is obsidian:
                                    if block 2 meters east of {_e} is obsidian:
                                        set {_e2} to block 2 meters east of {_e}
                                        if block 1 meter above {_e2} is obsidian:
                                            if block 1 meter below {_e2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_w} is obsidian:
                set {_w2} to block 2 meters above {_w}
                if block 1 meter east of {_w2} is obsidian:
                    if block 1 meter west of {_w2} is obsidian:
                        if block 2 meters below {_w} is obsidian:
                            set {_w2} to block 2 meters below {_e}
                            if block 1 meter east of {_w2} is obsidian:
                                if block 1 meter west of {_w2} is obsidian:
                                    if block 2 meters west of {_w} is obsidian:
                                        set {_w2} to block 2 meters west of {_w}
                                        if block 1 meter above {_w2} is obsidian:
                                            if block 1 meter below {_w2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
    # TOP/BOTTOM CHECKING
    # In this case, the clicked block is located at the bottom/top portion side of
    # the assumed portal. The process here is almost the same except for the orientations.
    # I don't think that I'll explain it again here because the code itself is self-
    # explanatory.
    if block 1 meter north of event-block is obsidian:
        if block 1 meter south of event-block is obsidian:
            set {_center} to blocks 2 meters below event-block
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters south of {_center}
            set {_2} to blocks 2 meters north of {_center}
            if block 1 meter north of {_s} is obsidian:
                if block 1 meter south of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 1 meter west of event-block is obsidian:
            set {_center} to blocks 2 meters below event-block
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter north of event-block is obsidian:
        if block 2 meters north of event-block is obsidian:
            set {_block} to block 1 meter north of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter south of event-block is obsidian:
        if block 2 meters south of event-block is obsidian:
            set {_block} to block 1 meter south of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter west of event-block is obsidian:
        if block 2 meters west of event-block is obsidian:
            set {_block} to block 1 meter west of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 2 meters east of event-block is obsidian:
            set {_block} to block 1 meter east of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    #                       
    
    if block 1 meter north of event-block is obsidian:
        if block 1 meter south of event-block is obsidian:
            set {_center} to blocks 2 meters above event-block
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters south of {_center}
            set {_2} to blocks 2 meters north of {_center}
            if block 1 meter north of {_n} is obsidian:
                if block 1 meter south of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 1 meter west of event-block is obsidian:
            set {_center} to blocks 2 meters above event-block
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter north of event-block is obsidian:
        if block 2 meters north of event-block is obsidian:
            set {_block} to block 1 meter north of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter south of event-block is obsidian:
        if block 2 meters south of event-block is obsidian:
            set {_block} to block 1 meter south of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter west of event-block is obsidian:
        if block 2 meters west of event-block is obsidian:
            set {_block} to block 1 meter west of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 2 meters east of event-block is obsidian:
            set {_block} to block 1 meter east of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}       
    send "There are %{_portals}% detected. :)"
This code can be optimized and may require addons.
 
Thanks a lot for the help, this is sorta the way I was thinking of it being done as well.
I'm just wondering if there isn't a more effective solution, hmmm... maybe not :emoji_slight_smile:

I don't know what you really want but I assumed that your portal's orientation is vertical and the blocks inside that obsidian portal are all air. Anyways I'll provide a code, please keep in mind that you should test this first because I am just imagining here the code structure and there may be some typo.
code_language.skript:
on right click on obsidian:
    # SIDE CHECKING
    # In this root condition, we are checking if the side of the clicked block
    # is at the center. Variable {_n}, {_s}, {_w}, {_e} represents the direction of the portal
    # which is equivalent to north, south, east and west. And these variable's
    # are located in the center of the assumed portal.
    if block 1 meter above event-block is obsidian:
        if block 1 meter below event-block is obsidian:
            set {_n} to blocks 2 meters north of event-block
            set {_s} to blocks 2 meters south of event-block
            set {_w} to blocks 2 meters west of event-block
            set {_e} to blocks 2 meters east of event-block
            # In this condition, we checked first the north side of the clicked obsidian to
            # assess if there is an existing portal.
            if block 2 meters above {_n} is obsidian:
                set {_n2} to block 2 meters above {_n}
                if block 1 meter north of {_n2} is obsidian:
                    if block 1 meter south of {_n2} is obsidian:
                        # If the condition has passed these conditions above. Then we can
                        # conclude that there are 3 obsidians above the assumed portal on
                        # the north side. Same thing goes below for the other sides of the
                        # portal.
                        if block 2 meters below {_n} is obsidian:
                            set {_n2} to block 2 meters below {_n}
                            if block 1 meter north of {_n2} is obsidian:
                                if block 1 meter south of {_n2} is obsidian:
                                    if block 2 meters north of {_n} is obsidian:
                                        set {_n2} to block 2 meters north of {_n}
                                        if block 1 meter above {_n2} is obsidian:
                                            if block 1 meter below {_n2} is obsidian:
                                                # And lastly, if the checking reached at this bottom part
                                                # of the checks, we can conclude that there is a REAL
                                                # portal. Insert some code here that you want to execute.
                                                add 1 to {_portals}
            # The process here is repeated from above and the only changes are the directions.
            if block 2 meters above {_s} is obsidian:
                set {_s2} to block 2 meters above {_s}
                if block 1 meter north of {_s2} is obsidian:
                    if block 1 meter south of {_s2} is obsidian:
                        if block 2 meters below {_s} is obsidian:
                            set {_s2} to block 2 meters below {_s}
                            if block 1 meter north of {_s2} is obsidian:
                                if block 1 meter south of {_s2} is obsidian:
                                    if block 2 meters south of {_s} is obsidian:
                                        set {_s2} to block 2 meters south of {_n}
                                        if block 1 meter above {_s2} is obsidian:
                                            if block 1 meter below {_s2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_e} is obsidian:
                set {_e2} to block 2 meters above {_e}
                if block 1 meter east of {_e2} is obsidian:
                    if block 1 meter west of {_e2} is obsidian:
                        if block 2 meters below {_e} is obsidian:
                            set {_e2} to block 2 meters below {_e}
                            if block 1 meter east of {_e2} is obsidian:
                                if block 1 meter west of {_e2} is obsidian:
                                    if block 2 meters east of {_e} is obsidian:
                                        set {_e2} to block 2 meters east of {_e}
                                        if block 1 meter above {_e2} is obsidian:
                                            if block 1 meter below {_e2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_w} is obsidian:
                set {_w2} to block 2 meters above {_w}
                if block 1 meter east of {_w2} is obsidian:
                    if block 1 meter west of {_w2} is obsidian:
                        if block 2 meters below {_w} is obsidian:
                            set {_w2} to block 2 meters below {_e}
                            if block 1 meter east of {_w2} is obsidian:
                                if block 1 meter west of {_w2} is obsidian:
                                    if block 2 meters west of {_w} is obsidian:
                                        set {_w2} to block 2 meters west of {_w}
                                        if block 1 meter above {_w2} is obsidian:
                                            if block 1 meter below {_w2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
    # Here the clicked block is located on the top portion of the portal side.
    if block 1 meter below event-block is obsidian:                                  
        if block 2 meters below event-block is obsidian:
            set {_block} to block 1 meter below event-block
            set {_n} to blocks 2 meters north of {_block}
            set {_s} to blocks 2 meters south of {_block}
            set {_w} to blocks 2 meters west of {_block}
            set {_e} to blocks 2 meters east of {_block}
            if block 2 meters above {_n} is obsidian:
                set {_n2} to block 2 meters above {_n}
                if block 1 meter north of {_n2} is obsidian:
                    if block 1 meter south of {_n2} is obsidian:
                        if block 2 meters below {_n} is obsidian:
                            set {_n2} to block 2 meters below {_n}
                            if block 1 meter north of {_n2} is obsidian:
                                if block 1 meter south of {_n2} is obsidian:
                                    if block 2 meters north of {_n} is obsidian:
                                        set {_n2} to block 2 meters north of {_n}
                                        if block 1 meter above {_n2} is obsidian:
                                            if block 1 meter below {_n2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_s} is obsidian:
                set {_s2} to block 2 meters above {_s}
                if block 1 meter north of {_s2} is obsidian:
                    if block 1 meter south of {_s2} is obsidian:
                        if block 2 meters below {_s} is obsidian:
                            set {_s2} to block 2 meters below {_s}
                            if block 1 meter north of {_s2} is obsidian:
                                if block 1 meter south of {_s2} is obsidian:
                                    if block 2 meters south of {_s} is obsidian:
                                        set {_s2} to block 2 meters south of {_n}
                                        if block 1 meter above {_s2} is obsidian:
                                            if block 1 meter below {_s2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_e} is obsidian:
                set {_e2} to block 2 meters above {_e}
                if block 1 meter east of {_e2} is obsidian:
                    if block 1 meter west of {_e2} is obsidian:
                        if block 2 meters below {_e} is obsidian:
                            set {_e2} to block 2 meters below {_e}
                            if block 1 meter east of {_e2} is obsidian:
                                if block 1 meter west of {_e2} is obsidian:
                                    if block 2 meters east of {_e} is obsidian:
                                        set {_e2} to block 2 meters east of {_e}
                                        if block 1 meter above {_e2} is obsidian:
                                            if block 1 meter below {_e2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_w} is obsidian:
                set {_w2} to block 2 meters above {_w}
                if block 1 meter east of {_w2} is obsidian:
                    if block 1 meter west of {_w2} is obsidian:
                        if block 2 meters below {_w} is obsidian:
                            set {_w2} to block 2 meters below {_e}
                            if block 1 meter east of {_w2} is obsidian:
                                if block 1 meter west of {_w2} is obsidian:
                                    if block 2 meters west of {_w} is obsidian:
                                        set {_w2} to block 2 meters west of {_w}
                                        if block 1 meter above {_w2} is obsidian:
                                            if block 1 meter below {_w2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
    # Here the clicked block is located on the bottom portion of the portal side.
    if block 1 meter above event-block is obsidian:                                  
        if block 2 meters above event-block is obsidian:
            set {_block} to block 1 meter above event-block
            set {_n} to blocks 2 meters north of {_block}
            set {_s} to blocks 2 meters south of {_block}
            set {_w} to blocks 2 meters west of {_block}
            set {_e} to blocks 2 meters east of {_block}
            if block 2 meters above {_n} is obsidian:
                set {_n2} to block 2 meters above {_n}
                if block 1 meter north of {_n2} is obsidian:
                    if block 1 meter south of {_n2} is obsidian:
                        if block 2 meters below {_n} is obsidian:
                            set {_n2} to block 2 meters below {_n}
                            if block 1 meter north of {_n2} is obsidian:
                                if block 1 meter south of {_n2} is obsidian:
                                    if block 2 meters north of {_n} is obsidian:
                                        set {_n2} to block 2 meters north of {_n}
                                        if block 1 meter above {_n2} is obsidian:
                                            if block 1 meter below {_n2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_s} is obsidian:
                set {_s2} to block 2 meters above {_s}
                if block 1 meter north of {_s2} is obsidian:
                    if block 1 meter south of {_s2} is obsidian:
                        if block 2 meters below {_s} is obsidian:
                            set {_s2} to block 2 meters below {_s}
                            if block 1 meter north of {_s2} is obsidian:
                                if block 1 meter south of {_s2} is obsidian:
                                    if block 2 meters south of {_s} is obsidian:
                                        set {_s2} to block 2 meters south of {_n}
                                        if block 1 meter above {_s2} is obsidian:
                                            if block 1 meter below {_s2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_e} is obsidian:
                set {_e2} to block 2 meters above {_e}
                if block 1 meter east of {_e2} is obsidian:
                    if block 1 meter west of {_e2} is obsidian:
                        if block 2 meters below {_e} is obsidian:
                            set {_e2} to block 2 meters below {_e}
                            if block 1 meter east of {_e2} is obsidian:
                                if block 1 meter west of {_e2} is obsidian:
                                    if block 2 meters east of {_e} is obsidian:
                                        set {_e2} to block 2 meters east of {_e}
                                        if block 1 meter above {_e2} is obsidian:
                                            if block 1 meter below {_e2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
            if block 2 meters above {_w} is obsidian:
                set {_w2} to block 2 meters above {_w}
                if block 1 meter east of {_w2} is obsidian:
                    if block 1 meter west of {_w2} is obsidian:
                        if block 2 meters below {_w} is obsidian:
                            set {_w2} to block 2 meters below {_e}
                            if block 1 meter east of {_w2} is obsidian:
                                if block 1 meter west of {_w2} is obsidian:
                                    if block 2 meters west of {_w} is obsidian:
                                        set {_w2} to block 2 meters west of {_w}
                                        if block 1 meter above {_w2} is obsidian:
                                            if block 1 meter below {_w2} is obsidian:
                                                # Insert some codes here.
                                                add 1 to {_portals}
    # TOP/BOTTOM CHECKING
    # In this case, the clicked block is located at the bottom/top portion side of
    # the assumed portal. The process here is almost the same except for the orientations.
    # I don't think that I'll explain it again here because the code itself is self-
    # explanatory.
    if block 1 meter north of event-block is obsidian:
        if block 1 meter south of event-block is obsidian:
            set {_center} to blocks 2 meters below event-block
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters south of {_center}
            set {_2} to blocks 2 meters north of {_center}
            if block 1 meter north of {_s} is obsidian:
                if block 1 meter south of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 1 meter west of event-block is obsidian:
            set {_center} to blocks 2 meters below event-block
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter north of event-block is obsidian:
        if block 2 meters north of event-block is obsidian:
            set {_block} to block 1 meter north of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter south of event-block is obsidian:
        if block 2 meters south of event-block is obsidian:
            set {_block} to block 1 meter south of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter west of event-block is obsidian:
        if block 2 meters west of event-block is obsidian:
            set {_block} to block 1 meter west of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 2 meters east of event-block is obsidian:
            set {_block} to block 1 meter east of event-block
            set {_center} to blocks 2 meters below {_block}
            set {_s} to blocks 4 meters below event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_s} is obsidian:
                if block 1 meter west of {_s} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    #                      
   
    if block 1 meter north of event-block is obsidian:
        if block 1 meter south of event-block is obsidian:
            set {_center} to blocks 2 meters above event-block
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters south of {_center}
            set {_2} to blocks 2 meters north of {_center}
            if block 1 meter north of {_n} is obsidian:
                if block 1 meter south of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 1 meter west of event-block is obsidian:
            set {_center} to blocks 2 meters above event-block
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter north of event-block is obsidian:
        if block 2 meters north of event-block is obsidian:
            set {_block} to block 1 meter north of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter south of event-block is obsidian:
        if block 2 meters south of event-block is obsidian:
            set {_block} to block 1 meter south of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter west of event-block is obsidian:
        if block 2 meters west of event-block is obsidian:
            set {_block} to block 1 meter west of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}
    if block 1 meter east of event-block is obsidian:
        if block 2 meters east of event-block is obsidian:
            set {_block} to block 1 meter east of event-block
            set {_center} to blocks 2 meters above {_block}
            set {_n} to blocks 4 meters above event-block
            set {_1} to blocks 2 meters west of {_center}
            set {_2} to blocks 2 meters east of {_center}
            if block 1 meter east of {_n} is obsidian:
                if block 1 meter west of {_n} is obsidian:
                    if block 1 meter above {_1} is obsidian:
                        if block 1 meter above {_1} is obsidian:
                            if block 1 meter above {_2} is obsidian:
                                if block 1 meter above {_2} is obsidian:
                                    # Insert some codes here.
                                    add 1 to {_portals}      
    send "There are %{_portals}% detected. :)"
This code can be optimized and may require addons.
 
Status
Not open for further replies.