Solved Corner to Corner

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

ChisleLP

Well-Known Member
Jan 26, 2017
789
60
28
26
Germany
Is more Question than Help.. This is reason why i don't use Template.


Hello.

My Question. is there any way, that i can Loop all blocks from corner to corner? Because we have currently all newste version and we was trying around with loop blocks from loc1 to loc2 but. it didn't work. so we set it then to blocks. is still works but... not very. Its just doing Vector works. but i want from corner to corner like "PlotMe"

So someone know what did we wrong?


We still running Spigot 1.11.2...
 
Try this:
code_language.skript:
function blocksWithin(loc1: location, loc2: location) :: locations:
    set {_topBlockX} to {_loc1}'s x-pos < {_loc2}'s x-pos ? {_loc2}'s x-pos : {_loc1}'s x-pos
#This is an expression of skQuery, if you know Java, you surely knows what it does, but if not, it's basically:
#if some boolean is true return an object else return other
    set {_topBlockY} to {_loc1}'s y-pos < {_loc2}'s y-pos ? {_loc2}'s y-pos : {_loc1}'s y-pos
    set {_topBlockZ} to {_loc1}'s z-pos < {_loc2}'s z-pos ? {_loc2}'s z-pos : {_loc1}'s z-pos
    set {_bottomBlockX} to {_loc1}'s x-pos > {_loc2}'s x-pos ? {_loc2}'s x-pos : {_loc1}'s x-pos
    set {_bottomBlockY} to {_loc1}'s y-pos > {_loc2}'s y-pos ? {_loc2}'s y-pos : {_loc1}'s y-pos
    set {_bottomBlockZ} to {_loc1}'s z-pos > {_loc2}'s z-pos ? {_loc2}'s z-pos : {_loc1}'s z-pos
    loop integers from {_bottomBlockX} to {_topBlockX}:
        loop integers from {_bottomBlockZ} to {_topBlockZ}:
            loop integers from {_bottomBlockY} to {_topBlockY}:
                add location(loop-num-1, loop-num-2, loop-num-3, {_loc1}'s world) to {_blocks::*}
    return {_blocks::*}

Copied from this bukkit post (thanks to @Tlatoani such as he is who did the loop thingy there), although it return locations, not blocks, you can use the "block at" expression for get the block at that location.
 
Last edited by a moderator:
Hello.

Great. Thanks. but.... Its not working very fine... Its output just nothing. we have trying with debugs. its just say evertime "-119" (X pos of one corner) i don't know... what... i just don't understand this code. :S


Now i got Informantion. we got Bensku skript.
 
Status
Not open for further replies.