Can someone give me a place to find an example of how to add an option to the options window in the combat section?
Something that shows how to access it would be great as well.
Thanks,
Robert.
Can someone give me a place to find an example of how to add an option to the options window in the combat section?
Something that shows how to access it would be great as well.
Thanks,
Robert.
After giving up finding anything that works using a search as it all showed doing xml and lua code that didn't work.
So I went into an extension that I know has options and found the code that made them show up and how to access them.
So to make an options show up you need to create a lua file and use <script name="" file="" /> in the base.xml or extension.xml file.
Then in that file you need to add to onInit() ad the following:Code:<script name="XCoreDataOptions" file="scripts/XCoreDataOptions.lua" />
"XCORE_CT5" is the unique identifier that will be used to access the value that is in the option.Code:function onInit()
OptionsManager.registerOption2("XCORE_CT5", false, "option_header_combat", "option_label_CT5", "option_entry_number", {});
end
false notes if it is to be displayed on the client and host or just host.
"option_header_combat" is the section in the options where the item willl be displayed.
"option_label_CT5" is a string name that is used to get the label.
"option_entry_number" is the name of what type of data it is, "option_entry_cycler" is also available and has lots of options.
{} is for any options related to the item. for number there is { min=#, max=# } with # being replaced by actual numbers.
"option_label_CT5" is defined in a strings.xml file
to retrieve the value for the option you need to do the following:Code:<string name="option_label_CT5">Combat Tracker: Change Initiative by</string>
Code:local nChangeInitBy = OptionsManager.getOption("XCORE_CT5");
So this is over in the options button/menu on the right side?
This is how it looks in the options window:
Attachment 66762
Sorry yes it's the options in Tools section on the right.
After some testing, it appears the true/false parameter is not if it shows up in the client or host. I'm not sure what it does.
what I did to make it only show up on the host and not on the client was the following:
Code:if User.isHost() then
OptionsManager.registerOption2("XCORE_CT5", true, "option_header_combat", "option_label_CT5", "option_entry_number", {});
end
Thanks, I get it now. Wasn't sure at first. I haven't touched the options menu at all. Trying to think of a free extension that is not in the vault that does. Maybe NPC Flavors, Player Agency, or Safety Toolkit?
Kelrugem's extendes automation and overlays extension for 3.5 and pathfinder has several. There sre several others for pathfinder that do as well.
Here's a recent example for adding a numerical option:
For a campaign specific option, it would look more like:Code:OptionsManager.registerOptionData({
sKey = "TOKEN_SPEECH", bLocal = true, sGroupRes = "option_header_client_notify", sType = "option_entry_number",
tCustom = { min = 0, default = tostring(OverlayManager.DEFAULT_SPEECH_NOTIFY_DURATION), },
});
Regards,Code:OptionsManager.registerOptionData({ sKey = "XCORE_CT5", sGroupRes = "option_header_combat", sType = "option_entry_number", }, });
JPG
Thank you for that.
Does bLocal = true/false have an impact on whether the option shows up on the host and/or client?
Do I need to do what I did with User.isHost()?
An option will always show on both host and client.
However, those with the bLocal flag indicate that they are per-user options, that can be set by each user local to their instance.
If you want an option that is per-campaign (ie controlled by GM only), then do not use the bLocal flag.
Regards,
JPG
Thank you.
I'll take that into account.