EDCD / EDDI

Companion application for Elite Dangerous
Other
437 stars 81 forks source link

EDDI v4.1.0-a2 crash to desktop #2631

Closed Darkcyde13 closed 3 weeks ago

Darkcyde13 commented 3 weeks ago

What's Wrong (please be as specific as possible)

Expected

EDDI to handle errors gracefully,

Observed

EDDI crashes to desktop, after a couple of "Error with this script: Index was outside the bounds of the array..."

Steps to reproduce

  1. Use my version of 'Mission accepted'. It seems to have some code in it somewhere that's causing this to happen.
  2. Click the 'Test' button.
  3. Observe the error "Error with this script: Index was outside the bounds of the array..." (sometimes has part of the script resolve at the end), or a straight CTD.
  4. Click the test button a few more times, EDDI will CTD after a couple of tries.

Configuration

My Investigation

Investigation Notes

I've been testing the upgrades I've had to make to many of my scripts to bring them up to spec with v4.1.0, and when I tried taking a mission in order to test my Autoroute upgrades, I got the above error. While investigating by clicking the test button in Mission accepted, EDDI crashed to desktop. I can reliably get this to happen every time, but sometimes I get the error a couple of times before the crash, while other times it will crash straight away.

Sometimes it will resolve the last part of the script, where it says "You have one mission", and then runs my Missions Autoroute (which strangely says I have no missions, so I need to look into that). I have tried disabling that script, but the error still happens.

When I try it with VA, it also kills VA.

Here's a copy of my updated Mission accepted script. No changes to this for v4.1.0, so this is how I have had it working in v4.0.4.


{_ Context _}
{SetState('eddi_context_last_subject', 'mission')}
{SetState('eddi_context_last_action', 'accepted')}

{_ Rescue mission data setup _}
{if len(state.rescue_mission_data) > 0:
    {set missComm to split(state.rescue_mission_data, ',')}
|else:
    {set missComm to []}
}

{_ Setup capitalisation function _}
{set capitalise(string) to:
    {set string to split(string, " ")}
    {set cur to 0}
    {for word in string:
        {set char_test to ord(slice(word, 1, 1))}
        {if char_test < 91 && char_test > 64:
            {set word to lcase(word)}
            {set string to union(string, [cur:token(word, slice(word, 1, 2), 0, char(ord(word) - 32))])}
        }
        {set cur to cur + 1}
    }
    {set string to join(string, " ")}
    {return(string)}
}

