Page 1 of 2

[FIXED]User you are spectating

Posted: 14 Sep 2014, 12:34
by oliverde8
Hi,

Is there a way to retrieve the user(login) you are spectatig using Maniascript? I thought that InputPlayer was the main player and GUIPlayer the player being spectated. But both of them have information on the main player and not on the spectated player.

So I have Login1 spectating Login2. Login2 playes the game. in both variables on the game of Login1 I find Login1 and on the game of Login2 I find Login2.

Ideally I should have Login2 somewhere in the maniascript of Login1.

Can we have some information about the 3 variables GUIPlayer, InputPlayer and LocalUser? Is there something I am missing?

Thanks,

Re: User you are spectating

Posted: 14 Sep 2014, 12:42
by w1lla

Code: Select all

		declare CSmPlayer TargetPlayer;
		if (GUIPlayer != Null) TargetPlayer <=> GUIPlayer;
		else TargetPlayer <=> InputPlayer;
This can be helpfull i think?

Re: User you are spectating

Posted: 14 Sep 2014, 12:55
by oliverde8
Hey, thanks

but GuiPlayer doesen't contain the information about the player I am spectating. At least in TM² environnement Rounds script mode it doesen't I have only my login in it.

Re: User you are spectating

Posted: 14 Sep 2014, 13:03
by w1lla

Re: User you are spectating

Posted: 14 Sep 2014, 13:23
by oliverde8
Well I do vaguely remeber using GUIPlayer before to get the specatated . But I am in ScriptInGame context and I wonder if there isn't somthing broken.

I also tried this

Code: Select all

if(ClientUI.SpectatorAutoTarget != NullId){
    log("Spectating : "^Players[ClientUI.SpectatorAutoTarget].Name);
}

if(SpectatorForcedTarget != NullId){
    log("Spectating : "^Players[ClientUI.SpectatorForcedTarget].Name);
}
But both SpectatorForcedTarget, and SpectatorAutoTarget are always Null so nothing there either.

Re: User you are spectating

Posted: 14 Sep 2014, 13:28
by w1lla
Did you try a Ident value?

Re: User you are spectating

Posted: 14 Sep 2014, 13:45
by steeffeen
GUIPlayer is definitely the way to go
it contains the player whose values are shown at the time, meaning the player you're spectating

if it's not working correctly in TM, then it's a bug and Nadeo should be informed about it

Re: User you are spectating

Posted: 15 Sep 2014, 13:08
by Eole
InputPlayer is always the local player.
LocalUser is always the user associated to the local player.
GUIPlayer can take three values :
- when spectating a specific player, GUIPlayer should be the spectated player,
- when spectating with a "global cam" (cam 7, overview of the map, free view, ...) GUIPlayer is Null,
- when playing GUIPlayer is the local player (== InputPlayer).

InputPlayer, LocalUser and GUIPlayer are Null for a short period of time when connecting to the server during the initialization of the Manialink. So if you log() one of these variables only at the beginning of the script they will be Null.

If you don't have this behavior, then there's a problem.

Re: User you are spectating

Posted: 27 Sep 2014, 16:56
by oliverde8
Hi, I confirm there is a problem.
I had hope it was fix I know it was crazy for me to hope for that so soon.

I put this code inside a Manialinks maniascript's while loop :

Code: Select all

if (GUIPlayer != Null) {
    log("GUIPlayer is "^GUIPlayer.Name);
} else {
    log("GUIPlayer is NULL");
}
I did see null while switching between players but beside that always my nickname was in the logs never saw the nickname of the player I spectate.
I tried in Script & Legacy Rounds mode as I needed the feature there.

Can you please fix this?

Re: User you are spectating

Posted: 27 Sep 2014, 18:08
by undef.de
Should this not be easily possible with the (unfortunately unavailable in TM) CTmMode::Spectators?

When is this available in TM? It would help very much to handle many things in the HUD of a controller.