FG Spreadshirt Swag
  1. #1

    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?

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,416
    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!

  3. #3
    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>
    Then I've added the manager_actions2.lua script to the extension, again copied from 2E and containing this function:

    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
    Finally, I'm now calling the encodeDesktopMods-function from the onDice-function of the extension, which replaces the resulthandler of CoreRPG.

    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.

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in