Variables cannot be used here

  • 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 community!

    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!

AQika

Member
Jun 28, 2023
31
3
8
I'm trying to make a funny minigame but i can't use variables here? I have the latest version of skript and Skbee on 1.21.1
Code:
function getPillarlocation():
    loop 3 times:
        set {_x} to random integer between -50 and 50
        set {_y} to random integer between 50 and 60
        set {_z} to random integer between -50 and 50
        set {_location} to location at {_x}, {_y}, {_z} in world "void"
        set {_yFiller} to -65
        set {_filler} to location at {_x}, {_yFiller}, {_z} in world "void"
        while {_filler} is not {_location}:
            set block at {_filler} to bedrock
            set {_yFiller} to {_yFiller} + 1
            set {_filler} to location at {_x},{_yFiller}, {_z} in world "void"

command /pillar <text>:
    permission: op
    trigger:
        if arg-1 is set:
            if arg-1 is "start":
                getPillarlocation()
 
Hello, sorry, i don't really understand what you try to do here.

I debug a lot with "broadcast" or send %{_variable}% to AQika

example:
set {_x} to random integer between -50 and 50
broadcast {_x}

set {_location} to location at {_x}, {_y}, {_z} in world "void"
broadcast {_location}

in a command trigger you can use:
set {_location} to player's location
broadcast {_location} #To understand how a location variable looks like, i don't know if it's wrong yours

if a variable is empty but need to have something in it, try to add "wait 1 tick" between "set {_variable} to something" and where you use that variable ("broadcast {_variable}")
 
Hello, sorry, i don't really understand what you try to do here.

I debug a lot with "broadcast" or send %{_variable}% to AQika

example:
set {_x} to random integer between -50 and 50
broadcast {_x}

set {_location} to location at {_x}, {_y}, {_z} in world "void"
broadcast {_location}

in a command trigger you can use:
set {_location} to player's location
broadcast {_location} #To understand how a location variable looks like, i don't know if it's wrong yours

if a variable is empty but need to have something in it, try to add "wait 1 tick" between "set {_variable} to something" and where you use that variable ("broadcast {_variable}")
Yes this helped me find the fix to my issue, it was that it didn't give any error, just when i tried running, for anybody else having this issue make sure you put spaces between commas for some reason? This is what worked for me!
 
  • Like
Reactions: SebyHas