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 » 04 Dec 2019, 15:53

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: 2008
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 » 04 Dec 2019, 20:46

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 » 05 Dec 2019, 17:57

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: 2008
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 » 06 Dec 2019, 09:52

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 » 08 Dec 2019, 16:10

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: 2008
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 » 08 Dec 2019, 20:33

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.

Post Reply

Return to “UASECO”

Who is online

Users browsing this forum: No registered users and 2 guests