Page 1 of 2

Show / Hide Tooltips

Posted: 22 August 2020, 11:16
by tchobello
hello !

I'm working on Dungeon Twister and there are tooltips explaining to beginners each token capacities.

Is there a way for advanced players to choose if tooltips can be shown or hidden ?

Re: Show / Hide Tooltips

Posted: 22 August 2020, 11:45
by RicardoRix
you could add it as a user preference:

http://en.doc.boardgamearena.com/Game_o ... ns.inc.php

Re: Show / Hide Tooltips

Posted: 22 August 2020, 16:11
by tchobello
I think this affects the game for both players, no ?

Re: Show / Hide Tooltips

Posted: 22 August 2020, 17:14
by paramesis
It would if you used Game Options. See the bottom of the page RicardoRix linked for the User Preferences section. These are options you can set up that only affect the client side interface for each player. Example uses of User Preferences are Carcassonne, where players can choose to see the first edition tile graphics, and Stone Age, where each player can see the classic vs anniversary style meeples or the summer/winter side of the board. You can access these in-game by clicking on the hamburger menu in the upper right, or the "Options" tab below the play area.

In fact, the BGA framework already includes a built-in option to disable all tooltips, so you don't need to create a separate preference for it, unless you would like to only disable some of the tooltips.

Unfortunately, not many players at BGA know about User Preferences, but they are a great way to handle situations like this.

Re: Show / Hide Tooltips

Posted: 23 August 2020, 01:20
by Victoria_La
There is already option for that that automatically applied to all games no? If you go to Preferences there is "Display tooltips" Enabled/Disabled
so you don't have to do anything

Re: Show / Hide Tooltips

Posted: 23 August 2020, 08:51
by tchobello
oh thanks a lot !

I really didn't know about the User Preferences in the hamburger menu !

Re: Show / Hide Tooltips

Posted: 10 September 2020, 02:47
by RavingWanderer
Two questions which are relevant to this discussion:
1. How does one interrogate (get the current value of) the BGA-supplied "Display tooltips" preference?
2. How is one notified that it has changed? (It doesn't force a refresh.)

Answers to these questions should be documented someplace (in the options file doc, game.js doc, or other place?)

Re: Show / Hide Tooltips

Posted: 10 September 2020, 14:39
by Een
RavingWanderer wrote: 10 September 2020, 02:47 Two questions which are relevant to this discussion:
1. How does one interrogate (get the current value of) the BGA-supplied "Display tooltips" preference?
2. How is one notified that it has changed? (It doesn't force a refresh.)

Answers to these questions should be documented someplace (in the options file doc, game.js doc, or other place?)
This feature disables all tooltips at the framework level for the ongoing game. Thus, it's not intended to need to be managed by the developer of the game module.

Re: Show / Hide Tooltips

Posted: 10 September 2020, 16:28
by RavingWanderer
Een wrote: 10 September 2020, 14:39
RavingWanderer wrote: 10 September 2020, 02:47 Two questions which are relevant to this discussion:
1. How does one interrogate (get the current value of) the BGA-supplied "Display tooltips" preference?
2. How is one notified that it has changed? (It doesn't force a refresh.)

Answers to these questions should be documented someplace (in the options file doc, game.js doc, or other place?)
This feature disables all tooltips at the framework level for the ongoing game. Thus, it's not intended to need to be managed by the developer of the game module.
In Hand and Foot, I sometimes get *some* tooltips in the game area regardless of the setting when playing in studio. In the production version, I get tooltips for the played melds (these are created as dijit.Tooltip, not using this.addTooltip or this.addTooltipToClass, because of their dynamic content).

Re: Show / Hide Tooltips

Posted: 11 September 2020, 01:25
by quietmint
RavingWanderer wrote: 10 September 2020, 02:47 Two questions which are relevant to this discussion:
1. How does one interrogate (get the current value of) the BGA-supplied "Display tooltips" preference?
2. How is one notified that it has changed? (It doesn't force a refresh.)

Answers to these questions should be documented someplace (in the options file doc, game.js doc, or other place?)
It's stored with the other preferences, number 200. Read with: this.prefs[200]

Regarding updates, the framework doesn't provide a callback, so you have to add your own. Something like this can be done during the setup, connected to each of the dropdowns (remember there are two spots with the same dropdowns -- the Options tab below the game, and the top-right corner):

Code: Select all

      var _this = this;
      var updatePreference = function (e) {
        var match = e.target.id.match(/^preference_[cf]ontrol_(\d+)$/)
        if (!match) {
          return;
        }
        var pref = +match[1];
        var prefValue = +e.target.value;
        _this.prefs[pref].value = prefValue;
        if (pref == 123) {
          // do something here if you care about pref #123 changing
        }
      };

      dojo.query('.preference_control').connect('onchange', updatePreference);