Page 1 of 1

Runtime error

Posted: 16 Jan 2013, 19:18
by volum
Hi,

Got this problem during battlewaves game, it only happened once, but what it might be?
this msg came to chat:
runtime error: [modes/shootmania/battle.script.txt : 214, 60] called from: 96, 42] invalid access to parameter (null object or elem not found in array) : pendingevents[0].victim>.curretnclan
Restarting match...

im not sure if it happened after team captured last pole, but match was stopped and map restarted
Any help?

Re: Runtime error

Posted: 16 Jan 2013, 19:42
by w1lla
Hi,

it seems that the script the server is running on has a mistyped currentclan.

If its your own server it can be easily fixed:

change curretnclan with CurrentClan

Re: Runtime error

Posted: 16 Jan 2013, 19:49
by volum
Sorry it was my typo :oops: In origina error msg it was written 'current',
Could there be other solutions? When does this type error can happen, is it when showing results or specific amount of wins?

Re: Runtime error

Posted: 16 Jan 2013, 21:06
by steeffeen
if it would be the wrong written attribute the server wouldn't even start up ;)

".Victim>" shows that this attribute is Null, that's why you can't access its attribute .CurrentClan
there is obviously a logical error in the script, are you able to post it?

Re: Runtime error

Posted: 19 Jan 2013, 05:52
by volum
You mean whole script or parts?

This is in line 214:
} else if (UseClans && Event.Shooter.CurrentClan == Event.Victim.CurrentClan) {

Whole part near by 214:

/* -------------------------------------- */
// Play loop
/* -------------------------------------- */
***PlayLoop***
***
foreach (Event in PendingEvents) {
if (Event.Type == CSmModeEvent::EType::OnHit) {
if (Event.Shooter == Null || Event.Victim == Null || Event.Shooter == Event.Victim) {
Discard(Event);
} else if (UseClans && Event.Shooter.CurrentClan == Event.Victim.CurrentClan) {
Discard(Event);
} else {
if (Event.Damage > 0) {
Score::AddPoints(Event.Shooter, 1);
Top::IncrementPlayerPoints("Damages", Event.Shooter, 1);
}
PassOn(Event);
}
} else if (Event.Type == CSmModeEvent::EType::OnArmorEmpty) {
BalancedWeapons::OnOut(Event.Shooter, Event.Victim);
PassOn(Event);
} else if (Event.Type == CSmModeEvent::EType::OnCapture) {
LastestCapturedGoalId = Event.BlockPole.Id;
PassOn(Event);
} else{
PassOn(Event);
}
}

Line 96:
// Add Top 5
Top::AddTop("Capture", 5);
Top::AddTop("Damages", 5);

Whole part near by line 96:

// Set mode options
UseClans = True;
MB_UseSectionRound = True;
MB_UsePlayerClublinks = S_UsePlayerClublinks;

// Add Top 5
Top::AddTop("Capture", 5);
Top::AddTop("Damages", 5);

/* -------------------------------------- */
// Create layers
declare LayerTops <=> UIManager.UILayerCreate();
declare LayerRoundInfo <=> UIManager.UILayerCreate();
declare LayerTeams <=> UIManager.UILayerCreate();
declare LayerTeamsForSpectators <=> UIManager.UILayerCreate();
Interface::SetLayerTeams(LayerTeams);
Interface::SetLayerTeamsForSpectators(LayerTeamsForSpectators);

Script should be original and i havent changed it. Error came only one time and hasnt appeared in 30+ plays after

Re: Runtime error

Posted: 19 Jan 2013, 09:22
by Xymph
Use Code tags around your code, makes it much more readable.

Re: Runtime error

Posted: 20 Jan 2013, 15:43
by steeffeen
thanks for posting the code!

but... actually... i'm... clueless...
i don't know how this could happen!

line 212 checks if the shooter attribute of the Event is null

Code: Select all

if (Event.Shooter == Null || Event.Victim == Null || Event.Shooter == Event.Victim) {
and if this is not the case the game goes into line 214 and accesses the shooter object

Code: Select all

} else if (UseClans && Event.Shooter.CurrentClan == Event.Victim.CurrentClan) {
that's why i have no idea why the game crashed in line 214 because the shooter object was null... it shouldn't try to access it after the check in line 212 :?:
anyone got an idea?

i also wonder why it says
called from: 96, 42
as the line 96 has nothing to do with the event (in none of battlewaves, battle and modebase scripts)
does somebody know which line is meant by "96, 42"?