Page 1 of 1

Validating a custom game type map

Posted: 25 May 2013, 19:24
by wDaan
Hey everyone,

I am trying to get the following custom map code to validate. As of now all it should check is if there is one spawn labelled 'Spawn' with order '0'. Whatever I try the editor keeps telling me 'map cannot be validated' as if somehow the script is faulty. Note that even though anchors shouldn't be editable (option set in main method) they are, leading me to believe something in my script is wrong indeed.

Code: Select all

#RequireContext CSmMapType
#Include "Libs/Nadeo/Anchor.Script.txt" as Anchor
#Const Version "2013-05-25

#Include "TextLib" as TL

// Initialize the anchors

Void InitAnchors() {
	foreach (Data in AnchorData) {
		Data.Tag = Data.DefaultTag;
		if (Data.DefaultTag == "Spawn") {
			Data.Order = Data.DefaultOrder;
		}
	}
}

// Check map validity
Void UpdateValidability() {
	InitAnchors();
	Anchor::UpdateAnchorCounts();
	
	if (!Anchor::HasAtLeastOneAnchor("Spawn", 0, TL::Compose(_("Place at least one spawn."))) {
		return;
	}
	
	ValidationStatus = CMapType::ValidationStatus::Validated;
}

main() {
	InitAnchors();
	UpdateValidability();
	CustomEditAnchorData = False;
	while (True) {
		yield;
		ManialinkText = "";
		foreach (Event in PendingEvents) {
			if (Events.Type == CPluginEvent::Type::MapModified) {
				UpdateValidability();
			}
		}
	}
}
It appears really straightforward from the examples but yet I can't get it to work. Any help would be appreciated.

Re: Validating a custom game type map

Posted: 25 May 2013, 19:27
by steeffeen

Code: Select all

#Const Version "2013-05-25
isn't there a " missing?
try pressing Ctrl+G to see the log, there you will see an error that the script isn't running properly

Re: Validating a custom game type map

Posted: 25 May 2013, 19:43
by wDaan
Thanks for your reply. Feel really retarded for missing that one but I was debugging by hand. This log is very useful and will probably help me solve the problems. Thanks.


EDIT: the issue at hand is fixed. Problems were just a couple of small errors which were easily fixed through the compiler log.