Page 1 of 1

Need some help with my coding

Posted: 12 Feb 2021 19:14
by alc
Hi guys,
I can't figure out what I am doing wrong with the declarations or passing the parameters that I can't make my GS work the way a want. I get "Your script made an error: the index "_storypage" does not exist" where _storypage is a global array.
When I run the same commands directly on the calling function, it works ok, but when I create a function I get this error.

Code: Select all

this.UpdateStoryPage(company + fruitwaiting, Vehicles);

function MainClass::UpdateStoryPage(page, Vehicles);
{
	local Vehicle = null;
	if (GSStoryPage.IsValidStoryPage(_storypage[page])) {
		// Remove previous elements
		local StoryPageElementList = GSStoryPageElementList(page)
		GSLog.Info("Cantidad de elementos " + StoryPageElementList.Count ());
		for (local StoryPageElement = StoryPageElementList.Begin(); !StoryPageElementList.IsEnd(); StoryPageElement = StoryPageElementList.Next()) {
			GSStoryPage.RemoveElement(StoryPageElement)
		}
		// Add new elements
		GSStoryPage.SetDate(page, GSDate.GetCurrentDate());
		for (Vehicle = Vehicles.Begin(); !Vehicles.IsEnd(); Vehicle = Vehicles.Next()) {
			GSStoryPage.NewElement(this._storypage[page], GSStoryPage.SPET_LOCATION, GSVehicle.GetLocation(Vehicle), GSVehicle.GetName(Vehicle));
		}
	}
}
I believe I have some missing declaration or somethins as also I need to do an intersection function with two tile lists and have the same problem. I saw some others GS and AIs and I didn't find some different declaration... ?(

Thanks,
Alberto