Page 1 of 1

Player turn?

Posted: 13 May 2025, 10:53
by DargorX
Hi there developers!

A player can be active outside his natural turn for a thousand reasons, but I need to know whose turn it is at certain times of the game.

Is there any way to know whose player's turn it is, regardless of who the active player is?

Looking at the database, it looks like the global variable number 2 might contain the value of the player whose turn it currently is, but I'm not entirely sure. I also don't know if I can access those variables.

Thanks!

Re: Player turn?

Posted: 13 May 2025, 12:34
by Tisaac
DargorX wrote: 13 May 2025, 10:53 Hi there developers!

A player can be active outside his natural turn for a thousand reasons, but I need to know whose turn it is at certain times of the game.

Is there any way to know whose player's turn it is, regardless of who the active player is?

Looking at the database, it looks like the global variable number 2 might contain the value of the player whose turn it currently is, but I'm not entirely sure. I also don't know if I can access those variables.

Thanks!
There is no such thing as a turn so you have to handle it yourself :)

Re: Player turn?

Posted: 13 May 2025, 14:15
by DargorX
Tisaac wrote: 13 May 2025, 12:34
DargorX wrote: 13 May 2025, 10:53 Hi there developers!

A player can be active outside his natural turn for a thousand reasons, but I need to know whose turn it is at certain times of the game.

Is there any way to know whose player's turn it is, regardless of who the active player is?

Looking at the database, it looks like the global variable number 2 might contain the value of the player whose turn it currently is, but I'm not entirely sure. I also don't know if I can access those variables.

Thanks!
There is no such thing as a turn so you have to handle it yourself :)
That's what I figured. I was asking mostly to find out if anyone had ever faced the same problem :P

Re: Player turn?

Posted: 14 May 2025, 14:16
by Kayvon
For sure. Just set an internal variable to track it. I do the same thing with the first player marker in many, many games.

Re: Player turn?

Posted: 15 May 2025, 10:40
by DargorX
Kayvon wrote: 14 May 2025, 14:16 For sure. Just set an internal variable to track it. I do the same thing with the first player marker in many, many games.
Thanks, I will do it this way.

Re: Player turn?

Posted: 15 May 2025, 12:48
by RicardoRix
as a matter of interest, isn't this the difference between, getActivePlayerId() and getCurrentPlayerId() ?

the activePlayerId() will be the player with the spinning timer awaiting their move.
getCurrentPlayerId() will be the player that sent the request, possibly outside of their turn.

So then, yes, if the active player is not the player's who's turn it is, then you'd need to track it.