5E Product Walkthrough Playlist
  1. #1

    Check boxes flicker.

    Hello everyone I have a bit of a quandry. I looked in other Rulesets, and I could not find a solution to this.

    I have a list of stats on the PC sheet that each have a check box next to them. What I am trying to do is set it up so that only one box can be checked at a time. The code looks like this.

    Code:
    <basicnumber name="stat1" source="stat1.value">				
         <anchored to="stats" position="below" offset="0,3"/>	
         <frame mergerule="replace" name="fielddark" offset="4,4,4,4" />                
         <font>sheetnumber_lg</font>	
         <nodrag />
         <nodrop />
         <default>1</default>
         <min>1</min>
         <max>5</max>
    </basicnumber>
    
    <buttonfield name="stat1selector" source="stat1.button">
         <anchored  to="stats" position="right" offset="3,0" width="10" height="10" />
         <state icon="button_checkoff10_wht" />
         <state icon="button_checkon10_grn" />
         <script>
              function onInit()
                   Node = window.getDatabaseNode();
                   if DB.getValue(Node, 'statname') == "stat1" then
                        onValueChanged();
                   end
              end
    
              function onValueChanged()
                   window.stat2selector.setValue(0);
                   window.stat3selector.setValue(0);
                   window.stat4selector.setValue(0);
                   window.stat5selector.setValue(0);
                   window.stat6selector.setValue(0);
                   window.stat1selector.setValue(1);
                   statLibrary.statSelect(window, "stat1.value", "stat1")
              end
         </script>
    </buttonfield>
    Initially instead of using buttonfield I was just using buttoncontrol. The problem with that is the stat was not updating on the GM view, and the GM wants to be able to see what is selected by the players. So, I changed it to buttonfield, and now, the GM can see the changes live, the problem is, when the player selects a second stat, the buttons start flickering. I'm pretty sure it's because both the GM and Player are triggering the onValueChanged function. When the player is in their sheet and the GM does not also have it open, it works fine. The second the GM opens the sheet to see what they are selecting, it's starts to freak out.

    How can I fix this? I was thinking OOBMessaging might be the answer, but as seeing the value is being saved in the players DB node, I didn't think that would be the answer. I also thought of putting in either an if !isHost or isLocal command, but I also want the GM to be able to change those selections as well, and I assume this would prevent that from happening.

    Any advice would be greatly appreciated.
    Wesley Toma-Lee
    Lead Developer
    Nerd Eye Industries
    https://www.nerdeyeindustries.com

  2. #2

  3. #3
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,264
    Blog Entries
    9
    I'm assuming their are no radiobuttons available in FG?

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  4. #4
    Quote Originally Posted by damned View Post
    What about calculating onGainFocus or onLoseFocus - one of those might work.
    Unfortunately buttoncontrol does not have either of those. But now that I do look again, maybe I should be doing onBottonPress instead of onValueChange.

    Quote Originally Posted by LordEntrails View Post
    I'm assuming their are no radiobuttons available in FG?
    I think I tried radiobuttons in the passed and I didn't like it for some reason, but I can look into it again.
    Wesley Toma-Lee
    Lead Developer
    Nerd Eye Industries
    https://www.nerdeyeindustries.com

  5. #5

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