What devs would like in MP4 for ManiaScript
Posted: 29 Aug 2015, 12:27
Hello there!
It's been quite a while since I find cool ideas to get ManiaScript to the max hype level. So here's my brain dump about this. Friends devs, feel free to add some of yours bellow.
1. Allow declaration of classes, enums
As you can see, this code looks like Java. Variables are declared on the top of the class, I think there's no need to have private or public variables. To call the object's attributes, you can use the This keyword. Constructors are the same as Java. No return type, it's a method named liked the class.
The enum is just a simple list of names, separated with commas and ending with a semicolon.
Bellow is an example to instantiate a CBonus object.
I thought that this is clearly not useful to have another keyword new like Java.
2. More control on <camera>, <audio>, <music>, <video> in ManiaLinks
Here, I would like that <audio> and <music> can be used in ManiaScript as CMlAudio having an CAudioSound attribute Audio. Same for video, in order to allow us to play, pause, stop, control the volume of the video.
For <camera>, having multiple camera support would be cool.
It's been quite a while since I find cool ideas to get ManiaScript to the max hype level. So here's my brain dump about this. Friends devs, feel free to add some of yours bellow.
1. Allow declaration of classes, enums
Code: Select all
Class CBonus {
declare CBonus::EBonusType Type;
declare Integer Level;
// Constructor
CBonus(CBonus::EBonusType _Type, Integer _Level) {
This.Type = _Type;
This.Level = _Level;
}
// Constructor overloading
CBonus(CBonus::EBonusType _Type) {
This.Type = _Type;
This.Level = 1;
}
Void ApplyBonusTo(CSmPlayer _Player) {
switch (This.Type) {
case CBonus::EBonusType::Stamina: {
if (_Player.StaminaMax < 3 - This.Level)
_Player.StaminaMax += MathLib::ToReal(This.Level);
else if (_Player.StaminaMax < 3)
_Player.StaminaMax = 3.;
}
case CBonus::EBonusType::Armor: {
if (_Player.ArmorMax < 10 - This.Level)
_Player.ArmorMax += MathLib::ToReal(This.Level);
else if (_Player.ArmorMax < 10)
_Player.ArmorMax = 10.;
}
}
}
}
Enum EBonusType {
Stamina, Armor;
}
The enum is just a simple list of names, separated with commas and ending with a semicolon.
Bellow is an example to instantiate a CBonus object.
Code: Select all
declare CBonus Foo <=> CBonus(CBonus::EBonusType::Armor, 2);
2. More control on <camera>, <audio>, <music>, <video> in ManiaLinks
Code: Select all
declare CMlAudio Music <=> (Page.GetFirstChild("audio") as CMlAudio);
while (True) {
if (!Music.Audio.DownloadInProgress && !Music.Audio.IsPlaying) {
Music.Audio.Play();
}
}
For <camera>, having multiple camera support would be cool.
