Jump to content

Photo

A question for non-scripters: Dependencies


  • Please log in to reply
1 reply to this topic

Poll: Single file vs. multi file libraries

Do you prefer ZScript libraries to be a single file or multiple?

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Vote Guests cannot vote

#1 Moosh

Moosh

    The Mush

  • Moderators

Posted 30 April 2025 - 03:38 AM

(Or scripters as well, anyone's welcome to weigh in.)

 

This is something I've been wondering recently. When using database scripts there's a handful of other header files that may be needed. Two of the most commonly used are ghost.zh and tango.zh which are both split up into multiple files that are kept in the headers folder. It's expected that you'll have one copy of the bulk of the header that's then imported by multiple copies of a settings files used for each of your quest projects. There's some pros and cons to organizing this way.

 

Pros: 

  • It's just clean: Splitting up code files by their function makes the library easier to read, less cluttered, and generally more professional looking.
  • There's less duplicate files: Only the settings for the library need to be saved with each quest that's using them. This saves a bit on file space.
  • It's easy to quickly update: Sort of. Provided that there's no changes to the settings file or the import structure, you could drop a new version of ghost or tango over the old one and it would just work without needing to remake all your settings changes per quest. Now both of those libraries are included with ZC by default so this step isn't even an issue.

Cons:

  • It can be awkward for backups: When I was updating LQftH2, I ran into some compatibility issues. Some of my old boss scripts stopped functioning properly in the newest ghost and I hadn't hung onto the ancient version of the library I started in, because I kept updating it past the point where I stopped working on the quest. I had to go in and fix the bosses to adhere to the new standards and it was a bit of a hassle. We try to keep code as backwards compatible as possible, but sometimes things get deprecated and sometimes things break.
  • You sometimes encounter trouble with file paths: This is the big one I see come up a lot. I've helped a bunch of people in the past with figuring out compile errors and regularly ghost or tango would be responsible because something the user did would mess up the paths. Either a duplicate copy of the header that was being mistakenly imported or a mismatched one that was importing the wrong files or multiple ZC installations of which only one actually had the library. Nested imports seem to cause confusion when something goes wrong. If you want a second copy of the library saved some place it doesn't expect this can also cause some mild annoyance.

 

Reason I'm asking this is that I'm working on a large update for NPCAnim.zh and am debating splitting it up into multiple files like ghost. I've never been particularly bothered by editing massive single script files but I'm wondering if people would benefit overall from such a change. Which do you prefer?


  • ShadowTiger, Joelmacool and coolgamer012345 like this

#2 Joelmacool

Joelmacool

    Addicted to Overwatch

  • Moderators
  • Real Name:Joel
  • Location:Country of Europe

Posted 01 May 2025 - 01:35 PM

I honestly have no preference because I don't think about it too hard. As long as the database script outlines how to set everything up, there's no worries.

 

Of course there are complications and stuff around whether a single file is better than having multiple, but I see it more as a 'that's just how the person more knowledgeable than I set it up, so who am I to complain?'. 


  • Moosh and Emily like this


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users