{if event.invariantTags[0] = "Donation":
    {OneOf("You have chosen", "Mission accepted")} to {Occasionally(2, "generously")} donate
    {if event.invariantTags[1] = "Credits": credits |else: {event.commodity}} to
    {OneOf("{P(capitalise(event.faction), 'faction')} in order to {OneOf('improve', 'raise', 'increase')}      
            your {OneOf('reputation', 'standing')} with this faction",
           "{OneOf('improve', 'raise', 'increase')} your {OneOf('reputation', 'standing')} with
            {P(capitalise(event.faction), 'faction')}")}
|elif event.communal:
    You have accepted the community goal: {event.localisedname}
|elif find(event.invariantTags[0], "Permit") > -1:
    {P(capitalise(event.faction), 'faction')} has issued you with a system
    {OneOf("access", "clearance")} purhmit.
|else:
    {if find(event.invariantTags, "Transport") > -1:
        {set type to cat("Transport ", event.passengertype, " mission")}
    |elif event.invariantTags[0] = "On Foot":
        {if event.invariantTags[2] = "Covert": {set covert to "co-vert "}}
        {if event.invariantTags[1] = "Collection" || event.invariantTags[1] = "Delivery":
            {set type to "Courier"}
        |else: {set type to event.tags[1]}}
        {set type to cat("On foot ", covert, type, " mission")}
    |else:
        {set type to cat(event.tags[0], " mission")}
    }

    {OneOf("{type} {if event.faction: for {P(capitalise(event.faction), 'faction')}} accepted",
           "{type} accepted {if event.faction: for {P(capitalise(event.faction), 'faction')}}",
           "You have accepted {if StartsWithVowel(type): an |else: a } {type}
            {if event.faction: for {P(capitalise(event.faction), 'faction')}}")}
}

{Occasionally(2, F("Mission faction state"))}..

{if event.passengerwanted:
    Warning! You are now {OneOf("transporting", "carrying")}
    {OneOf("{OneOf('wanted', 'illegal')} {OneOf('passengers', 'personnel')}", "known felons")}!
    You may be attacked by {Occasionally(2, "system")} {OneOf("authority", "police")}.
    Caution is advised.  Avoid being scanned.

|elif find(event.invariantTags, "Skimmer") > -1:
    This is a surface {OneOf("mission", "operation")}.

|elif find(event.invariantTags, "Surface") > -1:
    This is a surface {OneOf("mission", "operation")}, you will require an SRV.
}

{if !event.communal:
    {if missionsCount = 20:
        You have now reached the maximum number of missions you can take.
        Please complete some, in order to accept more.
    |else:
        {set reportMissionCount to:
            {OneOf("You {Occasionally(2, 'now')} have {missionsCount} 
                    {if missionsCount > 1: missions |else: mission}",
                   "{OneOf('That is', 'This is')} your
                    {if missionsCount = 1: 1st
                    |elif missionsCount = 2: 2nd
                    |elif missionsCount = 3: 3rd
                    |else: {missionsCount}th
                    }
                    mission"
            )}.
        }
        {Occasionally(max(cmdr.combatrating.rank - missionsCount, 1), reportMissionCount)}
    }
}

{if (find(event.invariantTags, "Delivery") > -1 || find(event.invariantTags, "Supply") > -1
  || find(event.invariantTags, "Smuggle") > -1) && event.invariantTags[0] != "On Foot":
    {Pause(400)}
    {event.amount} {if event.amount = 1: tonne |else: tonnes} of {event.commodity}

    {set onboard to false}
    {for cargo in inventory:
        {if cargo.name = event.commodity:
            {for haulage in cargo.haulageData:
                {if haulage.missionid = event.missionid && haulage.need = 0:
                    {set onboard to true}
                }
            }
        }
    }

    {if onboard: 
        now {OneOf("added to the ship's manifest", "loaded on board", "stored in the cargo hold")}
    |else:
        to be {OneOf("delivered", "transported")}. Please collect from the Cargo Depot
    }.
}

{if event.passengertype:
    {for mission in missions:
        {if event.passengertype: {set passsenger_missions to passsenger_missions + 1}}
    }
    {for comp in ship.compartments:
        {if find(comp.module.name, "Passenger") > -1: {set cabins to cabins + 1}}
    }
    {if passsenger_missions = cabins:
        All cabins are now occupied.  You may begin departure preparations {F("Honorific")}.
    }
}

{if event.invariantTags[0] = "Rescue":
        {_ Workaround for Rescue missions that don't have proper Journal events _}
        {_ Add to custom data store _}

        {_ Add new data _}
        {set newData to cat(event.missionid, "-0-Active")}

        {_ Build State variable _}
        {set missComm to cat(missComm, [newData])}
        {set rescueMissData to join(missComm, ',')}
        {SetState('rescue_mission_data', rescueMissData)}
}

{SetState('missions_recalc', true)}
{SetState('routedetails_count', missionsCount)}
{SetState('routedetails_destination', void)}

{if (status.vehicle != "On Foot" && status.docked != true)
  || (status.vehicle = "On Foot" && status.on_foot_in_station != true):
    {F("Missions Autoroute")}
|elif state.eddi_context_mission_accepted != true && event.destinationsystem
  && event.destinationsystem != system.systemname:
    Undock to
    {if state.missions_completed != true || missionsCount = 1:
        calculate {OneOf("the", "your")} mission route
    |else:
        update {OneOf("the", "your")}
        existing {Occasionally(2, "mission")} route
    }.
    {SetState('eddi_context_mission_accepted', true)}
}

EDDI Logs

Verbose log: eddi.log

Player journals

N/A

Tkael commented 3 weeks ago

Resolved via Discord chat.