[SOLVED] addActionButton during setup...

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

[SOLVED] addActionButton during setup...

Post by Rudolf »

Hello,
I have another question: is addActionButton function available to run from setup in JS?
it seems my button don't want to be created at this step...
it runs when called later in the code, but not during setup...
How did you do to create buttons on a refresh?

Code: Select all

             setup: function( gamedatas )
        {
          
            
            console.log( "Starting game setup" );
            
            this.addActionButton( 'button_patata', _('PATATATATATATA'), 'onSENButton');

         
Last edited by Rudolf on 13 September 2015, 14:41, edited 1 time in total.
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: addActionButton during setup...

Post by Rudolf »

The only solution I find is to put this in OnEnteringState...
Then I use the call here.
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: [SOLVED] addActionButton during setup...

Post by pikiou »

onUpdateActionButtons is the only place where addActionButton should be used. I think it's written in the documentation.
It's because right before onUpdateActionButtons is called, there place where action buttons are placed is cleaned up.

Edit: JesterX is right, it's onUpdateActionButtons, not onEnteringState. My bad.
Last edited by pikiou on 18 September 2015, 13:01, edited 1 time in total.
User avatar
JesterX
Posts: 26
Joined: 31 December 2012, 21:06

Re: [SOLVED] addActionButton during setup...

Post by JesterX »

Personally, I use:

onUpdateActionButtons: called when entering in a new state, in order you can add action buttons in status bar.
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: [SOLVED] addActionButton during setup...

Post by Rudolf »

Yes also, thanks Jester.
Post Reply

Return to “Developers”