Page 1 of 1

Simple Maniascript.

Posted: 20 Feb 2017, 06:31
by kadaz
Good day, Iam working on a maniascript to display a manialink once it has been triggered.

Now I've got most of the code done, but running into a few things, and still wondering if Text ArmorHubStatus() it is the way to go,
or to use a Void ArmorHubStatus().. see the problem that it should only work with the player that is interacting with, not all players see when 1 player is.

theres the two examples I got going.. maybe you can see what I need help with.

Original idea without individual player display.

Code: Select all


Void StatusBlockAreaDisplay(){ 

	foreach (Player in Players) { 

	StatusBlockAreaShow.ManialinkPage = """""";
		
	if (Player.IsOnTechArmor) {
		StatusBlockAreaShow.ManialinkPage ^= """ <manialink version="2">
		<frame posn="-158.8 88.8 0"><label posn="0 0 0" valign="top" text="$07FARMORHUB $CCC«" 
			style="TextCardMedium" /></frame></manialink>"""; }
	
	else if (!Player.IsOnTechArmor) {
		StatusBlockAreaShow.ManialinkPage ^= """ <manialink version="2">
		<frame posn="-158.8 88.8 0"><label posn="0 0 0" valign="top" text=""" 
			style="TextCardMedium" /></frame></manialink>"""; }	
		
	if (Player.IsOnTechSafeZone) {
		StatusBlockAreaShow.ManialinkPage ^= """ <manialink version="2">
		<frame posn="-158.8 88.8 0"><label posn="0 0 0" valign="top" text="$3C3SAFEZONE $CCC«" 
			style="TextCardMedium" /></frame></manialink>"""; }	
		
	else if (!Player.IsOnTechSafeZone) {
	   	StatusBlockAreaShow.ManialinkPage ^= """ <manialink version="2">
		<frame posn="-158.8 88.8 0"><label posn="0 0 0" valign="top" text="" 
			style="TextCardMedium" /></frame></manialink>"""; }		
}	}
Then I tried this with Text / frames

Code: Select all

Text ArmorHubStatusDisplay(){ 

	declare Text ML;
	ML = """

	<script><!--
		main () {
			declare ON_TechArmorLabel	<=> Page.GetFirstChild("ON_TechArmorLabel");
			declare OFF_TechArmorLabel	<=> Page.GetFirstChild("OFF_TechArmorLabel");
			declare TechArmorStatus = False;
					
			while(True) {
				if (TechArmorStatus) {
					ON_TechArmorLabel.Show();	OFF_TechArmorLabel.Hide();
				} else {
					ON_TechArmorLabel.Hide();	OFF_TechArmorLabel.Show();
				}
					yield;

				// process events.
				foreach (Event in PendingEvents) {
				
					if (UI != Null) {
					
					if (Player.IsOnTechArmor && !Player.IsOnTechSafeZone) { TechArmorStatus = !TechArmorStatus;
						}
					}
				}
			}
		--></script>
		
<frame posn="-158.8 88.8 0" id="ON_TechArmorLabel" ><label posn="0 0 0" valign="top" style="TextCardMedium" text="$07FARMORHUB $CCC«" />
</frame>
<frame posn="-158.8 88.8 0" id="OFF_TechArmorLabel" ><label posn="0 0 0" valign="top" style="TextCardMedium"	text="" />
</frame>
	""";

	return ML;
}
So all in all, I know to declare the Layers at start map and I know how Booleans work, but I'm not getting how to get this to work, in a setup sort of way, can someone give me an more simplified example?

Thank you.

Re: Simple Maniascript.

Posted: 20 Feb 2017, 14:11
by Dommy
https://github.com/domino54/title-packs ... Script.txt
Interfancy library code may be helpful there at some point. It isn't much CPU-friendly, but it does its job. Mostly.

Re: Simple Maniascript.

Posted: 20 Feb 2017, 18:51
by kadaz
All I wanted to know was how to send a manialink to an individual player, not to everyone else, nor everything else.