Returning a list with locations

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

Marsbar

Active Member
Mar 31, 2019
131
4
18
18
I have searched the web

Version: 1.8
Skript version: 2.2 dev 36

Problem: The function returns a list with locations. The return type is objects.
When the list returns, the locations just don't work. Nothing happens when i teleport my self there, and the same happens with set block at. When i send the variable to myself it sends it normally

I don't see why that happens

Code:
function getBlocks(c1: text, c2: text) :: objects:
    if 1 is 1:
        replace all "," in {_c1} and {_c2} with ""
        set {_a2} to location of random element of all players
        set {_a1} to {_a2}
        if ((2nd element of (split "%{_c1}%" at " ")) parsed as a number) > ((2nd element of (split "%{_c2}%" at " ")) parsed as a number):
            set x coordinate of {_a2} to ((first element of (split "%{_c1}%" at " ")) parsed as a number)
            set y coordinate of {_a2} to ((2nd element of (split "%{_c1}%" at " ")) parsed as a number)
            set z coordinate of {_a2} to ((last element of (split "%{_c1}%" at " ")) parsed as a number)

            set x coordinate of {_a1} to ((first element of (split "%{_c2}%" at " ")) parsed as a number)
            set y coordinate of {_a1} to ((2nd element of (split "%{_c2}%" at " ")) parsed as a number)
            set z coordinate of {_a1} to ((last element of (split "%{_c2}%" at " ")) parsed as a number)
        else:
            set x coordinate of {_a1} to ((first element of (split "%{_c1}%" at " ")) parsed as a number)
            set y coordinate of {_a1} to ((2nd element of (split "%{_c1}%" at " ")) parsed as a number)
            set z coordinate of {_a1} to ((last element of (split "%{_c1}%" at " ")) parsed as a number)

            set x coordinate of {_a2} to ((first element of (split "%{_c2}%" at " ")) parsed as a number)
            set y coordinate of {_a2} to ((2nd element of (split "%{_c2}%" at " ")) parsed as a number)
            set z coordinate of {_a2} to ((last element of (split "%{_c2}%" at " ")) parsed as a number)
        set {_l1} to {_a2}
        set z coordinate of {_l1} to z coordinate of {_a1}
        loop blocks between block at {_l1} and block at {_a2}:
            set {_o1} to location of loop-block
            set y coordinate of {_o1} to ((y coordinate of location of loop-block))
            loop blocks between block at {_l1} and block at {_o1}:
                set {_dd} to {_o1}
                set y coordinate of {_dd} to (y coordinate of {_a1})
                loop blocks between (block at {_dd}) and loop-block-2:
                    set {_dd2} to location of loop-block-3
                    set x coordinate of {_dd2} to x coordinate of {_a1}
                    loop blocks between block at {_dd2} and loop-block-3:
                        add location of loop-block-4 to {_returnBlocks::*}
                        set block at location of loop-block-4 to gold block
        return {_returnBlocks::*}

on chat:
    loop getBlocks("956, 95, -425", "954, 97, -427"):
        wait 5 tick
        teleport player to (loop-value)
 
Status
Not open for further replies.