Simple Maniascript.

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
kadaz
Posts: 383
Joined: 10 Sep 2011, 23:34
Location: British Columbia
Contact:

Simple Maniascript.

Post 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.
Last edited by kadaz on 28 Feb 2017, 05:45, edited 1 time in total.
US: Meltdown Combat Server: maniaplanet://#join=smrock@SMStorm 十 Offline
EU: Meltdown Combat Server: maniaplanet://#join=smpage@SMStorm 十 Offline
US: SMTRAK Startup Server: maniaplanet://#join=tmrock@SMStadium 十 Online
User avatar
Dommy
Translator
Translator
Posts: 1866
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

Re: Simple Maniascript.

Post 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.
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD
User avatar
kadaz
Posts: 383
Joined: 10 Sep 2011, 23:34
Location: British Columbia
Contact:

Re: Simple Maniascript.

Post by kadaz »

All I wanted to know was how to send a manialink to an individual player, not to everyone else, nor everything else.
US: Meltdown Combat Server: maniaplanet://#join=smrock@SMStorm 十 Offline
EU: Meltdown Combat Server: maniaplanet://#join=smpage@SMStorm 十 Offline
US: SMTRAK Startup Server: maniaplanet://#join=tmrock@SMStadium 十 Online
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest