Thread Tools Display Modes
03-19-21, 03:39 PM   #1
sarysa
A Defias Bandit
Join Date: Mar 2021
Posts: 2
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...]

Last edited by sarysa : 03-19-21 at 04:12 PM.
  Reply With Quote
03-19-21, 04:32 PM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Not possible. Editing toc or xml is needed.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
03-19-21, 06:40 PM   #3
sarysa
A Defias Bandit
Join Date: Mar 2021
Posts: 2
Originally Posted by Rilgamon View Post
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.
  Reply With Quote
03-19-21, 07:11 PM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
When you run a script you don't need predefines.
The script could create a Lua-file that holds the list of files.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
03-22-21, 06:57 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
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.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Internally modular add-ons: What tools can I use?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off