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));
}
}
}
Thanks,
Alberto