Skripts stop reloading properly

  • 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.

Wynnevir

Well-Known Member
Jul 9, 2017
1,015
62
48
30
Elsewhere
I've had a problem lately, specifically with my functions script, where after maybe 2 or 3 reloads it will say it reloaded but doesn't. The changes are saved in the configuration but do not reflect in game. I have to restart the server to get it to take effect. This seems to only happen with my functions.
These are simple changes I'm reloading for, like setting test messages to troubleshoot or changing colors of text.
I'm on MC spigot 1.12
Skript Bensku's fork 2.2 dev 29.

Just for visual's sake this is one of the functions I just changed
52c5e50fdc.png

And even though I saved and reloaded it's still sending the old test messages
4f91addd61.jpg
 
I've had a problem lately, specifically with my functions script, where after maybe 2 or 3 reloads it will say it reloaded but doesn't. The changes are saved in the configuration but do not reflect in game. I have to restart the server to get it to take effect. This seems to only happen with my functions.
These are simple changes I'm reloading for, like setting test messages to troubleshoot or changing colors of text.
I'm on MC spigot 1.12
Skript Bensku's fork 2.2 dev 29.

Just for visual's sake this is one of the functions I just changed
52c5e50fdc.png

And even though I saved and reloaded it's still sending the old test messages
4f91addd61.jpg

While I'm unsure if it's the correct answer, it's worth pointing out that a function must load before code that calls it.

So, let's say you load your functions, then load a script that implements that function. This is fine. Now let's say you edit your function, and reload it. That newly edited function was loaded after the script that implements it; therefore, we'll have to reload the scripts that implement it as well.
 
While I'm unsure if it's the correct answer, it's worth pointing out that a function must load before code that calls it.

So, let's say you load your functions, then load a script that implements that function. This is fine. Now let's say you edit your function, and reload it. That newly edited function was loaded after the script that implements it; therefore, we'll have to reload the scripts that implement it as well.
Does the loading in order have anything to do with the alphabetical order of the skripts? The file with my functions.sk is under my commands.sk file, though they still work it seems when the functions.sk is reloaded successfully. Well, all but one randomly but let's not complicate thingsXD I'm wondering if it's maybe something with functions itself that causes the skript to not actually reload?
 
Does the loading in order have anything to do with the alphabetical order of the skripts? The file with my functions.sk is under my commands.sk file, though they still work it seems when the functions.sk is reloaded successfully. Well, all but one randomly but let's not complicate thingsXD I'm wondering if it's maybe something with functions itself that causes the skript to not actually reload?

Perhaps there lies a deeper issue, like you say, but I would suggest a first step of ensuring the functions script loads first everytime; you can do this by prefixing it with a number, like this:

1functions.sk
 
Perhaps there lies a deeper issue, like you say, but I would suggest a first step of ensuring the functions script loads first everytime; you can do this by prefixing it with a number, like this:

1functions.sk
Nope, doesn't seem to do it. Additionally some of the commands that try and call functions from the separate skript throw severe errors in console. Putting the functions above the commands in the same skript makes them all operable, but defeats the point of having them nice and organized in their own little sk file. At least they work this way though, I can only think it must be the function's ability to pull from another skript not working 100% then. I'm going to leave the thread up a bit longer to see if anyone else has experienced it, and if not I think I'm just out of luck XD
 
Maybe (but probably not, im just taking a wild guess) you need to reload the functions skript and the skript that calls the function
 
Maybe (but probably not, im just taking a wild guess) you need to reload the functions skript and the skript that calls the function
Have done both. The commands skript calling the functions skript reloads just fine, all changes take place. It's the functions for some reason when they're in their own skript that say it reloaded fine, but the changes do not take place.
**Edit: just to be more clear and helpful potentially : I currently I have functions at the top in their own skript called 1functions.sk to keep it up there, and reload that before the commands.sk. The changes just do not happen until server restart for some reason D:
 
So, are you saying that when you reload the script where you have your functions then the script that's actually using the function it still uses the old function? That's pretty weird.

Just to be completely sure. Create a new file and call it "1_functionTest.sk" then put the following script on it:

code_language.skript:
function testingFunctions(optional: int = 1):
  broadcast "1"
  teleport ops to (first element of all worlds)'s spawn
Then create another file and call it "2_functionTest.sk" and put the following script on it:

code_language.skript:
function testFunctions(optional: int = 1):
  testingFunctions()
  broadcast "3"
  set block at (first element of all worlds)'s spawn to prismarine block
  broadcast "4"

command testing:
  trigger:
    testFunctions()
    broadcast "5"

Then, execute "sk reload all" and execute the testing command. After that, add:
code_language.skript:
broadcast "2"
to the testingFunctions function and do "sk reload all" and "testing" again.
 
So, are you saying that when you reload the script where you have your functions then the script that's actually using the function it still uses the old function? That's pretty weird.

Just to be completely sure. Create a new file and call it "1_functionTest.sk" then put the following script on it:

code_language.skript:
function testingFunctions(optional: int = 1):
  broadcast "1"
  teleport ops to (first element of all worlds)'s spawn
Then create another file and call it "2_functionTest.sk" and put the following script on it:

code_language.skript:
function testFunctions(optional: int = 1):
  testingFunctions()
  broadcast "3"
  set block at (first element of all worlds)'s spawn to prismarine block
  broadcast "4"

command testing:
  trigger:
    testFunctions()
    broadcast "5"

Then, execute "sk reload all" and execute the testing command. After that, add:
code_language.skript:
broadcast "2"
to the testingFunctions function and do "sk reload all" and "testing" again.
It's very odd and frustrating. Your test will work, but only if I reload all skripts from console. Even putting both of your functions on the same document and reloading from console works.
Mine, however, does not, even with a reload of all skripts from console. And both of my files work perfectly fine except in this regard.

This is my 1functions.sk (kindly ignore my inability to make things efficient as of yetXD)
https://pastebin.com/jwnSBpUw

And this is the commands file that calls the functions, commands.sk:
https://pastebin.com/PTtbhQgz

They're long I suppose, on the GUI one so maybe there's trouble there? It's just commands and functions in each skript just like your example so I can't understand why mine are not reloading.
The functions specifically too. If I make a change to the commands and reload just that skript OR all skript it takes effect right away.
 
Status
Not open for further replies.