Page 1 of 2

setTeamInfo

Posted: 08 Aug 2012, 01:23
by MuNgLo
I would like some more info about how to declare colour and country for setTeamInfo.

Can't find any info about the colourstuff and all I seem to get is greenish, pinkish or black. Also server ends up crashing client on connection. I guess that's cause the hud is broken.

I would love to know the default values of red and blue so I can pass them along.

Code: Select all

/**
	 * Set Team names and colors. Only available to Admin.
	 * @param string $teamName1
	 * @param float $teamColor1
	 * @param string $team1Country
	 * @param string $teamName2
	 * @param float $teamColor2
	 * @param string $team2Country
	 * @param bool $multicall
	 * @return bool
	 * @throws InvalidArgumentException
	 */
	function setTeamInfo($teamName1, $teamColor1, $team1Country, $teamName2, $teamColor2, $team2Country, $multicall = false)
	{
		if(!is_float($teamColor1))
		{
			throw new InvalidArgumentException('teamColor1 = '.print_r($teamColor1, true));
		}
		if(!is_float($teamColor2))
		{
			throw new InvalidArgumentException('teamColor2 = '.print_r($teamColor2, true));
		}
		if(!is_string($teamName1))
		{
			throw new InvalidArgumentException('teamName1 = '.print_r($teamName1, true));
		}
		if(!is_string($teamName2))
		{
			throw new InvalidArgumentException('teamName2 = '.print_r($teamName2, true));
		}
		return $this->execute(ucfirst(__FUNCTION__),
				array('unused', 0., 'World', $teamName1, $teamColor1, $team1Country, $teamName2, $teamColor2, $team2Country),
				$multicall);
	}

Re: setTeamInfo

Posted: 08 Aug 2012, 09:07
by The_Big_Boo
About the color, you have to give a normalized hue. Usually, hue is defined in degrees, like on this image
Image

As you need a value between 0 and 1, you just have to divide by 360 so by default, red is 0 and blue is 0.667.


About the zone, you have to give a ManiaPlanet zone path with the same format than it appears in your dedicated account location, eg. 'World|France', 'World|United States of America|Arizona' and so on...

Re: setTeamInfo

Posted: 08 Aug 2012, 09:55
by MuNgLo
Thx for the info. I'm gonna try it out. Hopefully it should all fall into place this time around so I don't get that clientcrash thingy. :/

--EDIT--

Yup. It all works now. :3

I did notice however that it couldn't present Ä. Isn't it utf-8 all the way or what?

--EDIT--

Actually the country bit is a bit irritating. It takes a mapend it seems before it updates. Or at the very least it doesn't update as soon as you change it.

Re: setTeamInfo

Posted: 08 Aug 2012, 10:47
by The_Big_Boo
It seems there is indeed an encoding problem, most probably in the game as usually ManiaLive and the dedicated handle strings well (eg. maps)
Edit: actually the bug was in the dedicated, should be fixed in next update. Thanks for the report :)

About the fact that country isn't updated before next map, it's usually the case with lots of options in the dedicated but as the color doesn't work well neither it may be a bug.

So I'll report these to concerned people.

Re: setTeamInfo

Posted: 08 Aug 2012, 11:24
by MuNgLo
Been trying it out a bit and seems to me that the code that sets up the hud and stuff like that needs a rework.
If you change country/teamname they will not update everywhere. Like the splash screen on matchstart uses the old names. I'm guessing the names that was when the hud was setup when the player connected.
Same on the rules-screen in spawn.

They do update to blank teamname and sets county icon to world if the team goes empty but will still have the old names when a player joins the team.

Oh and a restart of the map is not enough. But a reconnect is. I guess the old hud gets destroyed and it sets up a completely new one on connect.

If I have understod the workings of the server correctly it should mostly be the gamemode script that needs some work in the hud drawing department. Or am I barking up the wrong tree?

Re: setTeamInfo

Posted: 11 Jan 2013, 21:11
by The_Big_Boo
The 3 first arguments are for spectators (I think) thus not used (yet?) You can see in the first post that we're forcing dumb values in ManiaLive.

I sometimes ask again for the GetTeamInfo but it's not a priority (and I don't know why it hasn't been done while adding SetTeamInfo)

Re: setTeamInfo

Posted: 25 Nov 2014, 04:10
by kadaz
I have a question,

Been trying to get these colors working, yet after three hours.. It does not make sense.

There is 3 spots for 3 different numbers that equate between 0.0 - 1.0.

Now how, by the example chart above, can the calculation give me the numbers to fit into ForceColor = <0.0, 0.0, 0.0>;

Meaning, in which order. I tried <0.6, 0.6, 0.7>; and its blue alright, with some purple in it..

Yet try to following the divide by 360 for other colors is void, completely other colors not close to the example.

Thanks for the help.

Nor did I find this any helpful..

http://forum.maniaplanet.com/viewtopic. ... or#p143691

Re: setTeamInfo

Posted: 25 Nov 2014, 14:17
by Eole
The ForceColor attribute take a RGB vector (<Red, Green, Blue>) with value ranging from 0.0 to 1.0.
Red = <1., 0., 0.>
Green = <0., 1., 0.>
Blue = <0., 0., 1.>
Yellow = <1., 1., 0>
Dark red = <0.5, 0., 0.>
...