Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skript error - default world in location function #1465

Closed
itsTurnip opened this issue Aug 13, 2018 · 6 comments
Closed

Skript error - default world in location function #1465

itsTurnip opened this issue Aug 13, 2018 · 6 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@itsTurnip
Copy link

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
@ShaneBeee
Copy link
Contributor

ShaneBeee commented Aug 13, 2018

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

@itsTurnip
Copy link
Author

Everything works right now. Thanks @ShaneBeee for help.

@Pikachu920 Pikachu920 reopened this Aug 13, 2018
@Pikachu920
Copy link
Member

it should parse error, though

@Nicofisi
Copy link
Member

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)

Functions.registerFunction(new JavaFunction<Location>("location", new Parameter[] {
new Parameter<>("x", numberClass, true, null), new Parameter<>("y", numberClass, true, null), new Parameter<>("z", numberClass, true, null),
new Parameter<>("world", Classes.getExactClassInfo(World.class), true, new EventValueExpression<>(World.class)),
new Parameter<>("yaw", numberClass, true, new SimpleLiteral<Number>(0, true)), new Parameter<>("pitch", numberClass, true, new SimpleLiteral<Number>(0, true))

@bensku bensku added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Aug 13, 2018
@Duetro
Copy link

Duetro commented Aug 15, 2018

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

@Whimsyturtle
Copy link
Member

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

@ShaneBeee ShaneBeee changed the title Skript error Skript error - default world in location function Aug 6, 2020
@ShaneBeee ShaneBeee added the completed The issue has been fully resolved and the change will be in the next Skript update. label Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

7 participants