Skript: Function error on load

Created on 31 Jul 2017  路  7Comments  路  Source: SkriptLang/Skript

When two scripts are loaded, I get this error twice:

[Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException: Signature of function is null when return type is asked!

Full error:

[13:41:35] [Server thread/ERROR]: #!#!
--
[13:41:35] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[13:41:35] [Server thread/ERROR]: #!#! Could not load buybonusplots.sk
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[13:41:35] [Server thread/ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[13:41:35] [Server thread/ERROR]: #!#! and check whether this error has already been reported.
[13:41:35] [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),
[13:41:35] [Server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[13:41:35] [Server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[13:41:35] [Server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! Stack trace:
[13:41:35] [Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException: Signature of function is null when return type is asked!
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.FunctionReference.getReturnType(FunctionReference.java:199)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.ExprFunctionCall.getReturnType(ExprFunctionCall.java:54)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.effects.EffChange.init(EffChange.java:206)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:247)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:174)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Statement.parse(Statement.java:59)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:659)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.command.Commands.loadCommand(Commands.java:465)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:409)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:243)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:200)
[13:41:35] [Server thread/ERROR]: #!#! at ch.njol.skript.Skript$2.run(Skript.java:405)
[13:41:35] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58)
[13:41:35] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356)
[13:41:35] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832)
[13:41:35] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423)
[13:41:35] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766)
[13:41:35] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664)
[13:41:35] [Server thread/ERROR]: #!#! at java.lang.Thread.run(Thread.java:748)
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! Version Information:
[13:41:35] [Server thread/ERROR]: #!#! Skript: 2.2-dev29
[13:41:35] [Server thread/ERROR]: #!#! Bukkit: 1.12-R0.1-SNAPSHOT
[13:41:35] [Server thread/ERROR]: #!#! Minecraft: 1.12
[13:41:35] [Server thread/ERROR]: #!#! Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[13:41:35] [Server thread/ERROR]: #!#! OS: Linux amd64 3.2.0-4-amd64
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! Current node: set {_bbptown} to townOfPlayer(player) (buybonusplots.sk, line 92)
[13:41:35] [Server thread/ERROR]: #!#! Current item: null
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! Thread: Server thread
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:35] [Server thread/ERROR]: #!#! End of Error.
[13:41:35] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#!
--
[13:41:41] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[13:41:41] [Server thread/ERROR]: #!#! Could not load sethomelimiter.sk
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[13:41:41] [Server thread/ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[13:41:41] [Server thread/ERROR]: #!#! and check whether this error has already been reported.
[13:41:41] [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),
[13:41:41] [Server thread/ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[13:41:41] [Server thread/ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[13:41:41] [Server thread/ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! Stack trace:
[13:41:41] [Server thread/ERROR]: #!#! ch.njol.skript.SkriptAPIException: Signature of function is null when return type is asked!
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.FunctionReference.getReturnType(FunctionReference.java:199)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.function.ExprFunctionCall.getReturnType(ExprFunctionCall.java:54)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.effects.EffChange.init(EffChange.java:206)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:247)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:174)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.lang.Statement.parse(Statement.java:59)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:659)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:450)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:243)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:200)
[13:41:41] [Server thread/ERROR]: #!#! at ch.njol.skript.Skript$2.run(Skript.java:405)
[13:41:41] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58)
[13:41:41] [Server thread/ERROR]: #!#! at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356)
[13:41:41] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832)
[13:41:41] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423)
[13:41:41] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766)
[13:41:41] [Server thread/ERROR]: #!#! at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664)
[13:41:41] [Server thread/ERROR]: #!#! at java.lang.Thread.run(Thread.java:748)
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! Version Information:
[13:41:41] [Server thread/ERROR]: #!#! Skript: 2.2-dev29
[13:41:41] [Server thread/ERROR]: #!#! Bukkit: 1.12-R0.1-SNAPSHOT
[13:41:41] [Server thread/ERROR]: #!#! Minecraft: 1.12
[13:41:41] [Server thread/ERROR]: #!#! Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[13:41:41] [Server thread/ERROR]: #!#! OS: Linux amd64 3.2.0-4-amd64
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! Current node: set {_townAtLoc} to townAtLocation(player's location) (sethomelimiter.sk, line 2)
[13:41:41] [Server thread/ERROR]: #!#! Current item: null
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! Thread: Server thread
[13:41:41] [Server thread/ERROR]: #!#!
[13:41:41] [Server thread/ERROR]: #!#! End of Error.
[13:41:41] [Server thread/ERROR]: #!#!

These two scripts rely on functions defined in another script that doesn't seem to be loaded yet. When I reload or enable these scripts afterwards, they load without a problem.

As a workaround, I could either rename these scripts so that they are loaded later, or ignore the errors and force the functions script, on load, to reload the scripts that depend on it. However, I don't like either of these options, as they both seem hack-ish and would make it difficult for me to share my functions script with others. This could also become a mess if I write scripts that rely on functions from more than one script.

I think it would be ideal if functions loaded first. If that's not possible, I suggest implementing optional "import

All 7 comments

Function signatures are loaded first, and I just fixed a bug which caused it sometimes not to work. Might fix this :)

