how to play with status bar ?

Game development with Board Game Arena Studio
Post Reply
User avatar
firgon
Posts: 56
Joined: 14 October 2014, 06:27

how to play with status bar ?

Post by firgon »

I'm sorry that seem very simple, but i can't find anything on documentation or in different tutorial.

How can i use Status Bar ?

The actual BGA habits seem to allow players to cancel their actions or to urge them to confirm them. But i don't know how to write something in the status bar and offer one or two buttons to interact. So :

Is it possible only by entering a new state ? or is there a function to modify the status bar ?

If there is something to solve my problem in documentation, a link could be enought.

Many thanks.
User avatar
robinzig
Posts: 459
Joined: 11 February 2021, 18:23

Re: how to play with status bar ?

Post by robinzig »

For offering players options via buttons, that are specific to a gamestate, see here and search "onUpdateActionButtons": https://en.doc.boardgamearena.com/Game_ ... amename.js

For more "bespoke" stuff, you're basically on your own and have to implement this yourself - although it's not too difficult and quite a few games do it. But the simple action buttons in the framework go quite a long way for most things :)
User avatar
TheBoot
Posts: 11
Joined: 22 January 2012, 22:57

Re: how to play with status bar ?

Post by TheBoot »

In general updating the status bar is done on changing states as firgon stated via the "onUpdateActionButtons"

If you are trying to update the buttons before changing states you can use "client states" as described in "BGA Studio Cookbook", (https://en.doc.boardgamearena.com/BGA_Studio_Cookbook look for "Multi Step Interactions: Select Worker/Place Worker - Using Client States") NOTE: that is much harder to implement.
User avatar
firgon
Posts: 56
Joined: 14 October 2014, 06:27

Re: how to play with status bar ?

Post by firgon »

Thanks i will look better at BGA Studio Cookbook. I think if i can not to change state, it would be smarter. I would like when a player select a car explain what he's doing and offer the possibility to cancel.
User avatar
robinzig
Posts: 459
Joined: 11 February 2021, 18:23

Re: how to play with status bar ?

Post by robinzig »

firgon wrote: 08 February 2022, 18:00 Thanks i will look better at BGA Studio Cookbook. I think if i can not to change state, it would be smarter. I would like when a player select a car explain what he's doing and offer the possibility to cancel.
Then you want to use "client states" as TheBoot said. Note that client states are "real states" as far as JS code is concerned, so things like onEnteringState and onUpdateActionButtons trigger with the new state having the name you specified in this.setClientState. The only difference with server states is that the other players/spectators don't see that anything has changed.
User avatar
firgon
Posts: 56
Joined: 14 October 2014, 06:27

Re: how to play with status bar ?

Post by firgon »

Yes, thank you, it works perfectly !!!

That's exactly what i was searching for.
User avatar
firgon
Posts: 56
Joined: 14 October 2014, 06:27

Re: how to play with status bar ?

Post by firgon »

TheBoot wrote: 07 February 2022, 19:18 NOTE: that is much harder to implement.
Well... It has been really simple to implement so maybe there is a trap i didn't see. What is the difficulty ?
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: how to play with status bar ?

Post by Victoria_La »

firgon wrote: 09 February 2022, 09:19
TheBoot wrote: 07 February 2022, 19:18 NOTE: that is much harder to implement.
Well... It has been really simple to implement so maybe there is a trap i didn't see. What is the difficulty ?
There is no real difficulty, it is just an extra state, so you have to deal with this like with state, means you can do onEnter , onLeave etc.
If you don't need the whole state, then there is no reason to use it clientState (and if you using it just to change the title - it is overkill)
I use client states because I always provide client side undo (cancel) which adds some code into state handling of cient states.
User avatar
firgon
Posts: 56
Joined: 14 October 2014, 06:27

Re: how to play with status bar ?

Post by firgon »

Yes, you're right it's overkill.

I discovered updatePageTitle() that could have been largely enough :D
Post Reply

Return to “Developers”