# Loop blocks within 2 locations

Status
Not open for further replies.

#### kai1846456

##### New Member
Skript version: 2.4.1
Minecraft Version: 1.16.1

Code:
Code:
``loop all blocks within block at {_location-1} and block at {_location-2}:``

The code works - however, rather than looping all blocks within the 2 locations, its only looping blocks between the 2 locations. Any solutions?

Does the same thing.
Code:
``loop all blocks between {_location-1} and {_location-2}:``
should be it.

That worked for me however when i use that in a loop, it does nothing.
Code:
``loop all blocks between {_location-1} and {_location-2}:``

Code:
``````            set {_location-1} to {_l}
set {_location-2} to {_l}
set {_location-1-complete} to false
set {_location-2-complete} to false
while {_location-1-complete} is false:
add 1 to the x coord of {_location-1}
if "%block at {_location-1}%" contains "bedrock":
remove 1 from the x coord of {_location-1}
exit loop
while {_location-1-complete} is false:
add 1 to the z coord of {_location-1}
if "%block at {_location-1}%" contains "bedrock":
remove 1 from the z coord of {_location-1}
exit loop
while {_location-2-complete} is false:
remove 1 from the x coord of {_location-2}
if "%block at {_location-2}%" contains "bedrock":
add 1 to the x coord of {_location-2}
exit loop
while {_location-2-complete} is false:
remove 1 from the z coord of {_location-2}
if "%block at {_location-2}%" contains "bedrock":
add 1 to the z coord of {_location-2}
exit loop
send "%{_location-1}%" to {_p}
send "%{_location-2}%" to {_p}
loop all blocks between {_location-1} and {_location-2}:
set {_bk} to "%loop-block%" parsed as itemtype
send "%location of loop-block%" to {_p}
if {sell::%{_bk}%} is set:
sell({_p}, loop-block)
set loop-block to air``````
[doublepost=1593650498,1593650440][/doublepost]It finds the correct coordinates i have checked this via the 2 messages sent before the loop
However, no blocks are cleared and none of the code under the loop is executed.

Ive also tried within and that didnt work but used to

``loop blocks within {_location-1} and {_location-2}:``