-
Okay, I seem to be too dumb to include a script file.
in the extension.xml I added:
<script file="scripts/calendar_day.lua" />
so far so good.
The calendar_day.lua is in place inside the correct folder and I changed the colors to my liking.
Inside FGU unfortunately nothing changes.
Do I need to add / change anything for the file to execute correctly?
Thanks for your help and patience everyone.
-
Bump. I'm sure this can be solved easily and it would enable me to finish up v 1.2 of my themes for publishing :). Sorry to nag, but I wasn't able to figure this one out myself :(.
-
To run code you've written in an extension there are a few steps you need.
The first thing you need to do is to first register the script file in extensions.xml as you've done.
Alternatively if you need to call the scripts functions somewhere you need to give the name a script, such as in the example below:
Code:
<script name="MenuItemRegister" file="scripts/menu_item_register.lua" />
If you want your new script to run on boot, then you need to add a function in the top of your script called onInit(), like below.:
Code:
function onInit()
registerMenuItems();
end
function registerMenuItems()
...
end
Alternatively you can call the function from any code section of any of your lua files in that extension if you gave it a name like above. Such as here:
Code:
function someFunctionFoo()
...
MenuItemRegister.registerMenuItems;
...
end
The final way to do this is more specific, in the cases you're overriding an already existing function. You then need to create an onInit() function, which includes the overriding. And then FG will call the override function when that event occurs, such as for when overriding mouse wheel scrolling over a Token. Token.onWheel is the inbuilt API function (https://www.fantasygrounds.com/refdoc/Token.xcp#onWheel), which I'm overriding here with my own onWheel function.:
Code:
function onInit()
Token.onWheel = onWheel;
end
function onWheel(token, notches)
if token == nil then
return;
end
...
end
-
[SOLVED]
Oookay.....it was a long road, but I got it....turned out I didn't need to do any additional coding! Your insight led me to the following discovery:
Within the utility_calendar.xml was an entry pointing the file directory of the calendar_day.lua to its default location. I simply had to change this to the correct folder...done -.-.
I had the idea because you told me how to define the script name, so I was wondering if the default name was mentioned anywhere else, overwriting my changes.
THANK YOU SO MUCH, I'll make sure to give your Themes extra care!
Thanks to everyone for your guidance, I feel like I have learned a lot through this.
-
Happy to help, glad it worked out!