ManiaScript Documentation

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: ManiaScript Documentation

Post 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.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
spaii
Posts: 1100
Joined: 19 Jun 2010, 00:04
Location: Rémy - France
Contact:

Re: ManiaScript Documentation

Post by spaii »

Eole wrote:I updated the documentation with a quick introduction on what is ManiaScript and what you can do with it:
:thumbsup:
User avatar
steeffeen
Translator
Translator
Posts: 2472
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: ManiaScript Documentation

Post 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 ^^
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    Nerpson
    Translator
    Translator
    Posts: 1555
    Joined: 27 Sep 2013, 18:02
    Location: France
    Contact:

    Re: ManiaScript Documentation

    Post 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.
    ImageImageImageImage
    User avatar
    steeffeen
    Translator
    Translator
    Posts: 2472
    Joined: 14 Oct 2012, 16:22
    Location: Germany

    Re: ManiaScript Documentation

    Post 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 ^.^
      Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

      ManiaControl, FancyManiaLinks
      User avatar
      Nerpson
      Translator
      Translator
      Posts: 1555
      Joined: 27 Sep 2013, 18:02
      Location: France
      Contact:

      Re: ManiaScript Documentation

      Post 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?
      ImageImageImageImage
      User avatar
      steeffeen
      Translator
      Translator
      Posts: 2472
      Joined: 14 Oct 2012, 16:22
      Location: Germany

      Re: ManiaScript Documentation

      Post by steeffeen »

      which countdown do you mean?
      the timer at the top?
        Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

        ManiaControl, FancyManiaLinks
        User avatar
        Nerpson
        Translator
        Translator
        Posts: 1555
        Joined: 27 Sep 2013, 18:02
        Location: France
        Contact:

        Re: ManiaScript Documentation

        Post 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;
        		}
        	}
        ImageImageImageImage
        User avatar
        steeffeen
        Translator
        Translator
        Posts: 2472
        Joined: 14 Oct 2012, 16:22
        Location: Germany

        Re: ManiaScript Documentation

        Post by steeffeen »

        Nerpson wrote:and now the timer goes wrong, it's fixed.
        what? do you need help or not? xD
          Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

          ManiaControl, FancyManiaLinks
          User avatar
          Nerpson
          Translator
          Translator
          Posts: 1555
          Joined: 27 Sep 2013, 18:02
          Location: France
          Contact:

          Re: ManiaScript Documentation

          Post by Nerpson »

          No i need your help x) the timer is stopped.
          ImageImageImageImage
          Post Reply

          Return to “ManiaScript”

          Who is online

          Users browsing this forum: No registered users and 2 guests