How to handle huge scripts?

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

pepper82

Member
Jan 26, 2017
272
1
18
41
Hi all,
I wonder how you handle huge scripts? For example I wrote a complete minigame script with thousands of lines of skript code.

But reloading such a skript will take forever and this I'd like to avoid on a live server. So what's the secret of handling such scripts? I am already using functions, but that alone does not improve performance that much.

Any suggestions? Ideas? Examples?


Thanks a lot :emoji_slight_smile:
 
Hi all,
I wonder how you handle huge scripts? For example I wrote a complete minigame script with thousands of lines of skript code.

But reloading such a skript will take forever and this I'd like to avoid on a live server. So what's the secret of handling such scripts? I am already using functions, but that alone does not improve performance that much.

Any suggestions? Ideas? Examples?


Thanks a lot :emoji_slight_smile:

Rewrite the plugin and make it more effiecient.

Make use of functions.

You can place these functions in another file so the file will be much smaller. and easier to reload.

If you want you can send the skript and i might be able to show you to write some things more efficiently.
 
Ty, I already make use of functions. Also I placed them in another file. But still, the problem is that have a main command like
/event
This command has dozens of arguments, like:
/event new
/event edit
/event delete
/event ....
etc. etc. etc.
So how would you break this down and seperate into several files?!
Creating more commands (which is not very user-friendly)?

One of the big problems is the "options"-part in the script. If splitting into several scripts I have to copy/paste the options part in all the scripts. Now when I change something in the options part, I'd have to change all the script files... is there a better way?
 
Last edited:
Ty, I already make use of functions. Also I placed them in another file. But still, the problem is that have a main command like
/event
This command has dozens of arguments, like:
/event new
/event edit
/event delete
/event ....
etc. etc. etc.
So how would you break this down and seperate into several files?!
Creating more commands (which is not very user-friendly)?

One of the big problems is the "options"-part in the script. If splitting into several scripts I have to copy/paste the options part in all the scripts. Now when I change something in the options part, I'd have to change all the script files... is there a better way?

1: create a yaml config instead of options

2:
Code:
#place this in main script
command /event [<text>]:
   trigger:
       stop

#place this in sub script 1
on command "/event":
   set {_arg::*} to arguments
   if {_arg::1} is "test":
       broadcast "Test"
       
#place this in sub script 2
on command "/event":
   set {_arg::*} to arguments
   if {_arg::1} is "cheese":
       broadcast "cheese"
 
  • Like
Reactions: pepper82
If you have a command with many arguments, I recommend doing something like what I did with Kurisu, make custom events (you could do this with functions too) that handle each argument and do something.
 
Status
Not open for further replies.