Skript error - default world in location function

Created on 13 Aug 2018  ·  6Comments  ·  Source: SkriptLang/Skript

Hi. I got this error while making new skript:

`[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Something went horribly wrong with Skript.
[07:33:39] [Server thread/ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[07:33:39] [Server thread/ERROR]: #!#! You should report it at https://github.com/SkriptLang/Skript/issues. Please copy paste this report there (or use paste service).
[07:33:39] [Server thread/ERROR]: #!#! This ensures that your issue is noticed and will be fixed as soon as possible.
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Stack trace:
[07:33:39] [Server thread/ERROR]: #!#! java.lang.ArrayIndexOutOfBoundsException: 0
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.classes.data.DefaultFunctions$23.execute(DefaultFunctions.java:314)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.classes.data.DefaultFunctions$23.execute(DefaultFunctions.java:1)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.Function.execute(Function.java:119)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.FunctionReference.execute(FunctionReference.java:204)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.ExprFunctionCall.get(ExprFunctionCall.java:44)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:102)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.util.Direction$1.get(Direction.java:387)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.util.Direction$1.get(Direction.java:1)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:102)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getSingle(SimpleExpression.java:60)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.effects.EffTeleport.execute(EffTeleport.java:72)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:52)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[07:33:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.effects.Delay$1.run(Delay.java:109)
[07:33:39] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76)
[07:33:39] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:361)
[07:33:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739)
[07:33:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406)
[07:33:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679)
[07:33:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577)
[07:33:39] [Server thread/ERROR]: #!#!     at java.lang.Thread.run(Thread.java:748)
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Version Information:
[07:33:39] [Server thread/ERROR]: #!#!   Skript: 2.2-dev37c (latest)
[07:33:39] [Server thread/ERROR]: #!#!   Bukkit: 1.12.2-R0.1-SNAPSHOT
[07:33:39] [Server thread/ERROR]: #!#!   Minecraft: 1.12.2
[07:33:39] [Server thread/ERROR]: #!#!   Java: 1.8.0_161 (Java HotSpot(TM) 64-Bit Server VM 25.161-b12)
[07:33:39] [Server thread/ERROR]: #!#!   OS: Linux amd64 4.9.58-xxxx-std-ipv6-64
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Server platform: Spigot
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Current node: null
[07:33:39] [Server thread/ERROR]: #!#! Current item: teleport loop-player to [[direction:at]] location([[long:-210]], [[long:229]], [[long:10126]])
[07:33:39] [Server thread/ERROR]: #!#! Current trigger: command /tntrun (simple event) (tntrun.sk, line -1)
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Thread: Server thread
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! Language: english
[07:33:39] [Server thread/ERROR]: #!#! Link parse mode: DISABLED
[07:33:39] [Server thread/ERROR]: #!#! 
[07:33:39] [Server thread/ERROR]: #!#! End of Error.
[07:33:39] [Server thread/ERROR]: #!#! 

My tntrun.sk is here:

options:
    arena: location(-210, 229, 10126)
    lobby: location(-210, 247, 10126)
    level1: tnt_level1
    level2: tnt_level2
    death: tnt_death
    prefix: <orange>[<red>TNTRUN<orange>]<reset>

function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false

on load:
    set {players_left} to 0
    set {ingame} to false

command /tntrun <text>:
    description: Команда для TNTRun
    trigger:
        arg-1 = "join":
            if {ingame} is false:
                #if contains(players_playing, command sender) is false:
                if {players_playing::*} contains command sender:
                    stop trigger
                add command sender to {players_playing::*}
                add 1 to {players_left}
                message "{@prefix} <lime>Вы присоединились к TNTRun. Игры ожидают %{players_left}%."
                message "{@prefix} <orange>Ожидайте начала игры."

        arg-1 = "leave":
            if {ingame} is false:
                #if contains(players_playing, command sender) is true:
                if {players_playing::*} contains command sender:
                    remove command sender from {players_playing::*}
                    add -1 to {players_left}
                    message "{@prefix} <lime>Вы вышли из игры."

        arg-1 = "start":
            if command sender has permission "tntrun.start":
                if {players_left} is more than 0:
                    loop all blocks in region "{@level1}":
                        if loop-block is not concrete:
                            set loop-block to concrete
                    loop all blocks in region "{@level2}":
                        if loop-block is not concrete:
                            set loop-block to concrete
                    set {_time} to 5
                    while {_time} is more than 0:
                        message "{@prefix} <yellow> Игра начнется через %{_time}% сек."
                        remove 1 from {_time}
                        wait 1 second
                    loop all players:
                        if {players_playing::*} contains player:
                            message "{@prefix} <lime>Телепортирую..." to loop-player
                            teleport loop-player to {@arena}
                    set {ingame} to true

        arg-1 = "reset":
            if command sender has permission "tntrun.reset":
                set {players_left} to 0
                clear {players_playing::*}
                set {ingame} to false
                message "Success"

        arg-1 = "playing":
            message "%{players_left}%"
            message "%{players_playing::*}%"

on quit:
    if {players_playing::*} contains player:
        remove player from {players_playing::*}
        remove 1 from {players_left}

on region enter:
    if "%region%" = "{@death} in world world":
        if {players_playing::*} contains player:
            add -1 to {players_left}
            remove player from {players_playing::*}
            message "{@prefix} &cВы проиграли!"
            teleport event-player to {@lobby}
            if {players_left} = 1:
                loop {players_playing::*}:
                    broadcast "{@prefix}%loop-value% - победитель!"
                    message "{@prefix} Вы победили!" to loop-value
                    teleport loop-value to {@lobby}
                set {players_left} to 0
                clear {players_playing::*}
                set {ingame} to false

on step on concrete:
    if {ingame} is true:
        if {players_playing::*} contains player:
            wait 4 ticks
            set event-block to air
bug low

Most helpful comment

it should parse error, though

All 6 comments

Okay so I tried this 100 times and the problem is because you don't have "world" in your location function. So just set your location function up in your options there to something like this
location(100, 100, 100, world) <--- that will tp them to that location in the world they are in
location(100, 100, 100, world "world") <---- That will tp them to that specific world

Everything works right now. Thanks @ShaneBeee for help.

it should parse error, though

I assume this is supposed to be the event-world by default? Parameter def for the fourth function argument is is new EventValueExpression<>(World.class)
https://github.com/SkriptLang/Skript/blob/d77935ba34e5e21ec414db159fe2afb610e9e3d0/src/main/java/ch/njol/skript/classes/data/DefaultFunctions.java#L307-L310

We are getting the same error on load:
set {-ortungszonen.location::%loop-index%} to location({_split::1} parsed as number, {_split::2} parsed as number, {_split::3} parsed as number, world("world"))

Error: https://pastebin.com/Vc4b6f8K

From #1767:
"EventValueExpression is used to default to event-world, but it isn't properly initialized and will always return null. Unfortunately, initializing it would require a current even in Skript loader, which isn't available for default functions." - bensku

Was this page helpful?
0 / 5 - 0 ratings