Ok, try with dev30. Interested to hear if it got fixed.

Sadly, it doesn't seem fixed. However, I received different errors when I start the server now (for the same scripts that use functions, about the same functions):

[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[00:59:39] [Server thread/ERROR]: #!#! Could not load buybonusplots.sk
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! Something went horribly wrong with Skript.
[00:59:39] [Server thread/ERROR]: #!#! This issue is NOT your fault! You can't probably fix it yourself, either.
[00:59:39] [Server thread/ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[00:59:39] [Server thread/ERROR]: #!#! Here is full list of them:
[00:59:39] [Server thread/ERROR]: #!#! BetonQuest (https://www.spigotmc.org/resources/betonquest.2117/) skRayFall (http://sk.rayfall.net/) skUtilities (https://tim740.github.io/) SkQuery Skellett (https://forums.skunity.com/resources/skellett-the-addon-with-a-beast-name.24/) sKeeland 
[00:59:39] [Server thread/ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[00:59:39] [Server thread/ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[00:59:39] [Server thread/ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[00:59:39] [Server thread/ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[00:59:39] [Server thread/ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[00:59:39] [Server thread/ERROR]: #!#! Only if the author tells you to do so, report it as Skript issue (url below)
[00:59:39] [Server thread/ERROR]: #!#! Issue tracker: https://github.com/bensku/Skript/issues (only if you know what you're doing!)
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! Stack trace:
[00:59:39] [Server thread/ERROR]: #!#! java.lang.NullPointerException
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.Functions.registerCaller(Functions.java:96)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.FunctionReference.validateFunction(FunctionReference.java:167)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseFunction(SkriptParser.java:1130)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseSingleExpr(SkriptParser.java:306)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseExpression(SkriptParser.java:615)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.VariableString.newInstance(VariableString.java:240)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.VariableString.newInstance(VariableString.java:144)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseSingleExpr(SkriptParser.java:487)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseExpression(SkriptParser.java:800)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1509)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1505)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:221)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Statement.parse(Statement.java:59)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:842)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.command.Commands.loadCommand(Commands.java:471)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:526)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$1(ScriptLoader.java:333)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:345)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$0(ScriptLoader.java:275)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:305)
[00:59:39] [Server thread/ERROR]: #!#!     at ch.njol.skript.Skript$2.run(Skript.java:410)
[00:59:39] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58)
[00:59:39] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356)
[00:59:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832)
[00:59:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423)
[00:59:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766)
[00:59:39] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664)
[00:59:39] [Server thread/ERROR]: #!#!     at java.lang.Thread.run(Thread.java:748)
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! Version Information:
[00:59:39] [Server thread/ERROR]: #!#!   Skript: 2.2-dev30b
[00:59:39] [Server thread/ERROR]: #!#!   Bukkit: 1.12-R0.1-SNAPSHOT
[00:59:39] [Server thread/ERROR]: #!#!   Minecraft: 1.12
[00:59:39] [Server thread/ERROR]: #!#!   Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[00:59:39] [Server thread/ERROR]: #!#!   OS: Linux amd64 3.2.0-4-amd64
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[00:59:39] [Server thread/ERROR]: #!#! Running Spigot (or compatible): true
[00:59:39] [Server thread/ERROR]: #!#! Running Paper (or compatible): true
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! Current node: set {_bbptown} to "%townOfPlayer(player)%" (buybonusplots.sk, line 13)
[00:59:39] [Server thread/ERROR]: #!#! Current item: null
[00:59:39] [Server thread/ERROR]: #!#! Thread: Server thread
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! Language: english
[00:59:39] [Server thread/ERROR]: #!#! Link parse mode: DISABLED
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:39] [Server thread/ERROR]: #!#! End of Error.
[00:59:39] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[00:59:47] [Server thread/ERROR]: #!#! Could not load sethomelimiter.sk
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! Something went horribly wrong with Skript.
[00:59:47] [Server thread/ERROR]: #!#! This issue is NOT your fault! You can't probably fix it yourself, either.
[00:59:47] [Server thread/ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[00:59:47] [Server thread/ERROR]: #!#! Here is full list of them:
[00:59:47] [Server thread/ERROR]: #!#! BetonQuest (https://www.spigotmc.org/resources/betonquest.2117/) skRayFall (http://sk.rayfall.net/) skUtilities (https://tim740.github.io/) SkQuery Skellett (https://forums.skunity.com/resources/skellett-the-addon-with-a-beast-name.24/) sKeeland 
[00:59:47] [Server thread/ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[00:59:47] [Server thread/ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[00:59:47] [Server thread/ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[00:59:47] [Server thread/ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[00:59:47] [Server thread/ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[00:59:47] [Server thread/ERROR]: #!#! Only if the author tells you to do so, report it as Skript issue (url below)
[00:59:47] [Server thread/ERROR]: #!#! Issue tracker: https://github.com/bensku/Skript/issues (only if you know what you're doing!)
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! Stack trace:
[00:59:47] [Server thread/ERROR]: #!#! java.lang.NullPointerException
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.Functions.registerCaller(Functions.java:96)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.FunctionReference.validateFunction(FunctionReference.java:167)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseFunction(SkriptParser.java:1130)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseSingleExpr(SkriptParser.java:474)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseExpression(SkriptParser.java:800)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1509)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1505)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:221)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Statement.parse(Statement.java:59)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:842)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:567)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$1(ScriptLoader.java:333)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:345)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$0(ScriptLoader.java:275)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:305)
[00:59:47] [Server thread/ERROR]: #!#!     at ch.njol.skript.Skript$2.run(Skript.java:410)
[00:59:47] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58)
[00:59:47] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356)
[00:59:47] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832)
[00:59:47] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423)
[00:59:47] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766)
[00:59:47] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664)
[00:59:47] [Server thread/ERROR]: #!#!     at java.lang.Thread.run(Thread.java:748)
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! Version Information:
[00:59:47] [Server thread/ERROR]: #!#!   Skript: 2.2-dev30b
[00:59:47] [Server thread/ERROR]: #!#!   Bukkit: 1.12-R0.1-SNAPSHOT
[00:59:47] [Server thread/ERROR]: #!#!   Minecraft: 1.12
[00:59:47] [Server thread/ERROR]: #!#!   Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[00:59:47] [Server thread/ERROR]: #!#!   OS: Linux amd64 3.2.0-4-amd64
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[00:59:47] [Server thread/ERROR]: #!#! Running Spigot (or compatible): true
[00:59:47] [Server thread/ERROR]: #!#! Running Paper (or compatible): true
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! Current node: set {_townAtLoc} to townAtLocation(player's location) (sethomelimiter.sk, line 2)
[00:59:47] [Server thread/ERROR]: #!#! Current item: null
[00:59:47] [Server thread/ERROR]: #!#! Thread: Server thread
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! Language: english
[00:59:47] [Server thread/ERROR]: #!#! Link parse mode: DISABLED
[00:59:47] [Server thread/ERROR]: #!#! 
[00:59:47] [Server thread/ERROR]: #!#! End of Error.
[00:59:47] [Server thread/ERROR]: #!#! 

Maybe it's possible that the issue is caused by an addon (as the scripts require SkQuery) or another plugin, so I can try editing the scripts and testing on a fresh server later if you like.

Okay, I went ahead and tried it with two test scripts on a fresh server with Skript as the only plugin:

abc.sk

command /abcIt [<string>]:
    executable by: console
    trigger:
        send test(arg 1) to console

testfunction.sk

function test(s: string) :: string:
    return "abc %{_s}% abc"
[00:36:45] [Server thread/INFO]: [Skript] Loading variables...
[00:36:45] [Server thread/INFO]: [Skript] Loaded 0 variables in 0.0 seconds
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! [Skript] Severe Error:
[00:36:45] [Server thread/ERROR]: #!#! Could not load abc.sk
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! Something went horribly wrong with Skript.
[00:36:45] [Server thread/ERROR]: #!#! This issue is NOT your fault! You can't probably fix it yourself, either.
[00:36:45] [Server thread/ERROR]: #!#! You should report it at https://github.com/bensku/Skript/issues. Please copy paste this report there (or use paste service).
[00:36:45] [Server thread/ERROR]: #!#! This ensures that your issue is noticed and will be fixed as soon as possible.
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! Stack trace:
[00:36:45] [Server thread/ERROR]: #!#! java.lang.NullPointerException
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.Functions.registerCaller(Functions.java:96)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.function.FunctionReference.validateFunction(FunctionReference.java:167)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseFunction(SkriptParser.java:1130)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseSingleExpr(SkriptParser.java:474)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parseExpression(SkriptParser.java:800)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1509)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1439)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1466)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:221)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.lang.Statement.parse(Statement.java:59)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:842)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.command.Commands.loadCommand(Commands.java:471)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:526)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$1(ScriptLoader.java:333)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:345)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.lambda$0(ScriptLoader.java:275)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:305)
[00:36:45] [Server thread/ERROR]: #!#!     at ch.njol.skript.Skript$2.run(Skript.java:410)
[00:36:45] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:58)
[00:36:45] [Server thread/ERROR]: #!#!     at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:356)
[00:36:45] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:832)
[00:36:45] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423)
[00:36:45] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:766)
[00:36:45] [Server thread/ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:664)
[00:36:45] [Server thread/ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! Version Information:
[00:36:45] [Server thread/ERROR]: #!#!   Skript: 2.2-dev30b
[00:36:45] [Server thread/ERROR]: #!#!   Bukkit: 1.12-R0.1-SNAPSHOT
[00:36:45] [Server thread/ERROR]: #!#!   Minecraft: 1.12
[00:36:45] [Server thread/ERROR]: #!#!   Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[00:36:45] [Server thread/ERROR]: #!#!   OS: Windows 10 amd64 10.0
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! Running CraftBukkit: false
[00:36:45] [Server thread/ERROR]: #!#! Running Spigot (or compatible): true
[00:36:45] [Server thread/ERROR]: #!#! Running Paper (or compatible): true
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! Current node: send test(arg 1) to console (abc.sk, line 4)
[00:36:45] [Server thread/ERROR]: #!#! Current item: null
[00:36:45] [Server thread/ERROR]: #!#! Thread: Server thread
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! Language: english
[00:36:45] [Server thread/ERROR]: #!#! Link parse mode: DISABLED
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/ERROR]: #!#! End of Error.
[00:36:45] [Server thread/ERROR]: #!#! 
[00:36:45] [Server thread/INFO]: [Skript] All scripts loaded without errors.
[00:36:45] [Server thread/INFO]: [Skript] Loaded 2 scripts with a total of 0 triggers and 0 commands in 0.2 seconds
[00:36:45] [Server thread/INFO]: [Skript] Finished loading.
[00:36:52] [Server thread/INFO]: Unknown command. Type "/help" for help.
[00:36:56] [Server thread/INFO]: [Skript] Reloading abc.sk...
[00:36:56] [Server thread/INFO]: [Skript] Successfully reloaded abc.sk.
[00:36:59] [Server thread/INFO]: abc hello abc
[00:36:59] [Server thread/INFO]: Unknown command. Type "/help" for help.

It's because of the loading order, put 1_ in the testfunctions.sk name and it'll not throw errors.

As a workaround, I could either rename these scripts so that they are loaded later, or ignore the errors and force the functions script, on load, to reload the scripts that depend on it. However, I don't like either of these options, as they both seem hack-ish and would make it difficult for me to share my functions script with others. This could also become a mess if I write scripts that rely on functions from more than one script.

I think it would be ideal if functions loaded first. If that's not possible, I suggest implementing optional "import

Related issues

MrScopes picture MrScopes  路  3Comments

ghost picture ghost  路  3Comments

GiraffeCubed picture GiraffeCubed  路  3Comments

DeagoTheDoggo picture DeagoTheDoggo  路  3Comments

cyanide43 picture cyanide43  路  4Comments