Understanding the "Not Your Turn" red banner

Game development with Board Game Arena Studio
Post Reply
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Understanding the "Not Your Turn" red banner

Post by MikeIsHere »

Looking at the hearts tutorial
The clientSide onPlayerHandSelectionChanged has this line of code

Code: Select all

if( this.checkAction( 'playCard', true ) )
{
 
And it was my understanding that this is what controls the red banner of not your turn if someone clicks and is not there turn

In my game I am in a state where the active player must select a card

Code: Select all

15 => array(
        "name" => "cutCard",
        "description" => clienttranslate('${actplayer} must pick a cut card'),
        "descriptionmyturn" => clienttranslate('${you} must pick a cut card'),
        "type" => "activeplayer",
        "args" => "argDeck",
        "possibleactions" => array( 'cutCard' ),
        "transitions" => array('cutCard' => 20)
I seem to be in the correct state with the correct active player because on the screens says
MikeIsWorking0 screen - You must pick a cut card
The other
MikeIsWorking1 screen - MikeIsWorking0 must pick a cut card

Now if MikeIsWorking0 picks a card everything works as expected
But if MikeIsWorking1 picks a card the checkAction returns false (as it should) but no banner is displayed

Code: Select all

onDeckSelect: function (control_name, item_id) {
	if (item_id > 0) {
		var action = 'cutCard';
		if (this.checkAction(action, true)) { 
			this.ajaxcall("/" + this.game_name + "/" + this.game_name + "/" + action + ".html",
				{
					card: item_id,
					lock: true
				}, this, function (result) { }, function (is_error) {

				}
			);
			
		}
		this.deck.unselectAll();                    
	}
},
The game log is

Code: Select all

< updateReflexionTime
{"player_id":"2326782","delta":86400,"max":259200}
< gameStateChange
{"id":15,"active_player":"2326782","args":{"deck":{"1":{"id":"1"},"2":{"id":"2"},"5":{"id":"5"},"6":{"id":"6"},"8":{"id":"8"},"9":{"id":"9"},"11":{"id":"11"},"13":{"id":"13"},"14":{"id":"14"},"15":{"id":"15"},"16":{"id":"16"},"17":{"id":"17"},"18":{"id":"18"},"19":{"id":"19"},"20":{"id":"20"},"21":{"id":"21"},"22":{"id":"22"},"23":{"id":"23"},"24":{"id":"24"},"27":{"id":"27"},"28":{"id":"28"},"29":{"id":"29"},"30":{"id":"30"},"32":{"id":"32"},"34":{"id":"34"},"35":{"id":"35"},"36":{"id":"36"},"38":{"id":"38"},"39":{"id":"39"},"40":{"id":"40"},"41":{"id":"41"},"42":{"id":"42"},"43":{"id":"43"},"44":{"id":"44"},"45":{"id":"45"},"47":{"id":"47"},"48":{"id":"48"},"49":{"id":"49"},"51":{"id":"51"},"52":{"id":"52"}}},"type":"activeplayer","reflexion":{"total":{"2326782":"259190","2326783":259176}}}
What is interesting is later in the game I have the playCard state and that one is working

Code: Select all

20 => array(
    		"name" => "playerTurn",
    		"description" => clienttranslate('${actplayer} must play a card'),
    		"descriptionmyturn" => clienttranslate('${you} must play a card'),
    		"type" => "activeplayer",
            "possibleactions" => array( "playCard"),
            // Go option Button to recongize play, don't know right now if LastCard needs to be here because player doesn't choose it
    		"transitions" => array( "nextTurn" => 30, "Go" => 35, "LastCard"=> 37, "endGame"=> 99 )
    ),

Code: Select all

onPlayerHandSelectionChanged: function () {
                var items = this.playerHand.getSelectedItems();

                if (items.length > 0) {
                    var action = 'playCard';
                    if (this.checkAction(action, true)) {

Code: Select all

< gameStateChange
{"id":20,"active_player":"2326782","args":null,"type":"activeplayer","reflexion":{"total":{"2326782":258711,"2326783":"259176"}}}
< cutCard
{"value_displayed":"6","suit_displayed":"♣","card":{"id":"24","type":"1","type_arg":"6","location":"deck","location_arg":"38"}}
Result = This is not your turn
User avatar
thebosz
Posts: 5
Joined: 14 May 2020, 16:59

Re: Understanding the "Not Your Turn" red banner

Post by thebosz »

It's the second argument to checkAction that's doing it.

Don't set it to "true" and the banner will be displayed. More info here: http://en.doc.boardgamearena.com/Game_i ... yers_input
User avatar
MikeIsHere
Posts: 137
Joined: 30 April 2020, 22:52

Re: Understanding the "Not Your Turn" red banner

Post by MikeIsHere »

It worked. Thank you

I thought I tried that but I only turned it back because the playCard state has the true parameter and it does return the banner
Post Reply

Return to “Developers”