-
May 7th, 2020, 19:32 #1
- Join Date
- Nov 2007
- Posts
- 31
Problem with modifierbuttons copied from 2E/5E ruleset
Hi,
I've copied the modifierbuttons of the 2E/5E rulesets into Forbidden Lands extension for MoreCore.
This mostly works, the modifiers are applied correctly to the first roll after selecting the button.
After that, the buttons should reset their state - but they don't, at least the graphic does not. Visually, the buttons stay selected, although FG doesn't apply the modifier on further rolls.
I've spent over an hour searching through the rulesets to find the function which resets the graphic of the buttons, but didn't find it.
Can someone more familiar with this functionality give me pointer in which file I have to look?
-
May 7th, 2020, 20:23 #2
Assuming you're using the CoreRPG based ModifierStack functionality - i.e. ModifierStack.getModifierKey(control_name) is what you use to get the state of the button, then it should reset as part of that command.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
May 7th, 2020, 20:43 #3
- Join Date
- Nov 2007
- Posts
- 31
Since I just copied the manager_actions2.lua from 2E that is exactly the command I'm using. It reads the button value just fine, but does not reset the graphical button state.
I have not modified the ModifierStack script, it's using the original CoreRPG script.
To elaborate:
I've added the controls like the 2E ruleset does in desktop_classes.xml (here's one button as an example):
Code:<button_modifierkey name="PLUS1"> <bounds>5,8,15,18</bounds> <text>+1</text> </button_modifierkey>
Code:function encodeDesktopMods(rRoll) local nMod = 0; if ModifierStack.getModifierKey("PLUS1") then nMod = nMod + 1; end if nMod == 0 then return; end rRoll.nMod = rRoll.nMod + nMod; rRoll.sDesc = rRoll.sDesc .. string.format(" [%+d]", nMod); end
This reads and applies the modifierboxes just fine, and also resets the "standard" modifierbox as normal. Further rolls also have no modifier applied. But the graphic state of the button stays pressed, and I have to manually unpress it before I can use it again to apply new modifiers.
Edit:
I think I found the issue in ModifierStack.getModifierKey:
Looking the code of the getModifierKey-function, it should indeed reset the button immediately, but for some reason it doesn't do it.
I'll have to insert some debugging output messages.
Thanks so far.Last edited by Tatzelbelm; May 7th, 2020 at 21:01.
-
May 9th, 2020, 13:04 #4
- Join Date
- Nov 2007
- Posts
- 31
Found the issue. I had copied just the buttons, they were not linked to the modifierstack window.
Because of that the function for resetting the buttons did not find the buttons using findWindow.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks