Manialink not displaying anything / proper output in v3

Moderators: w1lla, NADEO

Post Reply
User avatar
Harest
Posts: 144
Joined: 26 Mar 2018, 04:21
Contact:

Manialink not displaying anything / proper output in v3

Post by Harest »

Hi,

Context: CTmMlScriptIngame or CSmMlScriptIngame (= $RequiredContext) aka MT clip containing a Manialink. That Manialink returns a ManiaScript. We'll take a simple example, the script i shared here to show your position while mapping. Here the script:

Code: Select all

	<manialink version="2">
	<frame>
		<label id="Position" pos="-27.0 53.2" size="53.8 8.8" textprefix="$o$s" textcolor="FFF" valign="top" halign="center"/>
	</frame>
	<script><!--
	#RequireContext '.$RequiredContext.'
	#Include "TextLib" as TextLib
	main() {
		declare CMlLabel LblPosition = (Page.GetFirstChild("Position") as CMlLabel);
		declare Boolean Continue = True;
		declare Integer DisplayFrame = 10;
		declare Integer CurrentFrame = 0;
		while(Continue) {
			if (DisplayFrame < CurrentFrame) {
				LblPosition.SetText(TextLib::ToText(GUIPlayer.Position));
				CurrentFrame = 0;
			}
			CurrentFrame += 1;
			
			foreach (Event in PendingEvents)
			{
				if (Event.KeyCode == 20 || Event.KeyCode == 109)
				{
					Continue = False;
					LblPosition.SetText("");
					log("DisplayPositionScript stopped.");
				}
			}
			yield;
		}
	}
	--></script>
	</manialink>
Issue: Change the Manialink version to 3, and it'll not display anything anymore. No error, nothing. And we don't know why.

Now this is on a simple script. But if i try that on the main script, going from v2 to v3 with the proper manialink frame edited, +/- half of the elements will be displayed while others won't. Close / Right and Left don't appear.
Version 2 frame for this one:

Code: Select all

		<frame id="Window" hidden="0">
			<quad id="Background" hidden="0" sizen="160 120" posn="0 80 1"  valign="top"  bgcolor="'.$BgColor.'" halign="center"/>
			<quad id="TitleBackground" hidden="0" sizen="160 10" posn="0 80 2"  valign="top"  bgcolor="000F" halign="center"/>
			<label id="Close" style="TextValueBig" hidden="0" sizen="30 10" posn="73 78.5 3" text="x" textcolor="F30F" scriptevents="1" valign="top" halign="center"/>
			<label id="Title" hidden="0" text="" sizen="160 90" posn="0 77.5 3" textprefix="$o$s" textcolor="FFFF" valign="top" halign="center"/>
			<label id="Message" hidden="0" text="" sizen="130 90" posn="-60 60 3" textcolor="FF0F" maxline="25" autonewline="1" valign="top" halign="left"/>
			<label id="StartQuest" style="CardButtonMedium" hidden="1" sizen="100 10" posn="0 -30 3" text="Start Quest" textcolor="FF0F" scriptevents="1" valign="top" halign="center"/>
			<label id="Left" style="TextValueBig" hidden="0" sizen="30 10" posn="-30 -20 3" text="&lt;" scriptevents="1" valign="top" halign="center"/>
			<label id="Right" style="TextValueBig" hidden="0" sizen="30 10" posn="30 -20 3" text="&gt;" scriptevents="1" valign="top" halign="center"/>
		</frame>
Version 3 (i initially put z-index there but Dommy told me first element has the highest z-index so i did it like that):

Code: Select all

		<frame id="Window" hidden="0">
			<label id="Close" style="TextValueBig" hidden="0" size="30 10" pos="73 78.5" text="x" textcolor="F30F" scriptevents="1" valign="top" halign="center"/>
			<label id="Left" style="TextValueBig" hidden="0" size="30 10" pos="-30 -20" text="&lt;" scriptevents="1" valign="top" halign="center"/>
			<label id="Right" style="TextValueBig" hidden="0" size="30 10" pos="30 -20" text="&gt;" scriptevents="1" valign="top" halign="center"/>
			<label id="StartQuest" style="CardButtonMedium" hidden="1" size="100 10" pos="0 -30" text="Start Quest" textcolor="FF0F" scriptevents="1" valign="top" halign="center"/>
			<label id="Message" hidden="0" text="" size="130 90" pos="-60 60" textcolor="FF0F" maxline="25" autonewline="1" valign="top" halign="left"/>
			<label id="Title" hidden="0" text="" size="160 90" pos="0 77.5" textprefix="$o$s" textcolor="FFFF" valign="top" halign="center"/>
			<quad id="TitleBackground" hidden="0" size="160 10" pos="0 80" valign="top" bgcolor="000F" halign="center"/>
			<quad id="Background" hidden="0" size="160 120" pos="0 80" valign="top" bgcolor="'.$BgColor.'" halign="center"/>
		</frame>
I now know i can remove hidden="0" or text="", i'll it's just that it was like that before in the initial script i edited quite a lot now.
Post Reply

Return to “Maniaplanet Reports”

Who is online

Users browsing this forum: No registered users and 1 guest