Joshua Stream Pre
  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
    http://www.nerdeyeindustries.com

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    22,117
    Blog Entries
    1
    What about calculating onGainFocus or onLoseFocus - one of those might work.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

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

  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
    http://www.nerdeyeindustries.com

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    22,117
    Blog Entries
    1
    Use onClickRelease then - its generally a better UI experience.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Storm Kings Thunder Playlist

Log in

Log in