Return function across 2 sk files

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Jordan

Member
Jan 25, 2017
190
12
18
25
Scotland
So not to sure if this is a bug or not but i'm unable to return a function over 2 skript files, i can access the function fine if it does not return anything however if i try get it to return something across 2 files it'll give me an error like this

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

If i try return the function in the same file it's created in then it works however if i try return it in a different file to where it's created it will return this error, here's my skript.

File1.sk
code_language.skript:
on skript load:
    set mysql host to "localhost" # Connecting to MYSQL database to update server status
    set mysql username to "root"
    set mysql password to "jordan1"
    set mysql database to "RebornEncrypt"
    set {_GetServerID} to yml value "ServerID" of file "plugins/Reborn/Config.yml"
    skellett connect to mysql
    mysql update "UPDATE Servers SET Status='Avaliable' WHERE ServerID='%{_GetServerID}%'"

      
function CheckServerStatus(s: string) :: string:
    set {_s} to yml value "ServerID" of file "plugins/Reborn/Config.yml"
    set {_result} to mysql result of query "SELECT Status FROM servers WHERE ServerID='%{_s}%'"
    set {_s::*} to mysql string "Status" in {_result}
    return {_s::1}

File2.sk
code_language.skript:
on join:
    set {_temp} to CheckServerStatus("Check")

Also note if it wasn't clear, File1 loads before File2 so it's not a matter of the function not loading.
 
Last edited:
I don't know how the mySQL stuff of Skellett works but the function only executes that code and unless the connection you did in the File1.sk is globally for all scripts you'll have todo it in the File2.sk too
 
I don't know how the mySQL stuff of Skellett works but the function only executes that code and unless the connection you did in the File1.sk is globally for all scripts you'll have todo it in the File2.sk too
I've also tried making the connection in File2 and it's the same result. I've also removed all the sql stuff and just tried to return a simple "Hello" string and i get the same result.
 
That's a weird issue then, can you show your version of Skript and of your server?
code_language.skript:
[15:12:23] [Server thread/ERROR]: #!#! Version Information:
[15:12:23] [Server thread/ERROR]: #!#!   Skript: 2.2-dev23
[15:12:23] [Server thread/ERROR]: #!#!   Bukkit: 1.10.2-R0.1-SNAPSHOT
[15:12:23] [Server thread/ERROR]: #!#!   Minecraft: 1.10.2
 
Hmm works on a fresh server with only skript installed, so either a problem with skelletts SQL or skquery's functions
skQuery functions wouldn't be a problem such as the Skript ones override them, it's either an issue trying to connect to the database or something, can you show me the full stack trace (console error) anyways?
 
As a suggestion, look at which script is loading first.

Bensku's 2.2-dev23 seems to load scripts in alphabetical order. And functions must be declared before they are used. Thus if the script the function is declared in is loading after the script it is being called in you will receive this error.
 
Status
Not open for further replies.