FG Spreadshirt Swag
  1. #1

    extension coding question regarding modifier buttons

    Can anyone tell me where the functions are(or what they are called) that "unselect" these buttons on an attack die roll?
    I am attempting to create a new extension that includes buttons that I would like to also have this triggered event reset
    I am very new to lua, so I hope this is clear

  2. #2
    The ModifierStack global script controls this portion of the ruleset. It's in the CoreRPG layer.

    * setModifierKey(...) will set the value of the button, as well as register the key in the master modifier key list.

    * getModifierKey(...) will return the value of the button, as well as reset the key state (if not locked) or track usage (if locked).

    * lock() will increment the lock count

    * unlock() will decrement the lock count, and reset any keys used if lock count is zero.

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    The ModifierStack global script controls this portion of the ruleset. It's in the CoreRPG layer.

    * setModifierKey(...) will set the value of the button, as well as register the key in the master modifier key list.

    * getModifierKey(...) will return the value of the button, as well as reset the key state (if not locked) or track usage (if locked).

    * lock() will increment the lock count

    * unlock() will decrement the lock count, and reset any keys used if lock count is zero.

    Regards,
    JPG
    After checking this over, and many failed attempts I think what I was asking for was not clear. Thank you for your reply Moon Wizard. I think what I mean to ask is how to make the physical button "pop-up" so-to-speak.
    For example, if I select a modifier in the modifier window, like "standard cover", it will pop back up after the roll hits the chatbox.
    Mine is not doing that. However it does deactivate the code behind the button. In order to use this again, I have to toggle the button off then back on.
    Is this what you were describing above? After looking at that, I think this is for the code behind the button. This portion is already working. Please let me know if I misunderstand.

  4. #4
    button.JPG
    Maybe a visual of what I am trying to do will help. As you can see, when I press the Attk2 button it depresses and the result on the roll is modified correctly.
    The button stays down after the roll, even though if I roll again it is not "active" as shown in the image. So, I have to click the button to untoggle it.

    This code will toggle the button if the other is pressed, and that part is also working
    Code:
    function onValueChanged()
    		super.onValueChanged();
    			if getValue() == 1 then
    			window["ATT_2"].setValue(0);
    		       end
                   end
    I have tried several things, but I am not having any luck with this. Any coding gurus want to toss me a hint?

  5. #5
    Since you are not adding the button as part of the standard set of ModifierStack buttons; then you would need to add your own code within the attack roll handler to toggle the button off.

    If instead you add those buttons to the "modifierstack" panel or to the "modifiers" window, then they would automatically be turned off, since that is where the global ModifierStack script is looking to automatically turn off the buttons. You can see the script code that does this in ModifierStack.setModifierKey(...).

    Regards,
    JPG

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