Runtime error

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
volum
Posts: 19
Joined: 19 Aug 2011, 12:17

Runtime error

Post 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?
User avatar
w1lla
Posts: 2287
Joined: 15 Jun 2010, 11:09
Location: Netherlands
Contact:

Re: Runtime error

Post 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
TM² Info
SM Info
QM Info

OS: Windows 10 x64 Professional
MB: MSI 970A-G46
Processor: AMD FX-6300 3500 mHz
RAM Memory: 16 GB DDR3
Video: SAPPHIRE DUAL-X R9 280X 3GB GDDR5
KB: Logitech G510s
Mouse: Logitech G300s
Mode Creation
ManiaScript Docs
volum
Posts: 19
Joined: 19 Aug 2011, 12:17

Re: Runtime error

Post 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?
User avatar
steeffeen
Translator
Translator
Posts: 2463
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: Runtime error

Post 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?
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    volum
    Posts: 19
    Joined: 19 Aug 2011, 12:17

    Re: Runtime error

    Post 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
    User avatar
    Xymph
    Posts: 1399
    Joined: 15 Jun 2010, 20:35
    Contact:

    Re: Runtime error

    Post by Xymph »

    Use Code tags around your code, makes it much more readable.
    Developer of XASECO for TMF/TMN ESWC & XASECO2 for TM²: see XAseco.org
    Find your way around the Mania community from the TMN ESWC hub, TMF hub, TM² hub, and SM hub
    User avatar
    steeffeen
    Translator
    Translator
    Posts: 2463
    Joined: 14 Oct 2012, 16:22
    Location: Germany

    Re: Runtime error

    Post 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"?
      Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

      ManiaControl, FancyManiaLinks
      Post Reply

      Return to “ManiaScript”

      Who is online

      Users browsing this forum: No registered users and 2 guests