Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Which is better? Having many scripts doing things or one script doing everything?

Asked by 4 years ago

Not entirely sure if this counts as a scripting question per se but with my latest project I've noticed I've been stacking a lot of code for various different pieces into one script. So I'm curious, is that a good idea or is it better to have several different scripts handling each piece of one big machine? I feel it would be a easier to find and adjust scripts if I had them specifically assigned to select groups of things though in that case I could also just leave notes in the script to help find important pieces for future updating. So then it comes down to efficiency. I'm not entirely sure of any ways to test this directly in the scripts so if anyone has a solid or detailed answer it would be much appreciated.

Also, sorry if this isn't technically a scripting question and if this question DOES get closed then I understand and could I be pointed to a place better suited to answer it?

2 answers

Log in to vote
1
Answered by 4 years ago

It's all about the organization. If your scripts are organized and do different things at different times, that's fine. Although, if you have multiple scripts running at the same time... that can be bad for your game. If you have one script running, but doing multiple things when triggered by something else.. It shouldn't cause a problem. The only time it becomes a problem is when things are firing more than once, doing the same command over and over, variables mixed up.. etc! I find the best thing to do is to write all your script yourself, and not take it from various parts because then you can get confused.

Hope this helps!

PS: You can ask questions like this on the discord, this website is really for scripts only.

0
Hm... Alright. I was never quite sure if there was actually a definitive answer as to one performing better than the other or anything. Mixing up variables won't be an issue and the scripts all run at incredibly specific times so I'm not too fussed with that. I'll give breaking the code down another shot and if I notice a performance hit, the code isn't too hard to compound. Thank you. XxTrueDemonxX 362 — 4y
0
No Problem, Have Fun! JayShepherdMD 147 — 4y
Ad
Log in to vote
1
Answered by 4 years ago

It really comes down to personal preference. Some developers like to have a main server script that requires a bunch of modulescripts that do different things. This is just a form of organization though, you could just have different server scripts dedicated to different things. It just really comes down to how you would like to organize your code, but most people prefer the former example because it looks more organized and navigable.

0
Alright. I've seen arguments for both sides so I figured in the end it would come down to developer preference. XxTrueDemonxX 362 — 4y
0
It would seem that's what it boils down to yes. CeramicTile 847 — 4y

Answer this question