[Help] Make it Validable
Posted: 01 Aug 2012, 17:21
I am working in a map type script (writing in the platform script
) , and appears I am having a syntax error:

This is what I modified in the original script:
And probably that's why the maps with this script can't be validable...
(this is the same code in both scripts)
Where is the error in my code?
(Please, be patient with me, I do not have experience with programing)


This is what I modified in the original script:
Code: Select all
//////////////////
// Time attack maps: You need to go to the finish with the highest time score
//////////////////
#RequireContext CTmMapType
#Include "TextLib" as TextLib
#Include "Libs/Nadeo/MapType.Script.txt"
#Include "Libs/TrackMania/TMPlatform.Script.txt" as TimeAttachLib
#Const SupportedTasks "Validation"
/////////////////////////////////////
// Validate
Void SetObjectives(Integer _Author, Integer _Gold, Integer _Silver, Integer _Bronze, Integer _NbCheckpoints)
{
declare metadata Integer ObjectiveAuthor for Map;
declare metadata Integer ObjectiveGold for Map;
declare metadata Integer ObjectiveSilver for Map;
declare metadata Integer ObjectiveBronze for Map;
declare metadata Integer RaceCheckpoints for Map;
ObjectiveAuthor = _Author;
ObjectiveGold = _Gold;
ObjectiveSilver = _Silver;
ObjectiveBronze = _Bronze;
RaceCheckpoints = _NbCheckpoints;
Map.ObjectiveTextAuthor = """{{{ObjectiveAuthor}}} 100%""";
Map.ObjectiveTextGold = """{{{ObjectiveGold}}} 90%""";
Map.ObjectiveTextSilver = """{{{ObjectiveSilver}}} 65%""";
Map.ObjectiveTextBronze = """{{{ObjectiveBronze}}} 38%""";
}
Void SetDefaultObjectives(Integer _AuthorRespawns, Integer _NbCheckpoints)
{
/*
ObjectiveAuthor = _AuthorTime;
ObjectiveGold = _AuthorTime - 10%;
ObjectiveSilver = _AuthorTime - 35%;
ObjectiveBronze = _AuthorTime - 62%;
*/
SetObjectives(0, 0, 0, 0, _NbAuthorTime);
}
declare CBlock BlockStart;
declare CBlock[] BlockFinishs;
declare Integer[CBlock] BlockCheckpoints; // ordered
Void UpdateValidability()
{
BlockStart <=> Null;
BlockFinishs = CBlock[];
BlockCheckpoints = Integer[CBlock];
// analyse the blocks of the map
declare StartFound = 0;
declare IsMultiLap = False;
foreach(Block in Blocks) {
declare Type = Block.BlockModel.WayPointType;
if (Type == CBlockModel::EWayPointType::Start) { BlockStart <=> Block; StartFound += 1; }
if (Type == CBlockModel::EWayPointType::StartFinish) { BlockStart <=> Block; BlockFinishs.add(Block); StartFound += 1; IsMultiLap = True; }
if (Type == CBlockModel::EWayPointType::Finish) { BlockFinishs.add(Block); }
if (Type == CBlockModel::EWayPointType::Checkpoint) { BlockCheckpoints[Block] = 0; }
}
// Is there a start and finish
if(StartFound != 1) {
ValidationStatus = CMapType::ValidationStatus::NotValidable;
ValidabilityRequirementsMessage = _("This map requires exactly one start.");
return;
}
if (BlockCheckpoints.count == 0) {
ValidationStatus = CMapType::ValidationStatus::NotValidable;
ValidabilityRequirementsMessage = _("This map requires at least one checkpoint.");
return;
}
if (BlockFinishs.count == 0) {
ValidationStatus = CMapType::ValidationStatus::NotValidable;
ValidabilityRequirementsMessage = _("This map requires at least one finish.");
return;
}
// all the conditions are met to start the validation (or it is already validated)
if (ValidationStatus == CMapType::ValidationStatus::NotValidable)
ValidationStatus = CMapType::ValidationStatus::Validable;
}
(this is the same code in both scripts)
Where is the error in my code?
(Please, be patient with me, I do not have experience with programing)