View Full Version : layering: change/overwrite an option of the included ruleset (core)
lule
January 9th, 2014, 13:07
Hello FG-Team,
since there is no section for Core in Game Systems, I post my suggestion here.
Is it possible, that you change the "manager_options.lua" in a way, that you can change/override an option in a ruleset that includes core for layering? Why is this necessary? One need more or less values for an option.
This could be done when you replace in the registerOption and registerOption2-function the line "table.insert(aGroups[sGroup], rOption);" with the following code:
local replace = false;
for v, k in pairs(aGroups[sGroup]) do
if k.sKey == sKey then
aGroups[sGroup][v] = rOption;
replace = true;
end
end
if replace == false then
table.insert(aGroups[sGroup], rOption);
end
Something like that would be very nice. Otherwise there are two options in the option window, which is very confusing.
Regards,
Lule
Moon Wizard
January 9th, 2014, 21:25
Sounds like something do-able. Can you give me an example?
Thanks,
JPG
lule
January 10th, 2014, 12:05
In the actual ruleset I like to change the DCLK-option, that there are only "roll" or "off".
Sure I could change the "manage_options.lua" and integrate it into the ruleset. But this would mean, that changes in the core-ruleset in that file are not automatically used in the ruleset. And that is one of the best things about layering, using the official code for background functions in an easy way. Or do I miss a way to join a lua-file like a xml-file?
The other thing that could be done is: Move the registration of the option out of the onInit function in manage_options.lua in an other lua file (set_option.lua) which is included in the base.xml. Then someone only have to Change that file while the OptionsManager is still in the layer of the core-ruleset.
Moon Wizard
January 10th, 2014, 19:26
In reality, I believe that this option is rarely changed from Roll; and I've considered removing it completely. Regardless of this option, users can always drag rolls from the fields directly without double-clicking (if the ruleset supports it).
The 3 values for the DCLK option reflect how people have stated that they play on the tabletop in the past on the forums.
* Roll = Okay with FG rolling for them.
* Mod = Would rather pick up and roll the dice themselves, and just want modifier added automatically
* Off = Want to do everything manually
Removing the registration of options out of the onInit function won't work, because the options need to be initialized before any of the panels are opened and the order that onInit functions are called for global scripts is undefined (i.e. they can happen in any order). Let me think on it a bit.
Regards,
JPG
lule
January 11th, 2014, 09:34
I understand, but also wont to make a proposal, because the OptionsManager is a very important file and there is functionality mixed with content. When someone is using the layering he or she mainly like to change the content and not the functionality.
Is it not possible to include this line in base.xml
<script name="SetOptions" file="xyz/set_options.lua" />
xyz is the place of that file, wherever you like.
"set_options.lua" include a function called "registerOptions" like in the desktop.lua of 4e only with all relevant options of a ruleset.
And this function is called in the onInit-function of "manager_options.lua" with "SetOptions.registerOptions();" and replaces all registrations there.
With this solution someone can easily change all options (by replacing the "set_options.lua" in the ruleset) without touching the functionality of OptionsManager.
Regards,
Lule
lule
March 30th, 2014, 13:25
Thank a lot for the solution! It is working great.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.