Hi All,
I am trying to understand and debug a ManiaScript Code written by Mewin for having a CTF server working properly.
I was able to update some Manialinks from version 1 to 4 and to launch a remote server (Linux) and connect on it.
Now I am trying to use the "Compile" button in the inGame Editor. it stop directly on the 1st warning indicating "Overriding SpawnPlayer" from the read-only Nadeo File "SM.Script.txt". I know this is not an error.
My question is : How to ignore Warning with Compile button and / or how to check the next Warning or Error ... ?
Many thanks for your answer, I am discovering this language and the tools ^^
ManiaScript Compile WARNING
Moderator: English Moderator
- Dommy
- Translator
- Posts: 1901
- Joined: 25 Aug 2011, 21:45
- Manialink: exchange
- Location: Poland
- Contact:
Re: ManiaScript Compile WARNING
To ignore compilation warnings, just press the Save button, the game mode will be compiled and should start, unless there are fatal errors. You can also use a normal workspace outside your game and reload the files by pressing Shift + Scroll Lock, just for the sake of your own comfort of work.
Nadeo should take care of this compilation warning though, simply because SM library is compiled before any custom library, making it nearly impossible to see potential optimizations available for your code.
By the way, the newest manialink feature version is 3, not 4.
Nadeo should take care of this compilation warning though, simply because SM library is compiled before any custom library, making it nearly impossible to see potential optimizations available for your code.
By the way, the newest manialink feature version is 3, not 4.
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
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT
Contact me via GALAXY & PURSUIT DISCORD
Re: ManiaScript Compile WARNING
SM.Script.txt is an old library that is still available for backward compatibility reason. The latest version of the library (Libs/Nadeo/ShootMania/SM3.Script.txt) fixes this problem. The SpawnPlayer() function was renamed Spawn() to avoid the warning.
It doesn't look like the CTF script extends from the Nadeo ModeBase, so you should be able to get rid of the warning by replacing SM.Script.txt by SM3.Script.txt and adjusting the code a bit to call the new function.
It doesn't look like the CTF script extends from the Nadeo ModeBase, so you should be able to get rid of the warning by replacing SM.Script.txt by SM3.Script.txt and adjusting the code a bit to call the new function.
Re: ManiaScript Compile WARNING
Many Thanks Dommy and Eole,
I tried to replace SM Script by SM3 Script.
I am facing an issue with the following line :
I tried to replace it with :
But I get an error : "Incorrect Arguements to call the function Spawn"
But in SM3.Script.txt The function with same arguments exists ... :
+ CTF script is using GetPole function which no longer exists in SM3.
Sorry : I am a very newbie with ManiaScript. Usually I can debug with other langages by displaying variables values for understanding by myself, but ther is no "echo" or "print_r" possibilities in ManiaScript as far as I know (or maybe I didn't find...)
I hope I will be able to understand and help to update this Script. Mewin said he cannot help me as he didn't use ManiaScript for years
I tried to replace SM Script by SM3 Script.
I am facing an issue with the following line :
Code: Select all
SM::SpawnPlayer(Player, Player.RequestedClan, BlockSpawns[SpawnId],Now);
Code: Select all
SM3::Spawn(Player, Player.RequestedClan, BlockSpawns[SpawnId],Now);
But in SM3.Script.txt The function with same arguments exists ... :
Code: Select all
// ---------------------------------- //
/** Spawn a player
*
* @param _Player The player to spawn
* @param _ClanNum The clan in which the player will be spawned
* @param _Landmark The landmark where the player will be spawned
* @param _ActivationDate When the player will be spawned
*/
Void Spawn(CSmPlayer _Player, Integer _ClanNum, CSmMapPlayerSpawn _Spawn, Integer _ActivationDate) {
This.SpawnPlayer(_Player, _ClanNum, -1, _Spawn, _ActivationDate);
if(_Player.Score != Null) Ladder::AddPlayer(_Player.Score);
}
Sorry : I am a very newbie with ManiaScript. Usually I can debug with other langages by displaying variables values for understanding by myself, but ther is no "echo" or "print_r" possibilities in ManiaScript as far as I know (or maybe I didn't find...)
I hope I will be able to understand and help to update this Script. Mewin said he cannot help me as he didn't use ManiaScript for years
Re: ManiaScript Compile WARNING
You can use the log() function to do that.
Code: Select all
declare Variable = 15;
log(Variable);
declare Variable2 = 4.5;
log("Value of Variable2 : "^Variable2);
Indeed, the old SpawnPlayer() function requires a CSmBlockSpawn while the new Spawn() function needs a CSmMapLandmark. The old block api is deprecated and is replaced by the landmark api. In the script of the mode you have access to the MapLandmarks array that contains every landmark (spawn, pole, gate, ...) of the map.
You can get the landmarks you need to spawn the players from this array. If your needs are simple, you can try to include the library "Libs/Nadeo/ShootMania/Map.Script.txt". It contains a GetLandmarkPlayerSpawn() function that can help you get the spawn CSmMapLandmark. Same thing to replace GetPole(), you can use GetLandmarkGauge().
Re: ManiaScript Compile WARNING
Great !
Many thanks for yout time for answering.
It's now working using :
I will need to review the script by using more Lanmarks now
Many thanks for yout time for answering.
It's now working using :
Code: Select all
SM3::Spawn(Player, Player.RequestedClan, MapLandmarks_PlayerSpawn[SpawnId].PlayerSpawn, Now);
Who is online
Users browsing this forum: No registered users and 2 guests