PDA

View Full Version : Adding modifier button to an existing category



Kelrugem
January 8th, 2022, 10:33
Hi :)

I have a problem adding new modifier buttons to an already existing category. 3.5E/PF1 has a damage category for modifiers in the modifier window (crit and half buttons). I tried using ModifierManager.addModWindowPresets, but I do not know how to add to an existing category (creating a new category is no problem). If I simply add the category damage to my preset, then I get the button but it will have an additional category with the label damage rather than having an additional button at the already existing category :)

Is my idea even possible without overwriting existing code? :)

Thanks :D

Best wishes

Kelrugem

Moon Wizard
January 8th, 2022, 15:35
There's not a clean way right now. In the next ruleset release, I'll add this function:
ModifierManager.addModWindowPresetButton(sCategory , sButtonID, [nPosition])
where nPosition is optional and sCategory is created if it doesn't exist already.

You'll still need to register the string resources either way.

Regards,
JPG

Kelrugem
January 8th, 2022, 16:45
There's not a clean way right now. In the next ruleset release, I'll add this function:
ModifierManager.addModWindowPresetButton(sCategory , sButtonID, [nPosition])
where nPosition is optional and sCategory is created if it doesn't exist already.

You'll still need to register the string resources either way.

Regards,
JPG

Nice, thank you very much for adding this in the next ruleset release :)

TheoGeek
January 9th, 2022, 05:37
I did something like that in the Nat20 extension, but it doesn't add it to the existing Damage category. It works though:


This went in the XML:


<!-- MODIFIERS -->
<string name="modifier_category_custom">Special Critical Damage</string>
<string name="modifier_label_DMG_NAT20">Nat20</string>

and this went in the init function:


_specialDamageModifierWindow =
{
{
sCategory = "custom",
tPresets = {
"DMG_NAT20",
}
},
}

ModifierManager.addModWindowPresets(_specialDamage ModifierWindow)

That put the modifier in it's own category called "Special Critical Damage"

You could do that for now.

Sorry, after all that, I saw that you were already doing this...doh!

Kelrugem
January 9th, 2022, 09:33
Sorry, after all that, I saw that you were already doing this...doh!

Hehe, no worries, I appreciate your help :)

Kelrugem
January 13th, 2022, 12:56
To report back: The new API works very well :D I really like it :) Immediately added more buttons :D