PDA

View Full Version : LUA file in extension not replacing original



MysteryHand
April 9th, 2020, 17:56
RESOLVED

Hello and thanks for the help in advance.

I'm building an extension for the 2E ruleset and having an issue with one file: data_common_adnd.lua not being replaced by the extension.



I have it listed in the extension.xml, but it doesn't seem to notice.

I've read that the original file from the ruleset might be loaded by another file after the extension runs, thereby 'copying over' the updated file with the old one.

I searched for all the files in the ruleset that referenced DataCommonADND (the name of the data_common_adnd.lua file) and added them to the extension, but no dice.

I'm new to extension coding but not new programming (although no lua experience). Any help (or point to resources) would be greatly appreciated!

Thanks.

superteddy57
April 9th, 2020, 18:35
I think more information is needed on what you want to add and what is contained in your replacement data_common_adnd.lua. Can you provide more information and some background?

MysteryHand
April 9th, 2020, 19:01
I'm changing the ability bonuses to match B/X rather than 2e. So I'm replacing the data contained in "data_common_adnd.lua". I'm switching the coin weights too but it's all the same thing: changing numbers in the lua file.

I included a debug statement in the oninit function to see if the module was at least loading and not seeing anything in the console. Mind you I don't know what triggers the onInit for this file.

I'm adding the file to extension.xml with:

<script name="DataCommonADND" file="scripts/data_common_adnd.lua" />

Admittedly, I'm totally new to this but I have had some success making an extension for the 5e ruleset that included modifications to lua files.

Thanks for taking the time to look at this problem.

superteddy57
April 9th, 2020, 19:08
DataCommon tends to contain lua tables to assist with, funny enough, common data that needs to be supplied during automation. It appears the 2E ruleset uses both DataCommon and DataCommonADND. You might get more mileage of just creating your own DataCommon lua file and just changing the DataCommon/DataCommonADND calls within your extension code to call your changes. This may not give you such a headache.

MysteryHand
April 9th, 2020, 19:11
Thank you for the quick reply! I had decided to clean my house until I got a response, now I can continue to code and let the dirt pile up :)

I won't pretend that that gave me a Eureka! moment, but it does give me a path forward. Thanks, I'll start investigating that.

Trenloe
April 9th, 2020, 20:24
The approach to overriding the base DataCommon data is discussed in this thread: https://www.fantasygrounds.com/forums/showthread.php?55371-4E-Changing-dmg-types-and-skills-for-Gamma-World

There were a couple of coding issues we had to overcome, so hopefully the discussions around getting that sorted out won't confuse the issue.

MysteryHand
April 10th, 2020, 00:18
Thanks for the response.

I found my error and it wasn't anywhere near as complex as the Gamma World issue. The error was so basic, I'm embarassed to say.

But I was very excited to see that someone was working on the Gamma World ruleset! I was thinking about doing that myself. Maybe I can help out.

Thanks to both of you for responding. Great community.

damned
April 10th, 2020, 01:39
Im pretty sure that there are two DataCommons because the 2E ruleset was heavily based on 5E and mantaining the 5E structure and even files where common is easier to maintain as 5E gets developed in parrallel.