Skript Version: 2.2-dev23
Skript Author: Bensku
Minecraft Version: 1.11.2
---
Full Code:
The variable "shared.%player%.lastdamaged" is set in another script:
Errors on Reload:
Other Useful Info:
Simply trying to reduce code reproduction in this script. Since I use the cooldown check in two different events it made sense to make a function of it so code would remain consistent if I changed the check.
Addons using (including versions):
SkQuery 3.5.5-Lime
MundoSK 1.7.4
Troubleshooting:
Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? Reverted my changes to an older copy of the script, went to bed, slept on it, and tried again... same result. Given the catchall "return true" at the end of the function and the fact that the function does not have a "stop" statement in it anywhere I have no idea how this function is returning null.
[doublepost=1486471467,1486469783][/doublepost]Oh god, don't tell me it was that simple...
Functions must be declared higher in the script that when they are used. I assumed since options were preprocessed on script load then functions would be too.
Skript Author: Bensku
Minecraft Version: 1.11.2
---
Full Code:
code_language.skript:
options:
bedClickSpeed: 1 second
homeCooldown: 15 minutes
dmgCooldown: 15 seconds
command /sethome:
description: Set your home
permission: skript.homes.sethome
executable by: players
trigger:
set {homes.%player%.location} to location of player
message "Your home has been set to <grey>%location of player%<reset>"
command /home:
description: Teleport yourself to your home
permission: skript.homes.home
executable by: players
trigger:
if {homes.%player%.location} is not set:
message "You have not set your home yet!"
stop trigger
if checkCD(player) is false:
stop
message "Going home..."
teleport player to {homes.%player%.location}
set {homes.%player%.lasthometp} to now
on rightclick on bed_block:
if player does not have permission "skript.homes.bedhome":
stop
#if player can use bedhome, disable standard bed behavior to keep usage consistent
cancel event
if {homes.%player%.firstclick} was more than {@bedClickSpeed}:
set {homes.%player%.firstclick} to now
stop
if player cannot build at the clicked block:
message "You cannot use this bed for your home."
stop
set {homes.%player%.location} to location of player
message "Your home has been set to this spot."
on respawn:
if player does not have permission "skript.homes.respawnhome":
stop
if {homes.%player%.location} does not exist:
message "You have not set a home! Using default respawn."
stop
teleport player to {homes.%player%.location}
#intercept multiverse spawn command and apply cooldown
on command "/mv":
if arguments is "spawn":
if checkCD(player) is false:
cancel event
stop
set {homes.%player%.lasthometp} to now
function checkCD(p: player) :: boolean:
if {_p} does not have permission "skript.homes.nocooldown":
if {shared.%{_p}%.lastdamaged} was less than {@dmgCooldown} ago:
message "You cannot flee while taking damage!" to {_p}
return false
if {homes.%{_p}%.lasthometp} was less than {@homeCooldown} ago:
set {_waited} to difference between {homes.%{_p}%.lasthometp} and now
message "You must wait %difference between {@homeCooldown} and {_waited}% before using this command again." to {_p}
return false
return true
The variable "shared.%player%.lastdamaged" is set in another script:
code_language.skript:
on damage of player:
set {shared.%victim%.lastdamaged} to now
Errors on Reload:
code_language.skript:
>skript reload homes.sk
[06:46:16 INFO]: [Skript] Reloading homes.sk...
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! [Skript] Severe Error:
[06:46:16 ERROR]: #!#! Could not load homes.sk
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[06:46:16 ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[06:46:16 ERROR]: #!#! and check whether this error has already been reported.
[06:46:16 ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[06:46:16 ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[06:46:16 ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[06:46:16 ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! Stack trace:
[06:46:16 ERROR]: #!#! ch.njol.skript.SkriptAPIException: Signature of function is null when return type is asked!
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.function.FunctionReference.getReturnType(FunctionReference.java:201)
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.function.ExprFunctionCall.getReturnType(ExprFunctionCall.java:56)
[06:46:16 ERROR]: #!#! at ch.njol.skript.conditions.CondCompare.init(CondCompare.java:172)
[06:46:16 ERROR]: #!#! at ch.njol.skript.conditions.CondCompare.init(CondCompare.java:132)
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:249)
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:176)
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.Condition.parse(Condition.java:83)
[06:46:16 ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:833)
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.TriggerSection.<init>(TriggerSection.java:56)
[06:46:16 ERROR]: #!#! at ch.njol.skript.lang.Conditional.<init>(Conditional.java:46)
[06:46:16 ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:840)
[06:46:16 ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:513)
[06:46:16 ERROR]: #!#! at ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:271)
[06:46:16 ERROR]: #!#! at ch.njol.skript.SkriptCommand.onCommand(SkriptCommand.java:167)
[06:46:16 ERROR]: #!#! at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
[06:46:16 ERROR]: #!#! at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
[06:46:16 ERROR]: #!#! at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:650)
[06:46:16 ERROR]: #!#! at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchServerCommand(CraftServer.java:636)
[06:46:16 ERROR]: #!#! at net.minecraft.server.v1_11_R1.DedicatedServer.aM(DedicatedServer.java:437)
[06:46:16 ERROR]: #!#! at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:400)
[06:46:16 ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675)
[06:46:16 ERROR]: #!#! at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574)
[06:46:16 ERROR]: #!#! at java.lang.Thread.run(Thread.java:745)
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! Version Information:
[06:46:16 ERROR]: #!#! Skript: 2.2-dev23
[06:46:16 ERROR]: #!#! Bukkit: 1.11.2-R0.1-SNAPSHOT
[06:46:16 ERROR]: #!#! Minecraft: 1.11.2
[06:46:16 ERROR]: #!#! Java: 1.8.0_121 (Java HotSpot(TM) 64-Bit Server VM 25.121-b13)
[06:46:16 ERROR]: #!#! OS: Linux amd64 3.13.0-107-generic
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! Running CraftBukkit: false
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! Current node: if checkCD(player) is false: (homes.sk, line 59)
[06:46:16 ERROR]: #!#! Current item: null
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! Thread: Server thread
[06:46:16 ERROR]: #!#!
[06:46:16 ERROR]: #!#! End of Error.
[06:46:16 ERROR]: #!#!
[06:46:16 INFO]: [Skript] Successfully reloaded homes.sk.
Other Useful Info:
Simply trying to reduce code reproduction in this script. Since I use the cooldown check in two different events it made sense to make a function of it so code would remain consistent if I changed the check.
Addons using (including versions):
SkQuery 3.5.5-Lime
MundoSK 1.7.4
Troubleshooting:
Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? Reverted my changes to an older copy of the script, went to bed, slept on it, and tried again... same result. Given the catchall "return true" at the end of the function and the fact that the function does not have a "stop" statement in it anywhere I have no idea how this function is returning null.
[doublepost=1486471467,1486469783][/doublepost]Oh god, don't tell me it was that simple...
Functions must be declared higher in the script that when they are used. I assumed since options were preprocessed on script load then functions would be too.