Variable issue

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

kuzmin04

New Member
May 7, 2020
7
0
1
19
I'm trying to get a block in a direction but it says "variables cannot be used here" at the line "set {_block} to location at block {_amount} {_facing} of {_center}"

If I put east instead of {_facing} (which is a direction I checked) it works

Does anyone have any idea what's wrong?

Code:
function getDirection(direction: text) :: direction:
    if {_direction} is "north":
        return north
    else if {_direction} is "east":
        return east
    else if {_direction} is "south":
        return south
    else if {_direction} is "west":
        return west

function getBlockList(list: objects, center: location) :: locations:
    loop {_list::*}:
        set {_info::*} to split loop-value at ";"
        set {_amount} to {_info::1} parsed as number
        if {_info::2} is "center":
            add {_center} to {_locations::*}
        else:
            set {_facing} to getDirection({_info::2})
            set {_block} to location at block {_amount} {_facing} of {_center}
            broadcast "&eBlock: &f%{_block}%"
            add {_block} to {_locations::*}
    return {_locations::*}
 
Shouldn't it be this?
Code:
set {_block} to block at [location] %location%
If not: Can you give us an example of usage? I'm not sure if I fully understand what do you want to get here.
 
Shouldn't it be this?
Code:
set {_block} to block at [location] %location%
If not: Can you give us an example of usage? I'm not sure if I fully understand what do you want to get here.

This is what I thought too.
 
Status
Not open for further replies.