WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Internally modular add-ons: What tools can I use? (https://www.wowinterface.com/forums/showthread.php?t=58643)

sarysa 03-19-21 03:39 PM

Internally modular add-ons: What tools can I use?
 
I've made personal add-ons for WoW since 2019. I'm working on a passion project that I've wanted to do since November: An add-on that plays looping music (with intro support) specific to an encounter. As a fan of JRPGs in general, and with a certain infamous Spires boss resembling a Touhou boss, plus there being nothing similar to this concept on curseforge already, seemed like a good way to shake off the rust from not coding any major projects in a long time.

The core functionality is already in and working smoothly. I can make perfect looping music which seems to be pretty stable as well. I could well just hardcode everything and make it another personal add-on, but I want to make something suitable for the general public. Here is the problem:

I don't know how, or if it's even possible, to make an add-on internally modular.

The idea is that I would like people to be able to simply copy a folder into AddOns\BossMusic\Music\ and next time the mod loads, this directory is found and loads the metadata for the song which can then be assigned to the boss via the add-on's UI. I gleaned from the "what mods can't do" sticky in this forum that directory enumeration is impossible.

I also would not like to use the HandyNotes style of modular design. People would in theory add dozens of songs, so that would seriously clutter the AddOns directory while also risking name collision with real add-ons.

What I've come up with is pretty ugly, and I'd like to avoid this at all costs, and that would be to load XMLs for subfolders named 1-100 and have them in the base mod's XML. Whoever makes their own looping tracks would have to edit a few simple lines in the module's meta.lua and whoever gets it would have to rename the folder any number between 1-100 that's available. I'm not fond of users having to edit .lua files at all, nor having them change directory names, but what really makes this scheme awful is that it produces 4 errors, each with its own entry in the Lua Warning screen, for each missing of the 100.

I wouldn't be surprised if with 100, WoW would immediately display to typical users the "your add-ons are producing a ton of errors" popup. That's basically another dead-end if it happens.

There has to be a better way, but the API is so restricted. Is there anything that can be done to improve upon this? Is there at least an "include optional" supported by the load XML?

[edit: Another problem with this kind of modular design is being able to have audio files be contained in the module's folder, since tmk there's no way to find the working directory either. sheesh...]

Rilgamon 03-19-21 04:32 PM

Not possible. Editing toc or xml is needed.

sarysa 03-19-21 06:40 PM

Quote:

Originally Posted by Rilgamon (Post 338662)
Not possible. Editing toc or xml is needed.

Yeah, at this point I'm looking at the following scheme:
- Expand upon the 100 declared xml links with dummies for each, except #1 which would probably be a Kevin MacLeod song for demonstration purposes. This will prevent errors.
- Allow users to copy their song dir into the Music subdirectory under any name.
- Require end users run a batch file that will rename any wrongly named dirs to fit into the 100 pre-declared dir structure, plus also a couple other things I'm anticipating will be needed. I think I've devised a scheme to allow the music files to be in the module dir, and the batch file could set things up so there's no issue.

It's an ugly workaround, but it's better than anything else at this point. It won't generate fountains of errors...I just hope that Curseforge doesn't take issue with batch files.

Rilgamon 03-19-21 07:11 PM

When you run a script you don't need predefines.
The script could create a Lua-file that holds the list of files.

SDPhantom 03-22-21 06:57 PM

DBM and BigWigs do something similar by having each "module" set up as a LoD addon and use custom tags in the ToC for registering when to load each one.


All times are GMT -6. The time now is 12:41 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI