Development
Manialinks in UASECO
This is a very complex topic and I can not include this here, but there are several Tutorials out there (see the links below). The mean problems with these Tutorials is, that they did not include the specials about creating Manialinks for server related Widgets, but here I try to compensate these.
Ingame styles:
Manialink Tutorials:
Development
Notes about Manialinks for UASECO
-
The elements
<timeout>
and<include>
are not working on server side Manialinks. -
With
$h
you can link to a Manialink, but be sure you have wrote it lower case, otherwise the link does not work. All other codes (like$L
) can be written upper case. -
With TM2 new dimensions for Manialinks was introduced, now it is possible to make Manialinks for Wide-Screens in 16:9. If you want to reuse your current Manialink from TMF for TM2 and for Wide-Screens, then you have to adjust all
posn
andsizen
attributes. Just multiply all yourX
with2.5
andY
with1.875
.Then rename all
posn
topos
,sizen
tosize
and move theZ
values frompos
into an own attribute calledz-index
(e.g.z-index="10"
).After that add the attribute
version="3"
to your<manialink>
. -
The max. size of the Viewport in TMF is
128 x 96
and in TM2 it is320 x 180
. - With the update from 2013-04-24 there are new attributes available for Manialinks.
- With the update from 2014-10-16 there are new possibilities available for Manialinks.
-
For debugging Maniascripts in Manialinks you can now add the attribute
name="NameOfThisManialink"
, which will be shown in the CTRL+G console, see here for more details. -
If you want to center the text in a
<label...>
vertical, then usecenter2
, because this centers the text better. -
Max. lenght from a
action
attribute from a<quad>
Tag is 128 ascii chars, see this posting.
Development
Accessing in-game Player-Avatar
To use the Player-Avatar in a quad, you can use this piece of code in Maniaplanet:
Maniaplanet
<quad pos="0 0" z-index="1" size="24 24" image="file://Avatars/<PLAYER_LOGIN>/default" />
Just replace <PLAYER_LOGIN>
with the login from the Player.
Development
Accessing in-game Flags
To use the in-game Nation-Flags you can use the following piece of code:
Development
Identifications in Manialinks for UASECO
You have to distinguish between Action Ids
and Manialink Ids
. The Action Id
you
have to use to identify a click on a Button in your Widget. The Manialink Id
is to identify your Widget to
be able to control it (e.g. hide or update/replace it).
To identify that a Player has clicked on a Button in your Widget (or the Widget himself) you need to add a Action id,
after a click on this you can identify these click at the event onPlayerManialinkPageAnswer
.
It is good practise to think before write some code. Setup a list which Manialink Ids
and Action Ids
you need and then make a list like this:
Example Id list (from Records-Eyepiece)
Manialink Ids ~~~~~~~~~~~~~ MainWindow SubWindow PlacementWidgetRace PlacementWidgetScore PlacementWidgetAlways PlacementWidgetGamemode DedimaniaRecordsWidget LocalRecordsWidget LiveRankingsWidget RoundScoreWidget MultiLapInfoWidget WarmUpInfoWidget [...] Action Ids ~~~~~~~~~~ addMapToPlaylist addSongToJukebox askDropMapFromPlaylist dropCurrentSongFromJukebox dropMapFromPlaylist handlePlayerDonation releaseChatCommand showDedimaniaRecordsWindow showHelpWindow showLastCurrentNextMapWindow showLiveRankingsWindow showLocalRecordsWindow [...]
After that you are ready to write code... ;)
To interact with the Players, you need to setup a action="[ID]"
into your Manialink.
When a Player click on your Button, then the Game-Client send this Action Id
to the dedicated server
and this releases the Callback ManiaPlanet.PlayerManialinkPageAnswer
to UASECO, and UASECO releases the
event onPlayerManialinkPageAnswer
.
Example Widget without an Action Id
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <manialink id="MainWindow"> <quad pos="20 48" z-index="0.01" size="4.6 4.6" style="Icons128x128_1" substyle="Rankings"/> <label pos="15 48" z-index="0.01" text="Label 1"/> </manialink>
Example Widget with an Action Id
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <manialink id="MainWindow"> <quad pos="20 48" z-index="0.01" size="4.6 4.6" action="PluginRecordsEyepiece?Action=showHelpWindow" style="Icons128x128_1" substyle="Rankings"/> <label pos="15 48" z-index="0.01" text="Label 1"/> </manialink>
As you can see in the second example at action="PluginRecordsEyepiece?Action=showHelpWindow"
, you have to add your ClassName
from your Plugin. With this UASECO send the response only to your Plugin (this identifier is required!).
You can add more Key=Value
pairs, like action="PluginRecordsEyepiece?Action=showHelpWindow&Page=2"
.
If you are familiar with the HTTP-Get method, then you may think this is the same... and your are right.
Identify a click
public function __construct () { // Register your function to the event $this->registerEvent('onPlayerManialinkPageAnswer', 'onPlayerManialinkPageAnswer'); } // $params contains the Key=Value pairs public function onPlayerManialinkPageAnswer ($aseco, $login, $params) { if ($params['Action'] == 'showHelpWindow') { // Show the HelpWindow, the Player has clicked your Action Id (see Id list above) } }
Development
Build Manialinks for UASECO
In server side Manialinks you are able to send more then one Manialink together. This makes it easier for you to control each Manialink, e.g. to send two Manialinks and after a while you can disable one of them and the remaining Manialink is still to see.
Merge multiple Manialinks together
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <manialink id="MainWindow"> <quad pos="20 48" z-index="0.01" size="4.6 4.6" action="PluginRecordsEyepiece?Action=showHelpWindow" style="Icons128x128_1" substyle="Rankings"/> <label pos="15 48" z-index="0.01" text="Label 1"/> </manialink> <manialink id="MapWidget"> <quad pos="20 43" z-index="0.01" size="4.6 4.6" action="PluginRecordsEyepiece?Action=addMapToPlaylist&uid=qz59WslJKgKbYI2sQ3uuuasZEO7" style="Icons128x128_1" substyle="Buddies"/> <label pos="15 38" z-index="0.01" text="Label 2"/> </manialink> <manialink id="ClockWidget"> <quad pos="20 38" z-index="0.01" size="4.6 4.6" action="PluginRecordsEyepiece?Action=showLiveRankingsWindow" style="Icons128x128_1" substyle="Custom"/> <label pos="15 38" z-index="0.01" text="Label 3"/> </manialink>
To hide one of the above sent Manialinks, just send a empty Manialink with the same Manialink Id
:
Hide only one sent Manialink
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <manialink id="MainWindow"> </manialink>
Development
Send your Manialink in UASECO
To send your Manialink you need to check who should become your Manialink. There are more ways to do that, the first is to send your Manialink to all connected Players, the second is send it to a given Player only and the third is to send to a list of Players.
1. Send to all connected Players
// Do not close after a click $close = false; // Do not autohide $timeout = 0; // Add the Manialink to the multiquery (and send later together with other Manialinks) to all conneted Players $aseco->addManialink($xml, false, $timeout, $hideclick);
2. Send to a given Player only
// Do not close after a click $close = false; // Autohide after 20 seconds $timeout = 20; // Setup one Login to send to $login = 'han_solo'; // Add the Manialink to the multiquery and the given Player login $aseco->addManialink($xml, $login, $timeout, $hideclick);
3. Send to a list of Players
// Do not close after a click $hideclick = false; // Do not autohide $timeout = 0; // Setup multiple Logins to send to $logins = array('leia_organa', 'darth_vader', 'han_solo', 'luke_skywalker'); // Add the Manialink to the multiquery and the given Player logins $aseco->addManialink($xml, $logins, $timeout, $hideclick);
Instead of sending your Manialink together with other Manialinks with the Method addManialink, you can use sendManialink to send them immediately.
Parameter | Description |
---|---|
$xml |
Your Manialink |
$login |
A Login from a connected Player |
$logins |
A array of connected Player logins |
$timeout |
A timeout to autohide it (0 = permanent), $timeout was given in seconds and the dedicated server awaits miliseconds |
$hideclick |
A boolean to indicate whether the page must be hidden as soon as the Player clicks on a page option |
If you use sendManialink or addManialink,
then you need only build one (or more) <manialink>
-Blocks, these functions do the rest for you.
Example
<manialink id="MainWindow"> <quad pos="20 48" z-index="0.01" size="4.6 4.6" action="PluginRecordsEyepiece?Action=showHelpWindow" style="Icons128x128_1" substyle="Rankings"/> <label pos="15 48" z-index="0.01" text="Label 1"/> </manialink>
This is a private enthusiast Website. Maniaplanet, Trackmania, Shootmania, Nadeo are trademarks of Ubisoft Entertainment.
Windows is a registered trademark of Microsoft Corporation.