Page 8 of 10

Re: ManiaScript Documentation

Posted: 26 Aug 2013, 13:39
by Eole
I updated the documentation with a quick introduction on what is ManiaScript and what you can do with it:
http://maniaplanet.github.io/documentation/maniascript/

@Steeffeen:
The LocalUser issue in the doc should be fixed in the next update.

Re: ManiaScript Documentation

Posted: 26 Aug 2013, 13:51
by spaii
Eole wrote:I updated the documentation with a quick introduction on what is ManiaScript and what you can do with it:
:thumbsup:

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 11:50
by steeffeen
Is there any way to properly stop the execution of a label implementation?

return, break and continue work properly by actually affecting the function where the label is declared (which is great)
so there is probably a need for a new statement:
maybe stop() but that could be confused with a die() effect for the whole script
so i would rather suggest something like suspend, abandon, interrupt

a work-around would be to wrap every label in a function so that you can use return that will only return the function and not the whole script but that would be really annoying ^^

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 17:34
by Nerpson
Hi guys, I've a problem.

I'm currently creating my first gamemode.
I want to play a sound IG.
So I thought that the command

Code: Select all

CUIConfig::EUISound::PhaseChange;
is right. But it's not working.
Need some help here! :lol:

Thanks.

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 17:39
by steeffeen
well how exactly do you want to play the sound?

from the game mode script you could send an empty notice with

Code: Select all

CUIConfig::SendNotice (Text Text, ENoticeLevel Level, CUser Avatar,
EAvatarVariant AvatarVariant, EUISound Sound, Integer SoundVariant)
source

example:

Code: Select all

UIManager.UIAll.SendNotice("", CUIConfig::ENoticeLevel::Default, Null,
CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::PhaseChange, 0);
you have only posted a type/value that doesn't perform anything ^.^

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 18:25
by Nerpson
Thanks! :thumbsup:

Another question:
I have a countdown but it's frozen. I think it's because the countdown is not launched.
So how to launch it?

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 19:05
by steeffeen
which countdown do you mean?
the timer at the top?

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 19:16
by Nerpson
Yes. I've done a modification and now the timer goes wrong, it's fixed.

Here's my code for the case 3 and 4 based ont Royal.

Code: Select all

/* ------------------------------------- */
	// Offzone shrinking
	case 3: {
		if (AllowDoubleCapture) {
			if (!Pole.Captured && Pole.Sector.PlayersIds.count > 0) {
				declare CaptureSpeed = 1.;
				declare BonusMax = 0.;
				foreach (PlayerId in Pole.Sector.PlayersIds) {
					declare CaptureSpeedBonus for Players[PlayerId] = 1.;
					if (CaptureSpeedBonus > BonusMax) BonusMax = CaptureSpeedBonus;
				}
				CaptureSpeed = BonusMax * C_GaugeMultiplier;
				
				Pole.Gauge.Speed = MathLib::NearestInteger(CaptureSpeed);
				
				declare RadiusSpeedBonus = (1 + ((S_OffZoneMaxSpeed - 1.) * (MathLib::ToReal(Pole.Gauge.Value) / MathLib::ToReal(Pole.Gauge.Max))));
				OffZoneRadiusSpeed = OffZoneStartingRadiusSpeed * RadiusSpeedBonus;
				UIManager.UIAll.StatusMessage = TextLib::Compose(
					_("OffZone speed: %1%%"), TextLib::ToText(MathLib::NearestInteger(RadiusSpeedBonus * 100))
				);
			} else Pole.Gauge.Speed = 0;
		}
		
		/* -- -- -- Modifificated here -- -- -- */

		if (OffZoneReverseCounter != S_OffZoneMaxReverses) {
			if (OffZoneRadius <= C_OffZoneMinRadius) {
				OffZoneRadiusSpeed = -OffZoneRadiusSpeed;
				OffZoneRadius = C_OffZoneMinRadius;
				OffZoneReverseCounter = OffZoneReverseCounter + 1;
				UIManager.UIAll.StatusMessage = TextLib::Compose(
					_("Tornado goes away")
				);
				UIManager.UIAll.SendNotice("", CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::PhaseChange, 0);
			}

			if (OffZoneRadius >= C_OffZoneDefaultRadius) {
				OffZoneRadiusSpeed = -OffZoneRadiusSpeed;
				OffZoneReverseCounter = OffZoneReverseCounter + 1;
				UIManager.UIAll.StatusMessage = TextLib::Compose(
					_("Tornado gets closer")
				);
				UIManager.UIAll.SendNotice("", CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::PhaseChange, 0);
			}
		}
		if (GameplaySequence != 4) {
			GameplaySequence = 4;
		}
	}
/* ------------------------------------- */
	// Revert pole gauge
	case 4: {
		declare EndRoundTimeLimit = S_EndRoundTimeLimit * 1000;
		if (EndRoundTimeLimit < 0) EndRoundTimeLimit = 0;
		UIManager.UIAll.CountdownEndTime = -1;
		EndTime = Now + EndRoundTimeLimit;
		if (Pole.Gauge.Value == 0) {
			Pole.Gauge.Max = 0;
			Pole.Gauge.Value = 0;
			Pole.Gauge.Speed = 0;
		} else {
			Pole.Gauge.Max = MathLib::NearestInteger((Pole.Gauge.Max / (Pole.Gauge.Value *1.)) * (EndTime - Now));
			Pole.Gauge.Value = EndTime - Now;
			Pole.Gauge.Speed = -1;
		}

		/* -- -- -- Modified here -- -- -- */

		if (OffZoneReverseCounter != S_OffZoneMaxReverses + 1) {
			if (OffZoneRadius <= C_OffZoneMinRadius) {
				OffZoneRadiusSpeed = -OffZoneRadiusSpeed;
				OffZoneRadius = C_OffZoneMinRadius;
				OffZoneReverseCounter = OffZoneReverseCounter + 1;
				UIManager.UIAll.StatusMessage = TextLib::Compose(
					_("Tornado goes away")
				);
				UIManager.UIAll.SendNotice("", CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::PhaseChange, 0);
			}

			if (OffZoneRadius >= C_OffZoneDefaultRadius) {
				OffZoneRadiusSpeed = -OffZoneRadiusSpeed;
				OffZoneReverseCounter = OffZoneReverseCounter + 1;
				UIManager.UIAll.StatusMessage = TextLib::Compose(
					_("Tornado gets 4")
				);
				UIManager.UIAll.SendNotice("", CUIConfig::ENoticeLevel::Default, Null, CUIConfig::EAvatarVariant::Default, CUIConfig::EUISound::PhaseChange, 0);
			}
		}else{
			OffZoneRadiusSpeed = 0.;
			UIManager.UIAll.StatusMessage = TextLib::Compose(
					_("Tornado fixed")
				);
			GameplaySequence = 10;
		}
	}

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 19:19
by steeffeen
Nerpson wrote:and now the timer goes wrong, it's fixed.
what? do you need help or not? xD

Re: ManiaScript Documentation

Posted: 05 Jan 2014, 19:33
by Nerpson
No i need your help x) the timer is stopped.