Script.Round : Fetch Score + Alter live modescript_settings

UASECO is a fork of the XAseco2/1.03 controller for Trackmania and has been overhauled to support the Modescript Gamemodes of Trackmania².

Moderators: undef.de, NADEO

Palteza
Posts: 94
Joined: 12 Oct 2011, 03:08

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by Palteza »

Yeah ManiaScript doc sucks.

Plugin comes from xaseco, so in the actual state it does : $aseco->client->query("SendDisplayManialinkPage", $xml, 0, false);
I've tested to $aseco->sendManialink and it's fine.
Is there a change on server side ? In the 1st I send to all clients, no? Just to understand the process.

But I see that, onPlayerConnect, it sends :

Code: Select all

$aseco->client->query("SendDisplayManialinkPageToLogin", $log, $xml, 5000, false)
So if I switch to (I don't care to send to the list of logins $log)

Code: Select all

$aseco->sendManialink($xml, false, 5000, false)
I will save 80 instructions if I have 80 players on the server ?
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by undef.de »

onPlayerConnect you can send to the player who connects:

Code: Select all

$aseco->sendManialink($xml, $player->login, 5000, false)
this makes sure that driving players will not get a lag because of the game has to refresh a widget.

and on every change for all players (I guess onPlayerFinish), you can send the changed widget to all:

Code: Select all

$aseco->sendManialink($xml, false, 5000, false)


Btw.: The value of 5000 sec. could be removed, because I guess that the widget has been refreshed within that time anyway: ;)

Code: Select all

$aseco->sendManialink($xml, $player->login)

Code: Select all

$aseco->sendManialink($xml, false)
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
Palteza
Posts: 94
Joined: 12 Oct 2011, 03:08

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by Palteza »

Hum yeah, sounds logic, on connect I just want to send to the connecting player. Thanks.

The only one dynamic personalized manialink (for each player, it shows : "You have xx points"), could be displayed in chat with a ChatSend query.
Is there a gain in perfomance between the 2 methods ? Significant one ?
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by undef.de »

Palteza wrote: 05 Dec 2019, 17:57 The only one dynamic personalized manialink (for each player, it shows : "You have xx points"), could be displayed in chat with a ChatSend query.
Is there a gain in perfomance between the 2 methods ? Significant one ?
If that only contains that text, then you could send that Manialink instead* of "spamming" into the chat, some players hate it when the chat is filled with too much information.

*The plugin "StuntMessages" does it the same way, just a text message (with a small animation).
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
Palteza
Posts: 94
Joined: 12 Oct 2011, 03:08

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by Palteza »

Yeah, I was just wondering if there was a significant difference in ressources between a manialink displayed on screen or a message sent in chat. I guess it's minor.

I'm struggling to get a button dynamic.
I'm sending this manialink onPlayerConnect, a simple text box with an OK button

Code: Select all

	$xml  = '<manialink version="1" id="3121120007">';
	$xml .= '<frame posn="-20 10 0">';
	$xml .= '<quad posn="16 -10 0" sizen="220 36" valign="center" halign="center" style="Bgs1" substyle="BgWindow3"/>';
	$xml .= '<label posn="18 1.5 1" size="50 10" scale="0.8" valign="left" halign="center" style="TextInfoMedium" substyle="" text="'.$texte.'"/>';
	$xml .= '<label posn="18 -18.5 1" scale="1.2" valign="center" halign="center" style="CardButtonSmall" text="'.$bouton.'" action="onconnectOK"/>';
	$xml .= '</frame>';
	$xml .= '</manialink>';
	$aseco->sendManialink($xml, $logj, 0, false);
I put an action property on the label button as you see, so I expect to call it once it's on onPlayerManialinkPageAnswer($aseco, $login, $params), but I don't know how it's stored in $params
Tried something like :

Code: Select all

public function za_onPlayerManialinkPageAnswer($aseco, $login, $params) {
	if ($params['action'] == 'onconnectOK') {
		$xml  = '<manialink version="1" id="3121120007">';
		$xml .= '</manialink>';
		$aseco->sendManialink($xml, $login, 0, false);
	}
}
But well, my $params['action'] is a speculation :mrgreen: , my condition is never true. Didn't find how I could dump this $params to know more.
As you can see I just want to make the whole manialink empty and disappear on click.
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by undef.de »

