cmdrmcdonald / EliteDangerousDataProvider

Apache License 2.0
134 stars 31 forks source link

EDDI ver 3.0.1-b1 Commodity Sale Check scripted reporting cargo incorrectly. #313

Open jbartoli opened 6 years ago

jbartoli commented 6 years ago

The EDDI Commodity Sale Check script is reporting my current cargo on all ships incorrectly. To be more precise it is remembering cargo that I have sold previously or even dumped. it usually takes several game sessions or trading trips before it forgets the old cargo. I've tried restarting EDDI and VoiceAttack, and resetting the Frontier API and plugins, but that has not help. It's not a major issue but it is a little annoying. Other then this issue everything else works great. I think this is one of the most helpful apps out there for ED. Here is a copy of the script from EDDI:

{_ Function to find a given commodity in market} {set market(commodity) to: {for marketcommodity in station.commodities: {if marketcommodity.EDDBID = commodity.EDDBID: {return marketcommodity} } } }

{set totalprofit to 0} {set missioncommodities to []} {set profitablecommodities to []} {set stolencommodities to []} {set unknowncommodities to []}

{for cargo in inventory: {if cargo.name != 'Limpet': {set marketcommodity to market(cargo.commodity)} {set profit to (marketcommodity.sellprice - cargo.price) * cargo.other}

    {if cargo.stolen > 0:
        {set stolencommodities to cat(stolencommodities, [cargo.commodity])}
    |elif cargo.haulage > 0:
        {set missioncommodities to cat(missioncommodities, [cargo.commodity])}
    |elif !marketcommodity:
        {set unknowncommodities to cat(unknowncommodities, [cargo.commodity])}
    |elif marketcommodity && profit > 0:
        {set profitablecommodities to cat(profitablecommodities, [cargo.commodity])}
        {set totalprofit to totalprofit + profit}
    }
}

}

{_ Let the user know about any commodities they can sell here for a profit} {if len(profitablecommodities) > 0: You can sell your {if len(profitablecommodities) = 1: {profitablecommodities[0].name} |elif len(profitablecommodities) = 2: {profitablecommodities[0].name} and {profitablecommodities[1].name} |else: {set cur to 0} {while cur < len(profitablecommodities): {if cur = 0: {profitablecommodities[cur].name} |elif cur < len(profitablecommodities) - 1: , {profitablecommodities[cur].name} |else: , and {profitablecommodities[cur].name} } {set cur to cur + 1} } } for a profit of {totalprofit} credits. }

{_ Let the user know about any commodities about which we are unsure if they can sell for a profit} {if len(unknowncommodities) > 0: You could {if len(profitablecommodities) > 0: also } sell your {if len(unknowncommodities) = 1: {unknowncommodities[0].name} |elif len(unknowncommodities) = 2: {unknowncommodities[0].name} and {unknowncommodities[1].name} |else: {set cur to 0} {while cur < len(unknowncommodities): {if cur = 0: {unknowncommodities[cur].name} |elif cur < len(profitablecommodities) - 1: , {unknowncommodities[cur].name} |else: , and {unknowncommodities[cur].name} } {set cur to cur + 1} } } , although check potential profits for {if len(unknowncommodities) > 1: these |else: this} before confirming the transaction. }

{_ Let the user know about any stolen commodities they can sell on the black market} {if len(stolencommodities) > 0: {if station.hasblackmarket: You can fence your stolen {if len(stolencommodities) = 1: {stolencommodities[0].name} |elif len(stolencommodities) = 2: {stolencommodities[0].name} and {stolencommodities[1].name} |else: {set cur to 0} {while cur < len(stolencommodities): {if cur = 0: {stolencommodities[cur].name} |elif cur < len(stolencommodities) - 1: , {stolencommodities[cur].name} |else: , and {stolencommodities[cur].name} } {set cur to cur + 1} } } here. |else: Reminder: you {OneOf("have stolen cargo on-board", "have stolen goods on-board", "are carrying stolen goods", "are carrying stolen cargo")}. } }

{_ Let the user know about any mission related commodities they can sell on the black market} {if len(missioncommodities) > 0 && station.hasblackmarket:

You can {if len(stolencommodities) > 0: also} {OneOf('offload', 'dump')} your mission related
{if len(missioncommodities) = 1:
    {missioncommodities[0].name}
|elif len(missioncommodities) = 2:
    {missioncommodities[0].name} and {missioncommodities[1].name}
|else:
    {set cur to 0}
    {while cur < len(missioncommodities):
        {if cur = 0:
            {missioncommodities[cur].name}
        |elif cur < len(missioncommodities) - 1:
            , {missioncommodities[cur].name}
        |else:
            , and {missioncommodities[cur].name}
        }
Tkael commented 6 years ago

This repo is no longer maintained by the original dev. Please report issues for EDDI to https://github.com/EDCD/EDDI/issues. The latest releases are available here: https://github.com/EDCD/EDDI/releases