Repository: SkriptLang/Skript

Issue #575: Can't find difference between Date and Timespan
Created: 2017-05-18T23:39:06Z
So I am trying to make some scripts but I keep running into errors and it fails to load anything.
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[01:19:46] [Server thread/ERROR]: #!#! Could not load Smash.sk
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[01:19:46] [Server thread/ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[01:19:46] [Server thread/ERROR]: #!#! and check whether this error has already been reported.
[01:19:46] [Server thread/ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[01:19:46] [Server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[01:19:46] [Server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[01:19:46] [Server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! Stack trace:
[01:19:46] [Server thread/ERROR]: #!#! java.lang.NullPointerException
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.expressions.ExprDifference.init(ExprDifference.java:104)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:247)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:174)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parseSingleExpr(SkriptParser.java:319)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parseExpression(SkriptParser.java:445)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1159)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1150)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:219)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:174)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Statement.parse(Statement.java:59)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:753)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.TriggerSection.(TriggerSection.java:54)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Conditional.(Conditional.java:44)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:839)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:510)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:245)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:199)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.Skript.reload(Skript.java:722)
[01:19:46] [Server thread/ERROR]: #!#! at ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:159)
[01:19:46] [Server thread/ERROR]: #!#! at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[01:19:46] [Server thread/ERROR]: #!#! at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
[01:19:46] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:650)
[01:19:46] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchServerCommand(CraftServer.java:636)
[01:19:46] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.DedicatedServer.aM(DedicatedServer.java:437)
[01:19:46] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:400)
[01:19:46] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678)
[01:19:46] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576)
[01:19:46] [Server thread/ERROR]: #!#! at java.lang.Thread.run(Thread.java:745)
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! Version Information:
[01:19:46] [Server thread/ERROR]: #!#! Skript: 2.2-dev27
[01:19:46] [Server thread/ERROR]: #!#! Bukkit: 1.11.2-R0.1-SNAPSHOT
[01:19:46] [Server thread/ERROR]: #!#! Minecraft: 1.11.2
[01:19:46] [Server thread/ERROR]: #!#! Java: 1.8.0_74 (Java HotSpot(TM) 64-Bit Server VM 25.74-b02)
[01:19:46] [Server thread/ERROR]: #!#! OS: Linux amd64 3.10.23-xxxx-std-ipv6-64
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! Current node: set {_dash} to difference between {dash.%player%} and now (Smash.sk, line 3)
[01:19:46] [Server thread/ERROR]: #!#! Current item: null
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! Thread: Server thread
[01:19:46] [Server thread/ERROR]: #!#!
[01:19:46] [Server thread/ERROR]: #!#! End of Error.
[01:19:46] [Server thread/ERROR]: #!#!
Is there anything that I am doing wrong that I just don't know of?

Duplicate issue #3868: Error with loop-value in functions
Created: 2021-03-30T04:58:32Z
function getClosestNumberIndex(number: number, numbers: numbers) :: number:
	loop {_numbers::*}:
		add 1 to {_loop}
		if {_closest} is not set:
			set {_difference} to difference between loop-value and {_number}
			set {_closest} to loop-value
			set {_return} to {_loop}
			continue
		difference between {_closest} and {_number} is less than {_difference}
		set {_difference} to difference between loop-value and {_number}
		set {_closest} to loop-value
		set {_return} to {_loop}
	return {_return}
[22:55:41 ERROR]: #!#! Stack trace:
[22:55:41 ERROR]: #!#! java.lang.NullPointerException
[22:55:41 ERROR]: #!#!     at java.lang.Class.isAssignableFrom(Native Method)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseSingleExpr(SkriptParser.java:512)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseExpression(SkriptParser.java:839)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1568)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1564)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:223)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:178)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.Statement.parse(Statement.java:58)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1030)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.TriggerSection.<init>(TriggerSection.java:53)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.Conditional.<init>(Conditional.java:43)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1117)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.Loop.<init>(Loop.java:65)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1067)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.function.ScriptFunction.<init>(ScriptFunction.java:45)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.lang.function.Functions.loadFunction(Functions.java:146)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:650)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$4(ScriptLoader.java:401)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:420)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:464)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.ScriptLoader.reloadScript(ScriptLoader.java:976)
[22:55:41 ERROR]: #!#!     at ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:185)
[22:55:41 ERROR]: #!#!     at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[22:55:41 ERROR]: #!#!     at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[22:55:41 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:810)
[22:55:41 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchServerCommand(CraftServer.java:772)
[22:55:41 ERROR]: #!#!     at net.minecraft.server.v1_16_R3.DedicatedServer.handleCommandQueue(DedicatedServer.java:452)
[22:55:41 ERROR]: #!#!     at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:419)
[22:55:41 ERROR]: #!#!     at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1328)
[22:55:41 ERROR]: #!#!     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1116)
[22:55:41 ERROR]: #!#!     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289)
[22:55:41 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[22:55:41 ERROR]: #!#!
[22:55:41 ERROR]: #!#! Version Information:
[22:55:41 ERROR]: #!#!   Skript: 2.5.3 (latest)
[22:55:41 ERROR]: #!#!     Flavor: skriptlang-github
[22:55:41 ERROR]: #!#!     Date: 2020-12-11
[22:55:41 ERROR]: #!#!   Bukkit: 1.16.5-R0.1-SNAPSHOT
[22:55:41 ERROR]: #!#!   Minecraft: 1.16.5
[22:55:41 ERROR]: #!#!   Java: 1.8.0_161 (Java HotSpot(TM) 64-Bit Server VM 25.161-b12)
[22:55:41 ERROR]: #!#!   OS: Windows 10 amd64 10.0
[22:55:41 ERROR]: #!#!
[22:55:41 ERROR]: #!#! Server platform: Paper
[22:55:41 ERROR]: #!#!
[22:55:41 ERROR]: #!#! Current node: set {_difference} to difference between loop-value and {_number} (d.sk, line 12)
[22:55:41 ERROR]: #!#! Current item: null
[22:55:41 ERROR]: #!#!
[22:55:41 ERROR]: #!#! Thread: Server thread
[22:55:41 ERROR]: #!#!
[22:55:41 ERROR]: #!#! Language: english
[22:55:41 ERROR]: #!#! Link parse mode: DISABLED
[22:55:41 ERROR]: #!#!
[22:55:41 ERROR]: #!#! End of Error.

Closing comment (2021-03-30T07:59:17Z): Duplicate of #575 / #661 / #994 / #1001 / #2302