Try this (untested):

Code: Select all

	$xml  = '<manialink version="1" id="3121120007">';
	$xml .= '<frame posn="-20 10 0">';
	$xml .= '<quad posn="16 -10 0" sizen="220 36" valign="center" halign="center" style="Bgs1" substyle="BgWindow3"/>';
	$xml .= '<label posn="18 1.5 1" size="50 10" scale="0.8" valign="left" halign="center" style="TextInfoMedium" substyle="" text="'.$texte.'"/>';
	$xml .= '<label posn="18 -18.5 1" scale="1.2" valign="center" halign="center" style="CardButtonSmall" text="'.$bouton.'" action="PluginClassName?Action=onConnectTest"/>';
	$xml .= '</frame>';
	$xml .= '</manialink>';
	$aseco->sendManialink($xml, $logj);

Code: Select all

public function onPlayerManialinkPageAnswer ($aseco, $login, $params) {
	if ($params['Action'] === 'onConnectTest')  {
		$xml  = '<manialink version="1" id="3121120007">';
		$xml .= '</manialink>';
		$aseco->sendManialink($xml, $login);
	}
}
Replace "PluginClassName" in your Manialink action with your plugin classname, otherwise UASECO does not know where to send the action. This is totally different to XAseco2, because in XAseco2 all actions where sent to all active plugins (and they have to check if the action has to be handled... with all that overhead.).

Function do not have to be different in each plugin, because the plugins are all own classes, so you can remove "za_".

Manialink IDs aren't required to be integer, you can use "onConnectTest" instead of "3121120007".

Btw.: You better should use Manialink version 3... I know that's a lot of changes, but it's worth it. Notes: https://www.uaseco.org/development/manialinks.php#Note
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
Palteza
Posts: 94
Joined: 12 Oct 2011, 03:08

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by Palteza »

We had 80 players for the 1st edition of our new cup, things went pretty well on UASECO/plugin side.

Strangely the biggest latency came from where I didn't expect, on a simple sendManialink message for everyone. Took around 4 seconds to be displayed :shock: :

Code: Select all

public function chat_affiche($aseco, $login, $chat_command, $chat_parameter) {
		
	$text = $chat_parameter;
	$xml  = '<manialink version="1" id="0815470000133">';
	$xml .= '<label posn="0 40 0" scale="2" valign="center" halign="center" style="TextValueSmallSm" text="$f00'.$text.'"/>';
	$xml .= '</manialink>';
	$aseco->client->query("SendDisplayManialinkPage", $xml, 10000, false);
}
I'll move from manialink version 1 to the last, but apart from that, any clue with the issue ?
The rest went pretty well and fast, so I guess the server was not saturated on RAM or whatever.
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by undef.de »

Palteza wrote: 20 Jan 2020, 18:59 Strangely the biggest latency came from where I didn't expect, on a simple sendManialink message for everyone. Took around 4 seconds to be displayed
Hmmm... that's really strange. Does it always take 4 seconds till it is visible? Maybe someone called a chat command which took longer to finish, like "/xlist" or something. Or did you call it on a map change?
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
Palteza
Posts: 94
Joined: 12 Oct 2011, 03:08

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by Palteza »

Yeah it took always (we used it many times) a couple of seconds, even when we were in the middle of a long WU with no special events happening :?
Now I remember, we have a "/mute all" command, with a same simple manialink displaying in the middle of the screen "Chat off", who also took like 2-3 secondes every time. But, makes more sense, uaseco has to Ignore 80 players before sending the manialink.

Maybe server ressources were more saturated than I thought ? We'll keep an eye on that.
But I mean, doesn't explain why some way more complicated manialinks (or functions) were displaying instantly (even after map change), doesn't make sense.
User avatar
Miss
Posts: 2151
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: Script.Round : Fetch Score + Alter live modescript_settings

Post by Miss »

Well, Uaseco in itself is pretty slow. But another thing is, if you're sending a manialink to every player at the same time, that might take some time. (Definitely not 3 seconds though..)

It might be faster to display such a text clientside using Maniascript instead of sending the entire manialink.
3080 RTX, Ryzen 3700X, 32GB RAM, Windows 11
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream and tweet.
Post Reply

Return to “UASECO”

Who is online

Users browsing this forum: No registered users and 1 guest