updatePageTitle() ?

Game development with Board Game Arena Studio
Post Reply
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

updatePageTitle() ?

Post by fafa-fr »

Hi,
I'd like to know if it's possible to update descriptionmyturn (the string that tells players what they can or must do now) without changing state. This exists in some games, but it is not documented, so I'd like to have a confirmation, because it would be very convenient for many games!
Example :

Code: Select all

this.gamedatas.gamestate.descriptionmyturn = titleHtml;
this.updatePageTitle();
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: updatePageTitle() ?

Post by Quinarbre »

Yes, it works just as in your example.
You can also build a complex description such as :

Code: Select all

this.gamedatas.gamestate.descriptionmyturn = dojo.string.substitute(_('${you} will score ${points}.<br/>'), {points:points, you:'${you}'} );
Don't forget the translation marks.

An interesting and related undocumented feature is the ability to change state on the client side :

Code: Select all

this.setClientState("someStateName", { "descriptionmyturn":_("${you} must play a piece or select a card") } );
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: updatePageTitle() ?

Post by MikeIsHere »

I need this also -- when would I call this-- onEnteringState?
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: updatePageTitle() ?

Post by fafa-fr »

Hi, thanks for your answer. I guess my post wasn't clear enough, my question wasn't "How does it work?", my question was "Is it possible (for us common developers) to use this even if it's not documented?" So it was more a question for the admins, but I posted it here because a lot of developers could be interested. I've been thinking of asking a confirmation for a long time, but this post made me finally do it.
User avatar
docthib
Posts: 73
Joined: 10 August 2015, 14:05

Re: updatePageTitle() ?

Post by docthib »

Code: Select all

this.setClientState()
is widely used in projects you can use it.

There is a use case in Studio Cookbook (Multi Step Interactions: Select Worker/Place Worker - Using Client States)
http://en.doc.boardgamearena.com/BGA_Studio_Cookbook
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: updatePageTitle() ?

Post by fafa-fr »

Yeah, for this one I wouldn't have worried too much, since Alena added it in the doc a long time ago. (Though I think it would be better if there was an official confirmation from the admins, because since they're very busy, we cannot be sure that they often read the Studio doc to see what other developers added.)
But concerning gamedatas.gamestate.descriptionmyturn and updatePageTitle(), there's nothing about it in the doc, so I think it would really be nice to have a confirmation.
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: updatePageTitle() ?

Post by Een »

Documentation could definitely be better ^^
updatePageTitle() is used heavily in Terra Mystica, so if we break it, we break Terra Mystica. I think it's safe to confirm it.
I have quickly added it to the documentation : http://en.doc.boardgamearena.com/Game_i ... eful_stuff
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: updatePageTitle() ?

Post by fafa-fr »

Thanks a lot! :)
same for setClientState() as described in BGA Studio Cookbook?
User avatar
Een
Posts: 3861
Joined: 16 June 2010, 19:52

Re: updatePageTitle() ?

Post by Een »

No idea on that one. Never used it myself, sourisdudesert would have to confirm that. But as it has been heavily used by Victoria_La, breaking it would break multiple games too, so we probably will be careful not to break it ;)
Post Reply

Return to “Developers”