Release EDDI Scripts and EDDI enabled VA Commands Thread

Hey Darkcyde, while testing I think I found a mission type that your mission store doesn't like... permit acquisition missions (the kind that some factions give when you become allied and are completed instantly once you select them).

These instantly completing permit acquisition missions should probably be ignored by the mission store.

Here's the relevant journal entry:
{ "timestamp":"2017-06-29T03:00:41Z", "event":"MissionAccepted", "Faction":"Hodack Prison Colony", "Name":"MISSION_genericPermit1", "Influence":"None", "Reputation":"None", "MissionID":158271736 }

Hi Tkael,

Thanks for that. I've made a slight modification that should handle that. In MissionStoreAdd change:

Code:
{if state.eddi_context_missions_accepted < 20:

to

Code:
{if state.eddi_context_missions_accepted < 20 && type != "Permit Aquisition mission":

Hopefully that will fix it! :)


-=] Darkcyde [=-

EDIT: Updated code for Permit Acquisition mission detection.
 
Last edited:
Finally had time to play again tonight and discovered that my 'upgrades' to the missions system have a fatal flaw. :(

The changes I made to MissionStoreDelete were a screw-up, meaning that when you completed a mission the whole database was wiped, but the number of missions you had would remain. I have fixed it now though. :/ Apologies to anyone affected by this.

Code:
{_ Remove completed/abandoned missions from the store}
{_ Finds the mission to delete and proceeds to copy the next store location into the current one}
{_ it then cascades until all missions are moved up by one location}

{_ Convert missionid to a string so it can be compared}
{set mission to cast(event.missionid, "s")}

{set mission_missionid to split(state.eddi_context_mission_missionid, "+=")}

{_ Find position of missionid in text array}
{set position to find(mission_missionid, mission)}

{if position > -1:

   {_ Split State Variables}
   {set mission_name to split(state.eddi_context_mission_name, "+=")}
   {set mission_destinationsystem to split(state.eddi_context_mission_destinationsystem, "+=")}
   {set mission_destinationstation to split(state.eddi_context_mission_destinationstation, "+=")}
   {set mission_commodity to split(state.eddi_context_mission_commodity, "+=")}
   {set mission_passengertype to split(state.eddi_context_mission_passengertype, "+=")}
   {set mission_targetname to split(state.eddi_context_mission_targetname, "+=")}
   {set mission_targettype to split(state.eddi_context_mission_targettype, "+=")}
   {set mission_communal to split(state.eddi_context_mission_communal, "+=")}
   {set mission_expiry to split(state.eddi_context_mission_expiry, "+=")}
   {set mission_originsystem to split(state.eddi_context_mission_originsystem, "+=")}
   {set mission_originstation to split(state.eddi_context_mission_originstation, "+=")}
   {set mission_roundtrip to split(state.eddi_context_mission_roundtrip, "+=")}

   {_ Build modified text string from temporary variable}
   {set mission_missionid to join(except(mission_missionid, [position:""]), "+=")}
   {set mission_name to join(except(mission_name, [position:""]), "+=")}
   {set mission_destinationsystem to join(except(mission_destinationsystem, [position:""]), "+=")}
   {set mission_destinationstation to join(except(mission_destinationstation, [position:""]), "+=")}
   {set mission_commodity to join(except(mission_commodity, [position:""]), "+=")}
   {set mission_passengertype to join(except(mission_passengertype, [position:""]), "+=")}
   {set mission_targetname to join(except(mission_targetname, [position:""]), "+=")}
   {set mission_targettype to join(except(mission_targettype, [position:""]), "+=")}
   {set mission_communal to join(except(mission_communal, [position:""]), "+=")}
   {set mission_expiry to join(except(mission_expiry, [position:""]), "+=")}
   {set mission_originsystem to join(except(mission_originsystem, [position:""]), "+=")}
   {set mission_originstation to join(except(mission_originstation, [position:""]), "+=")}
   {set mission_roundtrip to join(except(mission_roundtrip, [position:""]), "+=")}

   {_ Reset State variable ready for next use}
   {SetState('eddi_context_mission_missionid', mission_missionid)}
   {SetState('eddi_context_mission_name', mission_name)}
   {SetState('eddi_context_mission_destinationsystem', mission_destinationsystem)}
   {SetState('eddi_context_mission_destinationstation', mission_destinationstation)}
   {SetState('eddi_context_mission_commodity', mission_commodity)}
   {SetState('eddi_context_mission_passengertype', mission_passengertype)}
   {SetState('eddi_context_mission_targetname', mission_targetname)}
   {SetState('eddi_context_mission_targettype', mission_targettype)}
   {SetState('eddi_context_mission_communal', mission_communal)}
   {SetState('eddi_context_mission_expiry', mission_expiry)}
   {SetState('eddi_context_mission_originsystem', mission_originsystem)}
   {SetState('eddi_context_mission_originstation', mission_originstation)}
   {SetState('eddi_context_mission_roundtrip', mission_roundtrip)}

   {if state.eddi_context_missions_accepted > 0:
      {SetState('eddi_context_missions_accepted', state.eddi_context_missions_accepted - 1)}
   }
|else:
   Mission not found in database to delete.
}
 
Finally had time to play again tonight and discovered that my 'upgrades' to the missions system have a fatal flaw. :(

The changes I made to MissionStoreDelete were a screw-up, meaning that when you completed a mission the whole database was wiped, but the number of missions you had would remain. I have fixed it now though. :/ Apologies to anyone affected by this.

Code:
{_ Remove completed/abandoned missions from the store}
{_ Finds the mission to delete and proceeds to copy the next store location into the current one}
{_ it then cascades until all missions are moved up by one location}

{_ Convert missionid to a string so it can be compared}
{set mission to cast(event.missionid, "s")}

{set mission_missionid to split(state.eddi_context_mission_missionid, "+=")}

{_ Find position of missionid in text array}
{set position to find(mission_missionid, mission)}

{if position > -1:

   {_ Split State Variables}
   {set mission_name to split(state.eddi_context_mission_name, "+=")}
   {set mission_destinationsystem to split(state.eddi_context_mission_destinationsystem, "+=")}
   {set mission_destinationstation to split(state.eddi_context_mission_destinationstation, "+=")}
   {set mission_commodity to split(state.eddi_context_mission_commodity, "+=")}
   {set mission_passengertype to split(state.eddi_context_mission_passengertype, "+=")}
   {set mission_targetname to split(state.eddi_context_mission_targetname, "+=")}
   {set mission_targettype to split(state.eddi_context_mission_targettype, "+=")}
   {set mission_communal to split(state.eddi_context_mission_communal, "+=")}
   {set mission_expiry to split(state.eddi_context_mission_expiry, "+=")}
   {set mission_originsystem to split(state.eddi_context_mission_originsystem, "+=")}
   {set mission_originstation to split(state.eddi_context_mission_originstation, "+=")}
   {set mission_roundtrip to split(state.eddi_context_mission_roundtrip, "+=")}

   {_ Build modified text string from temporary variable}
   {set mission_missionid to join(except(mission_missionid, [position:""]), "+=")}
   {set mission_name to join(except(mission_name, [position:""]), "+=")}
   {set mission_destinationsystem to join(except(mission_destinationsystem, [position:""]), "+=")}
   {set mission_destinationstation to join(except(mission_destinationstation, [position:""]), "+=")}
   {set mission_commodity to join(except(mission_commodity, [position:""]), "+=")}
   {set mission_passengertype to join(except(mission_passengertype, [position:""]), "+=")}
   {set mission_targetname to join(except(mission_targetname, [position:""]), "+=")}
   {set mission_targettype to join(except(mission_targettype, [position:""]), "+=")}
   {set mission_communal to join(except(mission_communal, [position:""]), "+=")}
   {set mission_expiry to join(except(mission_expiry, [position:""]), "+=")}
   {set mission_originsystem to join(except(mission_originsystem, [position:""]), "+=")}
   {set mission_originstation to join(except(mission_originstation, [position:""]), "+=")}
   {set mission_roundtrip to join(except(mission_roundtrip, [position:""]), "+=")}

   {_ Reset State variable ready for next use}
   {SetState('eddi_context_mission_missionid', mission_missionid)}
   {SetState('eddi_context_mission_name', mission_name)}
   {SetState('eddi_context_mission_destinationsystem', mission_destinationsystem)}
   {SetState('eddi_context_mission_destinationstation', mission_destinationstation)}
   {SetState('eddi_context_mission_commodity', mission_commodity)}
   {SetState('eddi_context_mission_passengertype', mission_passengertype)}
   {SetState('eddi_context_mission_targetname', mission_targetname)}
   {SetState('eddi_context_mission_targettype', mission_targettype)}
   {SetState('eddi_context_mission_communal', mission_communal)}
   {SetState('eddi_context_mission_expiry', mission_expiry)}
   {SetState('eddi_context_mission_originsystem', mission_originsystem)}
   {SetState('eddi_context_mission_originstation', mission_originstation)}
   {SetState('eddi_context_mission_roundtrip', mission_roundtrip)}

   {if state.eddi_context_missions_accepted > 0:
      {SetState('eddi_context_missions_accepted', state.eddi_context_missions_accepted - 1)}
   }
|else:
   Mission not found in database to delete.
}

I hadn't noticed a problem, but that you for finding and fixing it!
 
I hadn't noticed a problem, but that you for finding and fixing it!

I'd upgraded some of the scripts after discovering new commands and better ways to do things while writing the Fines & Bounties system, so if you haven't used that (Fines & Bounties, posted above) then you wouldn't have seen it. I must have done the MissionStoreDelete one while tired and wasn't paying attention. :p
 
I'd upgraded some of the scripts after discovering new commands and better ways to do things while writing the Fines & Bounties system, so if you haven't used that (Fines & Bounties, posted above) then you wouldn't have seen it. I must have done the MissionStoreDelete one while tired and wasn't paying attention. :p

So about that new update Darkcyde....? How is that coming for us lazy folks? Lol.:rolleyes:
 
Has something changed in regarding reporting fuel levels?

I have this in the [Jumped] script in EDDI that reports low fuel levels but today it seems to not be working. I haven't changed anything with this script and has been working perfectly since I installed it.

{set currentfuel to (event.fuelremaining / ship.fueltanktotalcapacity)}
{Pause(1000)}


{if currentfuel < 0.08:
RED ALERT! REFUEL IMMEDIATELY! {OneOf("Critical fuel level: ", "We have ")} {Humanise(event.fuelremaining)} tonnes remaining.
|elif currentfuel < 0.16:
Fuel reserves at minimum. Fuelscooping is advised! {OneOf("Fuel: ", "We have ")} {Humanise(event.fuelremaining)} tonnes remaining.
|elif currentfuel <= 0.25:
Attention, Fuel level is {OneOf("25%", "quarter tank","low")}. {Humanise(event.fuelremaining)} tonnes remaining.
|elif currentfuel <= 0.5:
{Humanise(event.fuelremaining)} tonnes of fuel remain.
}
I nearly ran out of fuel 3 times in a brand new FAS, man I rely on EDDI and scripting too much but I love it.
 
So about that new update Darkcyde....? How is that coming for us lazy folks? Lol.:rolleyes:

Well, the 'Fines & Bounties' I posted the other day is also a complete snap-shot of the whole EDDI personality & VA profile I created, so it has all the things I've updated in it too. Just be aware that the MissionStoreDelete will need updating as I mention above. ;) The only thing the RAR file doesn't have is the change log.

I've been made aware (by JRohrer) of what would appear to be a behind-the-scenes change by FDev regarding the multi-stop passenger missions and how the destinations are reported in the Player Journal. Basically, the multi destinations are all stored in the one variable for 'Destination' now, so the mission system has started reporting these as one long string. I've had a couple of ideas how to overcome this and make them useful in my system, I just need to find the time this weekend to try coding it all. :)
 
Last edited:
Hey Darkcyde!

Looking at your Fines & Bounties code. Great work!

I enjoy 'bumming code' and If I may be so presumptuous, I made a pass on 'tightening up' your 'FinesBounties_Add' script.

My suggestion is that once you go into 'array space' via split(), stay there. Perform updates using union() and additions using cat( , []) to the arrays and don't go back to 'eddi_context' strings until the very end. The code is much more readable and also may run a bit faster.

I've also changed the {for factions in bounties_faction_array: loop to {set start to 0}, {set position to find(bounties_faction_array, evtfaction, start} with {while position > -1:

Whenever a matching faction is found, {set start to position + 1} and the next find() skips past the previous match.

This saves you from traversing the entire faction array to find each matching faction... a little bit of a shortcut.

Code:
{_ FinesBounties_Add }
{_ Add Bonds, Bounties & Fines to memory store }


{_ To Do: Timers. Check Major or Minor for time to add?}
{_ Minor = 10 mins, Major = 7 days?}

{if state.eddi_context_bounties_initialised != "yes": {F("FinesBounties_Initialise")}}

{if state.eddi_context_last_subject = "bond":
    {set type to "Bond"}
    {set subtype to "None"}
    {set evtrewards to [event.awardingfaction: event.reward]}
    {set timer to 0}

|elif state.eddi_context_last_subject = "bounty" && state.eddi_context_last_action = "award":
    {set type to "Bounty"}
    {set subtype to "None"}
    {set evtrewards to []}
    {for reward in event.rewards:
        {set evtrewards to union(evtrewards, [reward.faction: reward.amount])}
    }
    {set timer to 0}

|elif state.eddi_context_last_subject = "bounty" && state.eddi_context_last_action = "incur":
    {set type to "BountyInc"}
    {set subtype to "Active"}
    {set evtrewards to [event.faction: event.bounty]}
    {set timer to timer + SecondsSince(0)}

|elif state.eddi_context_last_subject = "fine":
    {set type to "Fine"}
    {set subtype to "Active"}
    {set evtrewards to [event.faction: event.fine]}
    {set timer to 604800 + SecondsSince(0)}
}

{set bounties_type_array to split(state.eddi_context_bounties_type, "+=")}
{set bounties_subtype_array to split(state.eddi_context_bounties_subtype, "+=")}
{set bounties_faction_array to split(state.eddi_context_bounties_faction, "+=")}
{set bounties_amount_array to split(state.eddi_context_bounties_amount, "+=")}
{set bounties_timer_array to split(state.eddi_context_bounties_timer, "+=")}

{for evtfaction, evtamount in evtrewards:

    {set start to 0}
    {set position to find(bounties_faction_array, evtfaction, start}
    {set updatedata to 0}

    {while position > -1:

        {set start to position + 1}
        {if (bounties_type_array[position] = type) || (bounties_type_array[position] = "Fine" && type = "BountyInc"):

            {_ Add amount to stored amount }
            {set amount to evtamount + bounties_amount_array[position]}

            {if system.power = "Arissa Lavigny-Duval":

                {_ If in Arisa Lavigny-Duval controlled space get extra bounty }
                {if system.powerstate = "Controlled" || system.powerstate = "Exploited":

                    {_ Unfortunately the variables needed for this are not yet available in EDDI, }
                    {_ but this is a placeholder in case they are implemented in the future. }

                    {_ if unaligned, and power galactic rank 3, 2 or 1 = +10%, +20% or +30% }

                    {_ if joined power}
                    {_ if personal rank in ALD is between 2 and 4 = +20% on to unaligned base amount}
                    {_ if personal rank is 5 = flat +100% bonus}
                }
            }

            {if type = "BountyInc":
                {set timer to (timer - SecondsSince(0)) + token(state.eddi_context_bounties_timer, "+=", position)}

                {_ Maximum bounty is 1MCr }
                {if amount > [URL="tel:1000000"]1000000[/URL]: {set amount to 1000000}}
            }

            {_ Maximum duration is one week }
            {if SecondsSince(timer) < -604800: {set timer to SecondsSince(0) + 604800}}

            {_ Update arrays }
            {set bounties_type_array to union(bounties_type_array, [position:type])}
            {set bounties_subtype_array to union(bounties_subtype_array, [position:subtype])}
            {set bounties_amount_array to union(bounties_amount_array, [position:amount])}
            {set bounties_timer_array to union(bounties_timer_array, [position:timer])}

            {set updatedata to 1}

        |elif bounties_type_array[position] = "BountyInc" && type = "Fine":
            {if bounties_subtype_array[position] = "Dormant":

                {_ Update arrays }
                {set bounties_subtype_array to union(bounties_subtype_array, [position:subtype])}
                {set bounties_timer_array to union(bounties_timer_array, [position:timer])}
            }

            {_ Add amount to stored amount and update array }
            {set amount to evtamount + bounties_amount_array[position]}
            {if amount > [URL="tel:1000000"]1000000[/URL]: {set amount to 1000000}}
            {set bounties_amount_array to union(bounties_amount_array, [position:amount])}

            {set updatedata to 1}
 
        }
        {set position to find(bounties_faction_array, evtfaction, start}
    }

    {_ Add new data to arrays}
    {if updatedata = 0:
        {set bounties_type_array to cat(bounties_type_array, [type])}
        {set bounties_subtype_array to cat(bounties_type_array, [subtype])}
        {set bounties_faction_array to cat(bounties_type_array, [faction])}
        {set bounties_amount_array to cat(bounties_type_array, [amount])}
        {set bounties_timer_array to cat(bounties_type_array, [timer])}
    }
}

{_ Update State variable strings }
{SetState('eddi_context_bounties_type', join(bounties_type_array, "+=")}
{SetState('eddi_context_bounties_subtype', join(bounties_subtype_array, "=+")}
{SetState('eddi_context_bounties_faction', join(bounties_faction_array, "=+")}
{SetState('eddi_context_bounties_amount', join(bounties_amount_array, "=+")}
{SetState('eddi_context_bounties_timer', join(bounties_timer_array, "=+")}


Let me know what you think. :)
 
Last edited:
Hey Darkcyde!

Looking at your Fines & Bounties code. Great work!

I enjoy 'bumming code' and If I may be so presumptuous, I have a re-write on your 'FinesBounties_Add' script.

My suggestion is that once you go into 'array space', stay there. Perform updates using union() and additions using cat( , []) to the arrays and don't go back to 'eddi_context' strings until the very end. The code is much more readable and also may run a bit faster.

I've also changed the {for factions in bounties_faction_array: loop to {set start to 0} and {set position to find(bounties_faction_array, evtfaction, start} with {while position > -1:

Whenever a matching faction is found, {set start to position + 1} and the next find() skips past the previous match.

This saves you from traversing the entire faction array to find each matching faction... a little bit of a shortcut.

Hi Hoodathunk,

Thanks for your suggestion, I've now added it to the system. While I really don't like when people pick at my code (makes me feel like I've failed), I'm not above taking suggestions on board. In fact I still welcome them in things like this as it is a benefit for all who use it, and that, in the end, is what really matters. So thank you. Besides, I did say it was a beta, I expected there would be room for improvement! I just wanted to get it working first and refine it later. :)

However... ;) I copied your script into EDDI, and found quite a few errors.

While looking for the errors, I noticed that you put the 'set start to 0' just before the 'find' that used it, so it was always starting at zero, making it pointless. I moved it to just before the {for evtfaction, evtamount in evtrewards: line to make it function as you had intended.

You'd forgotten to change all the array names in the 'updatedata' section after a copy/paste, so all the array strings ended up being copies of the 'type' string. Also, that section wasn't using the 'evt' versions of faction and amount, resulting in blank array strings.

In the last block (Setstate), there were missing parenthesis ')' (and also in a couple of other places too) so the script wouldn't run. Also, the separator was the wrong way around (=+ not +=). I've also reinstated the 'If' statement to select a separator as it was producing a blank entry at the start of the array strings without it.

All fixed now though! :D


Code:
{_ FinesBounties_Add}
{_ Add Bonds, Bounties & Fines to memory store}

{_ To Do: Timers. Check Major or Minor for time to add?}
{_ Minor = 10 mins, Major = 7 days?}

{if state.eddi_context_bounties_initialised != "yes": {F("FinesBounties_Initialise")}}

{if state.eddi_context_last_subject = "bond":
    {set type to "Bond"}
    {set subtype to "None"}
    {set evtrewards to [event.awardingfaction: event.reward]}
    {set timer to 0}

|elif state.eddi_context_last_subject = "bounty" && state.eddi_context_last_action = "award":
    {set type to "Bounty"}
    {set subtype to "None"}
    {set evtrewards to []}
    {for reward in event.rewards:
        {set evtrewards to union(evtrewards, [reward.faction: reward.amount])}
    }
    {set timer to 0}

|elif state.eddi_context_last_subject = "bounty" && state.eddi_context_last_action = "incur":
    {set type to "BountyInc"}
    {set subtype to "Active"}
    {set evtrewards to [event.faction: event.bounty]}
    {set timer to timer + SecondsSince(0)}

|elif state.eddi_context_last_subject = "fine":
    {set type to "Fine"}
    {set subtype to "Active"}
    {set evtrewards to [event.faction: event.fine]}
    {set timer to 604800 + SecondsSince(0)}
}

{set bounties_type_array to split(state.eddi_context_bounties_type, "+=")}
{set bounties_subtype_array to split(state.eddi_context_bounties_subtype, "+=")}
{set bounties_faction_array to split(state.eddi_context_bounties_faction, "+=")}
{set bounties_amount_array to split(state.eddi_context_bounties_amount, "+=")}
{set bounties_timer_array to split(state.eddi_context_bounties_timer, "+=")}
{set start to 0}

{for evtfaction, evtamount in evtrewards:

    {set position to find(bounties_faction_array, evtfaction, start)}
    {set updatedata to 0}

    {while position > -1:

        {set start to position + 1}
        {if (bounties_type_array[position] = type) || (bounties_type_array[position] = "Fine" && type = "BountyInc"):

            {_ Add amount to stored amount}
            {set amount to evtamount + bounties_amount_array[position]}

            {if system.power = "Arissa Lavigny-Duval":

                {_ If in Arisa Lavigny-Duval controlled space get extra bounty}
                {if system.powerstate = "Controlled" || system.powerstate = "Exploited":

                    {_ Unfortunately the variables needed for this are not yet available in EDDI,}
                    {_ but this is a placeholder in case they are implemented in the future.}

                    {_ if unaligned, and power galactic rank 3, 2 or 1 = +10%, +20% or +30%}

                    {_ if joined power}
                    {_ if personal rank in ALD is between 2 and 4 = +20% on to unaligned base amount}
                    {_ if personal rank is 5 = flat +100% bonus}
                }
            }

            {if type = "BountyInc":
                {set timer to (timer - SecondsSince(0)) + token(state.eddi_context_bounties_timer, "+=", position)}

                {_ Maximum bounty is 1MCr}
                {if amount > 1000000: {set amount to 1000000}}
            }

            {_ Maximum duration is one week}
            {if SecondsSince(timer) < -604800: {set timer to SecondsSince(0) + 604800}}

            {_ Update arrays}
            {set bounties_type_array to union(bounties_type_array, [position:type])}
            {set bounties_subtype_array to union(bounties_subtype_array, [position:subtype])}
            {set bounties_amount_array to union(bounties_amount_array, [position:amount])}
            {set bounties_timer_array to union(bounties_timer_array, [position:timer])}

            {set updatedata to 1}

        |elif bounties_type_array[position] = "BountyInc" && type = "Fine":
            {if bounties_subtype_array[position] = "Dormant":

                {_ Update arrays}
                {set bounties_subtype_array to union(bounties_subtype_array, [position:subtype])}
                {set bounties_timer_array to union(bounties_timer_array, [position:timer])}
            }

            {_ Add amount to stored amount and update array}
            {set amount to evtamount + bounties_amount_array[position]}
            {if amount > 1000000: {set amount to 1000000}}
            {set bounties_amount_array to union(bounties_amount_array, [position:amount])}

            {set updatedata to 1}
 
        }
        {set position to find(bounties_faction_array, evtfaction, start)}
    }

    {_ Add new data to arrays}
    {if updatedata = 0:
        {set bounties_type_array to cat(bounties_type_array, [type])}
        {set bounties_subtype_array to cat(bounties_subtype_array, [subtype])}
        {set bounties_faction_array to cat(bounties_faction_array, [evtfaction])}
        {set bounties_amount_array to cat(bounties_amount_array, [evtamount])}
        {set bounties_timer_array to cat(bounties_timer_array, [timer])}
    }
}

{_ Update State variable strings}
{if len(state.eddi_context_bounties_type) = 0: {set sep to ""} |else: {set sep to "+="}}
{SetState('eddi_context_bounties_type', join(bounties_type_array, sep))}
{SetState('eddi_context_bounties_subtype', join(bounties_subtype_array, sep))}
{SetState('eddi_context_bounties_faction', join(bounties_faction_array, sep))}
{SetState('eddi_context_bounties_amount', join(bounties_amount_array, sep))}
{SetState('eddi_context_bounties_timer', join(bounties_timer_array, sep))}

The Multi-Destination update to the mission system is coming along nicely. I've got the recording part done and a couple of the report parts too. Just the remainder of those to do and I think it will be good to go. I'm running out of time for today though, so I may have to finish them tomorrow. :/
 
Hi Hoodathunk,

Thanks for your suggestion, I've now added it to the system. While I really don't like when people pick at my code (makes me feel like I've failed), I'm not above taking suggestions on board. In fact I still welcome them in things like this as it is a benefit for all who use it, and that, in the end, is what really matters. So thank you. Besides, I did say it was a beta, I expected there would be room for improvement! I just wanted to get it working first and refine it later. :)

However... ;) I copied your script into EDDI, and found quite a few errors.

While looking for the errors, I noticed that you put the 'set start to 0' just before the 'find' that used it, so it was always starting at zero, making it pointless. I moved it to just before the {for evtfaction, evtamount in evtrewards: line to make it function as you had intended.

You'd forgotten to change all the array names in the 'updatedata' section after a copy/paste, so all the array strings ended up being copies of the 'type' string. Also, that section wasn't using the 'evt' versions of faction and amount, resulting in blank array strings.

In the last block (Setstate), there were missing parenthesis ')' (and also in a couple of other places too) so the script wouldn't run. Also, the separator was the wrong way around (=+ not +=). I've also reinstated the 'If' statement to select a separator as it was producing a blank entry at the start of the array strings without it.

All fixed now though! :D


Code:
{_ FinesBounties_Add}
{_ Add Bonds, Bounties & Fines to memory store}

{_ To Do: Timers. Check Major or Minor for time to add?}
{_ Minor = 10 mins, Major = 7 days?}

{if state.eddi_context_bounties_initialised != "yes": {F("FinesBounties_Initialise")}}

{if state.eddi_context_last_subject = "bond":
    {set type to "Bond"}
    {set subtype to "None"}
    {set evtrewards to [event.awardingfaction: event.reward]}
    {set timer to 0}

|elif state.eddi_context_last_subject = "bounty" && state.eddi_context_last_action = "award":
    {set type to "Bounty"}
    {set subtype to "None"}
    {set evtrewards to []}
    {for reward in event.rewards:
        {set evtrewards to union(evtrewards, [reward.faction: reward.amount])}
    }
    {set timer to 0}

|elif state.eddi_context_last_subject = "bounty" && state.eddi_context_last_action = "incur":
    {set type to "BountyInc"}
    {set subtype to "Active"}
    {set evtrewards to [event.faction: event.bounty]}
    {set timer to timer + SecondsSince(0)}

|elif state.eddi_context_last_subject = "fine":
    {set type to "Fine"}
    {set subtype to "Active"}
    {set evtrewards to [event.faction: event.fine]}
    {set timer to 604800 + SecondsSince(0)}
}

{set bounties_type_array to split(state.eddi_context_bounties_type, "+=")}
{set bounties_subtype_array to split(state.eddi_context_bounties_subtype, "+=")}
{set bounties_faction_array to split(state.eddi_context_bounties_faction, "+=")}
{set bounties_amount_array to split(state.eddi_context_bounties_amount, "+=")}
{set bounties_timer_array to split(state.eddi_context_bounties_timer, "+=")}
{set start to 0}

{for evtfaction, evtamount in evtrewards:

    {set position to find(bounties_faction_array, evtfaction, start)}
    {set updatedata to 0}

    {while position > -1:

        {set start to position + 1}
        {if (bounties_type_array[position] = type) || (bounties_type_array[position] = "Fine" && type = "BountyInc"):

            {_ Add amount to stored amount}
            {set amount to evtamount + bounties_amount_array[position]}

            {if system.power = "Arissa Lavigny-Duval":

                {_ If in Arisa Lavigny-Duval controlled space get extra bounty}
                {if system.powerstate = "Controlled" || system.powerstate = "Exploited":

                    {_ Unfortunately the variables needed for this are not yet available in EDDI,}
                    {_ but this is a placeholder in case they are implemented in the future.}

                    {_ if unaligned, and power galactic rank 3, 2 or 1 = +10%, +20% or +30%}

                    {_ if joined power}
                    {_ if personal rank in ALD is between 2 and 4 = +20% on to unaligned base amount}
                    {_ if personal rank is 5 = flat +100% bonus}
                }
            }

            {if type = "BountyInc":
                {set timer to (timer - SecondsSince(0)) + token(state.eddi_context_bounties_timer, "+=", position)}

                {_ Maximum bounty is 1MCr}
                {if amount > 1000000: {set amount to 1000000}}
            }

            {_ Maximum duration is one week}
            {if SecondsSince(timer) < -604800: {set timer to SecondsSince(0) + 604800}}

            {_ Update arrays}
            {set bounties_type_array to union(bounties_type_array, [position:type])}
            {set bounties_subtype_array to union(bounties_subtype_array, [position:subtype])}
            {set bounties_amount_array to union(bounties_amount_array, [position:amount])}
            {set bounties_timer_array to union(bounties_timer_array, [position:timer])}

            {set updatedata to 1}

        |elif bounties_type_array[position] = "BountyInc" && type = "Fine":
            {if bounties_subtype_array[position] = "Dormant":

                {_ Update arrays}
                {set bounties_subtype_array to union(bounties_subtype_array, [position:subtype])}
                {set bounties_timer_array to union(bounties_timer_array, [position:timer])}
            }

            {_ Add amount to stored amount and update array}
            {set amount to evtamount + bounties_amount_array[position]}
            {if amount > 1000000: {set amount to 1000000}}
            {set bounties_amount_array to union(bounties_amount_array, [position:amount])}

            {set updatedata to 1}
 
        }
        {set position to find(bounties_faction_array, evtfaction, start)}
    }

    {_ Add new data to arrays}
    {if updatedata = 0:
        {set bounties_type_array to cat(bounties_type_array, [type])}
        {set bounties_subtype_array to cat(bounties_subtype_array, [subtype])}
        {set bounties_faction_array to cat(bounties_faction_array, [evtfaction])}
        {set bounties_amount_array to cat(bounties_amount_array, [evtamount])}
        {set bounties_timer_array to cat(bounties_timer_array, [timer])}
    }
}

{_ Update State variable strings}
{if len(state.eddi_context_bounties_type) = 0: {set sep to ""} |else: {set sep to "+="}}
{SetState('eddi_context_bounties_type', join(bounties_type_array, sep))}
{SetState('eddi_context_bounties_subtype', join(bounties_subtype_array, sep))}
{SetState('eddi_context_bounties_faction', join(bounties_faction_array, sep))}
{SetState('eddi_context_bounties_amount', join(bounties_amount_array, sep))}
{SetState('eddi_context_bounties_timer', join(bounties_timer_array, sep))}

The Multi-Destination update to the mission system is coming along nicely. I've got the recording part done and a couple of the report parts too. Just the remainder of those to do and I think it will be good to go. I'm running out of time for today though, so I may have to finish them tomorrow. :/

Hi Guys,

“Anyone who has never made a mistake has never tried anything new.”

― Albert Einstein

Keep on trying new things :) !
 
Hi Guys,



Keep on trying new things :) !

Yeah, I know. :( I wasn't trying to be an a*s (stupid profanity filter!), even if I come across like one. I've made more than my fair share of mistakes in my life. When it comes to programming, I've learned to test, test and test again. And I just thought that Hoodathunk would like to know where problems were and how to fix them. I apologise for any offence caused. :(
 
Last edited:
Yeah, I know. :( I wasn't trying to be an a*s (stupid profanity filter!), even if I come across like one. I've made more than my fair share of mistakes in my life. When it comes to programming, I've learned to test, test and test again. And I just thought that Hoodathunk would like to know where problems were and how to fix them. I apologise for any offence caused. :(

My friend, please do not take my enthusiasm as any sort of 'failure' on your part, your work is far from it.

I have a 'collaborative' nature and I like to share.

I'm an engineer by trade (electrical & computer) and design and build particle accelerators for a living at a national lab. Building complex machines 'takes a village'... there is just too much for any one person to know and we rely on each other to find the holes in our designs. As a result, I became thick-skinned long ago, but I understand if my meddling is putting you on edge... my apologies.

I've been modifying your excellent code because of my OCD nature and sharing it with you because I have no intentions of claiming it as my own... credit must be given to the creator!

In the future, I will keep my hacking to myself.

Cheers!
 
Hi Hoodathunk,

Thanks for your suggestion, I've now added it to the system. While I really don't like when people pick at my code (makes me feel like I've failed), I'm not above taking suggestions on board. In fact I still welcome them in things like this as it is a benefit for all who use it, and that, in the end, is what really matters. So thank you. Besides, I did say it was a beta, I expected there would be room for improvement! I just wanted to get it working first and refine it later. :)

However... ;) I copied your script into EDDI, and found quite a few errors.

While looking for the errors, I noticed that you put the 'set start to 0' just before the 'find' that used it, so it was always starting at zero, making it pointless. I moved it to just before the {for evtfaction, evtamount in evtrewards: line to make it function as you had intended.

You'd forgotten to change all the array names in the 'updatedata' section after a copy/paste, so all the array strings ended up being copies of the 'type' string. Also, that section wasn't using the 'evt' versions of faction and amount, resulting in blank array strings.

In the last block (Setstate), there were missing parenthesis ')' (and also in a couple of other places too) so the script wouldn't run. Also, the separator was the wrong way around (=+ not +=). I've also reinstated the 'If' statement to select a separator as it was producing a blank entry at the start of the array strings without it.

All fixed now though! :D

Yup, you're right... I was mostly interested in showing the different methodology, putting in some blatant errors without fully checking it out. My bad, thanks for catching those.
 
Hey Punkerich,

Here's my final take on the 'Body Report' script. I've fully tested it and am satisfied. Per the default script, it first reports the 'Great' & 'Good' materials, but additionally with the percentages for each material. Lastly, it reports any 'Desired' materials (and its percentage), not previously mentioned in the 'Great' & 'Good' reports.

Code:
{_ Fetch from context }
{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}

{if !reportbody.name || reportbody.name = "":
    I'm not sure which body you are asking about.
|else:
    {P(reportbody.name)} is a
    {if reportbody.gravity < 0.5:
        low-gravity
    |elif reportbody.gravity <2:
        medium-gravity
    |elif reportbody.gravity <4:
        high-gravity
    |else:
        extremely high-gravity
    }

    {if reportbody.tidallylocked:
        tidally-locked
    }

    {if reportbody.terraformstate = "Terraformable":
        terra-formable
    |elif reportbody.terraformstate = "Terraformed":
        terra-formed
    }

    {if len(reportbody.rings) > 0:
        ringed
    }

    {reportbody.planettype}

    {if reportbody.terraformstate = "Terraforming":
      in the process of being terraformed
    }

    that is

    {if reportbody.landable:
        suitable
    |else:
        unsuitable
    }
    for landing.

    {_ Atmosphere? }

    {if reportbody.volcanism:
        This planet shows signs of volcanism, with
        {if reportbody.volcanism.type = 'Geysers':
            {if reportbody.volcanism.amount = 'Major':
                high numbers of
            |elif reportbody.volcanism.amount = 'Minor':
                low numbers of
            }
            active {reportbody.volcanism.composition} guy'zers
        |else:
            {if reportbody.volcanism.amount = 'Major':
                high levels of
            |elif reportbody.volcanism.amount = 'Minor':
                low levels  of
            }
            active {reportbody.volcanism.composition} magma flows
        }.
    }

    {if reportbody.landable :
        It has a
        {if reportbody.rotationalperiod < -20.0:
            slow retrograde
        |elif reportbody.rotationalperiod < -0.5:
            retrograde
        |elif reportbody.rotationalperiod < 0:
            fast retrograde
        |elif reportbody.rotationalperiod <= 0.5:
            fast
        |elif reportbody.rotationalperiod > 20.0:
            slow
        }
        rotational period of {Humanise(reportbody.rotationalperiod)}
        day{if Humanise(reportbody.rotationalperiod) != "1":s}.

        {set desired_materials to []}
        {for des_mat in materials:
            {if des_mat.desired && des_mat.amount < des_mat.desired:
                {for rep_mat in reportbody.materials:
                    {if rep_mat.material = des_mat.material:
                        {set desired_materials to cat(desired_materials, [des_mat.material])}
                    }
                }
            }
        }

        {set goodmaterials to []}
        {set greatmaterials to []}
        {for material in reportbody.materials:
            {if material.percentage >= MaterialDetails(material.material).greatpctbody:
                {set greatmaterials to cat(greatmaterials, [material])}
            |elif material.percentage >= MaterialDetails(material.material).goodpctbody:
                {set goodmaterials to cat(goodmaterials, [material])}
            }
        }

        {if len(greatmaterials) > 0:
            This body contains very high levels of

            {set cur to 0}
            {while cur < len(greatmaterials):
                {if cur = 0:
                    {greatmaterials[cur].material} at {round(greatmaterials[cur].percentage, 1)} percent
                |elif cur < len(greatmaterials) - 1:
                    , {greatmaterials[cur].material} at {round(greatmaterials[cur].percentage, 1)} percent
                |else:
                    , and {greatmaterials[cur].material} at {round(greatmaterials[cur].percentage, 1)} percent
                }
                {set cur to cur + 1}
                {set pos to find(desired_materials, greatmaterials[cur].material)}
                {if pos > -1: {set desired_materials to except(desired_materials, [pos:""])}}
            }
        }
        {if len(goodmaterials) > 0:
            {if len(greatmaterials) > 0:
                and high levels of
            |else:
                This body contains high levels of
            }

            {set cur to 0}
            {while cur < len(goodmaterials):
                {if cur = 0:
                    {goodmaterials[cur].material} at {round(goodmaterials[cur].percentage, 1)} percent
                |elif cur < len(goodmaterials) - 1:
                    , {goodmaterials[cur].material} at {round(goodmaterials[cur].percentage, 1)} percent
                |else:
                    , and {goodmaterials[cur].material} at {round(goodmaterials[cur].percentage, 1)} percent
                }
                {set cur to cur + 1}
                {set pos to find(desired_materials, goodmaterials[cur].material)}
                {if pos > -1: {set desired_materials to except(desired_materials, [pos:""])}}

            }

        }
        {if len(greatmaterials) > 0 || len(goodmaterials) > 0:
            .
        }

        {if len(desired_materials) > 0:
            {if len(greatmaterials) > 0 || len(goodmaterials) > 0:
                Also found,
            |else:
                This body contains
            }
            {if len(desired_materials) > 1):
                the desired materials
            |else:
                the desired material
            }

            {set cur to 0}
            {while cur < len(reportbody.materials) && len(desired_materials) > 0):
                {set pos to find(desired_materials, reportbody.materials[cur].material)}
                {if pos > -1:
                    {set desired_materials to except(desired_materials, [pos:""])}
                    {if cur = 0:
                        {reportbody.materials[cur].material} at {round(reportbody.materials[cur].percentage, 1)} percent
                    |elif cur < len(reportbody.materials) - 1:
                        , {reportbody.materials[cur].material} at {round(reportbody.materials[cur].percentage, 1)} percent
                    |else:
                        , and {reportbody.materials[cur].material} at {round(reportbody.materials[cur].percentage, 1)} percent
                    }
                }
                {set cur to cur + 1}
            }

            {if cur > 0:
                .
            }
        }
    }
}


No worries if you already have one that works for you... I was a bit late to the party with my final take. Otherwise, enjoy & let me know if you have any suggestions.
 
Last edited:
Hi everyone,

I would like some advice on how to proceed with the Multi-destination mission upgrade to the mission system.

So, here is the upgraded Add function:
Code:
{_ MissionStoreAdd}
{_ Add accepted missions to memory store. Max 20 missions}

{if state.eddi_context_missions_accepted < 20 && type != "Permit Aquisition mission":
    {set missions to state.eddi_context_missions_accepted + 1}
    {SetState('eddi_context_missions_accepted', missions)}

    {if event.name = "Mission_AltruismCredits" || event.name = "Mission_Altruism":
       {set destinationsystem to system.name}
       {set destinationstation to station.name}
    |else:
       {set destinationsystem to event.destinationsystem}
       {set destinationstation to event.destinationstation}
    }

    {set multi to find(destinationsystem, "$MISSIONUTIL_MULTIPLE_FINAL")}
    {if multi > -1:
        {set last to token(destinationsystem, "FINAL_SEPARATOR;", 1)}
        {set dest_array to split(slice(destinationsystem, 0, multi), "$MISSIONUTIL_MULTIPLE_INNER_SEPARATOR;")}
        {set dest_array to cat(dest_array, [last])}
        {set destinationsystem to join(dest_array, "::")}
    }

    {_ Add += & data to end of string if not first mission }
    {if missions = 1: {set sep to ""} |else: {set sep to "+="}}

    {set Mission_MissionID to cat(state.eddi_context_mission_missionid, sep, event.missionid)}
    {set Mission_Name to cat(state.eddi_context_mission_name, sep, event.name)}
    {set Mission_DestinationSystem to cat(state.eddi_context_mission_destinationsystem, sep, destinationsystem)}
    {set Mission_DestinationStation to cat(state.eddi_context_mission_destinationstation, sep, destinationstation)}
    {set Mission_Commodity to cat(state.eddi_context_mission_commodity, sep, event.commodity)}
    {set Mission_PassengerType to cat(state.eddi_context_mission_passengertype, sep, event.passengertype)}
    {set Mission_TargetName to cat(state.eddi_context_mission_targetname, sep, event.targetname)}
    {set Mission_TargetType to cat(state.eddi_context_mission_targettype, sep, event.targettype)}
    {set Mission_Communal to cat(state.eddi_context_mission_communal, sep, event.communal)}
    {set Mission_Expiry to cat(state.eddi_context_mission_expiry, sep, event.expiry)}
    {set Mission_OriginSystem to cat(state.eddi_context_mission_originsystem, sep, system.name)}
    {set Mission_OriginStation to cat(state.eddi_context_mission_originstation, sep, station.name)}
    {set Mission_RoundTrip to cat(state.eddi_context_mission_roundtrip, sep, roundtrip)}

    {_ Rewrite State variable strings}
    {SetState('eddi_context_mission_missionid', Mission_MissionID)}
    {SetState('eddi_context_mission_name', Mission_Name)}
    {SetState('eddi_context_mission_destinationsystem', Mission_DestinationSystem)}
    {SetState('eddi_context_mission_destinationstation', Mission_DestinationStation)}
    {SetState('eddi_context_mission_commodity', Mission_Commodity)}
    {SetState('eddi_context_mission_passengertype', Mission_PassengerType)}
    {SetState('eddi_context_mission_targetname', Mission_TargetName)}
    {SetState('eddi_context_mission_targettype', Mission_TargetType)}
    {SetState('eddi_context_mission_communal', Mission_Communal)}
    {SetState('eddi_context_mission_expiry', Mission_Expiry)}
    {SetState('eddi_context_mission_originsystem', Mission_OriginSystem)}
    {SetState('eddi_context_mission_originstation', Mission_OriginStation)}
    {SetState('eddi_context_mission_roundtrip', Mission_RoundTrip)}

    {if missions = 20:
       You have now reached the maximum number of missions you can take.
       Please complete some, in order to accept more.
    |else:
       {OneOf("You {Occasionally(2,'now')} have {missions} mission{if missions > 1:s}",
              "{OneOf('That\\'s','That is','This is')} your
                 {if missions = 1: 1st
                 |elif missions = 2: 2nd
                 |elif missions = 3: 3rd
                 |else: {missions}th
                 }
               mission")}.
    }
}

and here is the current incarnation of the CheckGalaxy function as an example (I've also upgraded the CheckNearMost and CheckSystem functions):
Code:
{_ MissionStoreCheckGalaxy}
{_ Check what systems you have missions in}

{if state.eddi_context_missions_initialised != "yes":
    {F("MissionStoreInitialise")}
}

{set missionstotal to state.eddi_context_missions_accepted}

{if missionstotal > 0 && missionstotal != null:

    {_ Setup allmissions function}
    {set allmissions(system) to:
        {if find(systems, system) > -1:
            {set here to find(systems, system)}
            {set number to systems_count[here] + 1}
            {set systems_count to union(systems_count, [here:number])}
        |else:
            {set systems to cat(systems, [system])}
            {set systems_count to cat(systems_count, [1])}
        }
    }

    {set mission_system_array to split(state.eddi_context_mission_destinationsystem, "+=")}
    {set multi to 0}

    You have {missionstotal} mission{if missionstotal > 1:s} to complete.

    {if missionstotal = 1:

        {if find(mission_system_array[0], "::") > -1:
            {set dest_array to split(mission_system_array[0], "::")}
            {set multi to multi + 1}

            It has multiple destinations of
            {set cur to 0}
            {for destination in dest_array:
                {if cur = len(dest_array)-1: and |elif cur < len(dest_array) && cur > 0:, }
                {destination}
                {set cur to cur + 1}
            }
        |else:

            It is {Occasionally(2,"located")} in
            {if mission_system_array[0] = "":
                an unknown
            |else:
                the {mission_system_array[0]}
            }
            {Occasionally(2,"star")} system.
        }
    |else:
        {set systems to []}
        {set systems_count to []}
        {set systems_multi to 0}
        {for system in mission_system_array:
            {if system != "":

                {if find(system, "::") > -1:
                    {set multi to multi + 1}

                    {set dest_array to split(system,"::")}
                    {for destination in dest_array:
                        {allmissions(destination)}
                    }
                |else:
                    {allmissions(system)}
                }
            }
        }


        {if len(systems) = 1:
            They are all {Occasionally(2,"located")} in
            {if systems[0] = "":
                an unknown
            |else:
                the {systems[0]}
            }
            {Occasionally(2,"star")} system.

        |else:
            {if multi > 0:

                {if multi = missionstotal: All |else: {multi}}
                of these 
                {if multi = 1: is a |else: are}
                multi-destination mission{if multi != 1:s}.
            }
            There
            {if systems_count[0] = 1: is |else: are }

            {set cur to 0}
            {while cur < len(systems):
                {systems_count[cur]}
                {if systems[cur] = "":
                    in an unknown system
                |else:
                    {OneOf("at","in")} {systems[cur]}
                }

                {set cur to cur + 1}
                {if cur = len(systems)-1: and |elif cur < len(systems):, }
            }
        }.
    }
|else:
    You {Occasionally(2,"currently")} have no missions at {OneOf("the moment","this time")}.
}

As you can see (or hear) Multi-destination missions (MDMs) are treated much the same as any other mission. It says that you have them, but treats each destination individually.

I would like peoples opinions on what to do next.

1. Should I just leave them as I have them now? Personally, I'm not satisfied with how it is, and feel it should have more use somehow.

2. Report MDMs as separate entities within each report type. So part of CheckGalaxy or CheckSystem would report normal missions, with a separate part reporting MDMs. e.g. "You have 5 missions in this system. This is also a stop for one of your multi-stop missions".

3. Mark visited systems in the database so that they are not used for reporting. The only way I can think of doing this is when checking the current system for missions, either when entering or leaving the system. If one is found for the current system, mark it as 'visited' and no longer report it. This will be useful for finding your next nearest destination. The only problem with this, is if you leave the system without completeing that part of your mission, it will consider it done, and not tell you to go back.

4. Mix both 2 & 3 above. More complex, but overall I think would probably be the best option.

As an extension of 3, I could make any visited system be blocked from reporting. This would be useful if you have lots of missions spread out and you don't want the MissionSystem telling you to go back to a place you just visited. I could then make use of the other State variables of 'OriginSystem' and 'OriginStation'. If all systems (or the only one) for a mission have been visited, then it could guide you back to the system you got the misssion so you can claim your rewards.

Let me know what you think, and I'll get to work on it. I may just end up going for number 4 anyway, but I wanted to see what you all thought first.
 
Hi everyone,

I would like some advice on how to proceed with the Multi-destination mission upgrade to the mission system.

So, here is the upgraded Add function:
Code:
{_ MissionStoreAdd}
{_ Add accepted missions to memory store. Max 20 missions}

{if state.eddi_context_missions_accepted < 20 && type != "Permit Aquisition mission":
    {set missions to state.eddi_context_missions_accepted + 1}
    {SetState('eddi_context_missions_accepted', missions)}

    {if event.name = "Mission_AltruismCredits" || event.name = "Mission_Altruism":
       {set destinationsystem to system.name}
       {set destinationstation to station.name}
    |else:
       {set destinationsystem to event.destinationsystem}
       {set destinationstation to event.destinationstation}
    }

    {set multi to find(destinationsystem, "$MISSIONUTIL_MULTIPLE_FINAL")}
    {if multi > -1:
        {set last to token(destinationsystem, "FINAL_SEPARATOR;", 1)}
        {set dest_array to split(slice(destinationsystem, 0, multi), "$MISSIONUTIL_MULTIPLE_INNER_SEPARATOR;")}
        {set dest_array to cat(dest_array, [last])}
        {set destinationsystem to join(dest_array, "::")}
    }

    {_ Add += & data to end of string if not first mission }
    {if missions = 1: {set sep to ""} |else: {set sep to "+="}}

    {set Mission_MissionID to cat(state.eddi_context_mission_missionid, sep, event.missionid)}
    {set Mission_Name to cat(state.eddi_context_mission_name, sep, event.name)}
    {set Mission_DestinationSystem to cat(state.eddi_context_mission_destinationsystem, sep, destinationsystem)}
    {set Mission_DestinationStation to cat(state.eddi_context_mission_destinationstation, sep, destinationstation)}
    {set Mission_Commodity to cat(state.eddi_context_mission_commodity, sep, event.commodity)}
    {set Mission_PassengerType to cat(state.eddi_context_mission_passengertype, sep, event.passengertype)}
    {set Mission_TargetName to cat(state.eddi_context_mission_targetname, sep, event.targetname)}
    {set Mission_TargetType to cat(state.eddi_context_mission_targettype, sep, event.targettype)}
    {set Mission_Communal to cat(state.eddi_context_mission_communal, sep, event.communal)}
    {set Mission_Expiry to cat(state.eddi_context_mission_expiry, sep, event.expiry)}
    {set Mission_OriginSystem to cat(state.eddi_context_mission_originsystem, sep, system.name)}
    {set Mission_OriginStation to cat(state.eddi_context_mission_originstation, sep, station.name)}
    {set Mission_RoundTrip to cat(state.eddi_context_mission_roundtrip, sep, roundtrip)}

    {_ Rewrite State variable strings}
    {SetState('eddi_context_mission_missionid', Mission_MissionID)}
    {SetState('eddi_context_mission_name', Mission_Name)}
    {SetState('eddi_context_mission_destinationsystem', Mission_DestinationSystem)}
    {SetState('eddi_context_mission_destinationstation', Mission_DestinationStation)}
    {SetState('eddi_context_mission_commodity', Mission_Commodity)}
    {SetState('eddi_context_mission_passengertype', Mission_PassengerType)}
    {SetState('eddi_context_mission_targetname', Mission_TargetName)}
    {SetState('eddi_context_mission_targettype', Mission_TargetType)}
    {SetState('eddi_context_mission_communal', Mission_Communal)}
    {SetState('eddi_context_mission_expiry', Mission_Expiry)}
    {SetState('eddi_context_mission_originsystem', Mission_OriginSystem)}
    {SetState('eddi_context_mission_originstation', Mission_OriginStation)}
    {SetState('eddi_context_mission_roundtrip', Mission_RoundTrip)}

    {if missions = 20:
       You have now reached the maximum number of missions you can take.
       Please complete some, in order to accept more.
    |else:
       {OneOf("You {Occasionally(2,'now')} have {missions} mission{if missions > 1:s}",
              "{OneOf('That\\'s','That is','This is')} your
                 {if missions = 1: 1st
                 |elif missions = 2: 2nd
                 |elif missions = 3: 3rd
                 |else: {missions}th
                 }
               mission")}.
    }
}

and here is the current incarnation of the CheckGalaxy function as an example (I've also upgraded the CheckNearMost and CheckSystem functions):
Code:
{_ MissionStoreCheckGalaxy}
{_ Check what systems you have missions in}

{if state.eddi_context_missions_initialised != "yes":
    {F("MissionStoreInitialise")}
}

{set missionstotal to state.eddi_context_missions_accepted}

{if missionstotal > 0 && missionstotal != null:

    {_ Setup allmissions function}
    {set allmissions(system) to:
        {if find(systems, system) > -1:
            {set here to find(systems, system)}
            {set number to systems_count[here] + 1}
            {set systems_count to union(systems_count, [here:number])}
        |else:
            {set systems to cat(systems, [system])}
            {set systems_count to cat(systems_count, [1])}
        }
    }

    {set mission_system_array to split(state.eddi_context_mission_destinationsystem, "+=")}
    {set multi to 0}

    You have {missionstotal} mission{if missionstotal > 1:s} to complete.

    {if missionstotal = 1:

        {if find(mission_system_array[0], "::") > -1:
            {set dest_array to split(mission_system_array[0], "::")}
            {set multi to multi + 1}

            It has multiple destinations of
            {set cur to 0}
            {for destination in dest_array:
                {if cur = len(dest_array)-1: and |elif cur < len(dest_array) && cur > 0:, }
                {destination}
                {set cur to cur + 1}
            }
        |else:

            It is {Occasionally(2,"located")} in
            {if mission_system_array[0] = "":
                an unknown
            |else:
                the {mission_system_array[0]}
            }
            {Occasionally(2,"star")} system.
        }
    |else:
        {set systems to []}
        {set systems_count to []}
        {set systems_multi to 0}
        {for system in mission_system_array:
            {if system != "":

                {if find(system, "::") > -1:
                    {set multi to multi + 1}

                    {set dest_array to split(system,"::")}
                    {for destination in dest_array:
                        {allmissions(destination)}
                    }
                |else:
                    {allmissions(system)}
                }
            }
        }


        {if len(systems) = 1:
            They are all {Occasionally(2,"located")} in
            {if systems[0] = "":
                an unknown
            |else:
                the {systems[0]}
            }
            {Occasionally(2,"star")} system.

        |else:
            {if multi > 0:

                {if multi = missionstotal: All |else: {multi}}
                of these 
                {if multi = 1: is a |else: are}
                multi-destination mission{if multi != 1:s}.
            }
            There
            {if systems_count[0] = 1: is |else: are }

            {set cur to 0}
            {while cur < len(systems):
                {systems_count[cur]}
                {if systems[cur] = "":
                    in an unknown system
                |else:
                    {OneOf("at","in")} {systems[cur]}
                }

                {set cur to cur + 1}
                {if cur = len(systems)-1: and |elif cur < len(systems):, }
            }
        }.
    }
|else:
    You {Occasionally(2,"currently")} have no missions at {OneOf("the moment","this time")}.
}

As you can see (or hear) Multi-destination missions (MDMs) are treated much the same as any other mission. It says that you have them, but treats each destination individually.

I would like peoples opinions on what to do next.

1. Should I just leave them as I have them now? Personally, I'm not satisfied with how it is, and feel it should have more use somehow.

2. Report MDMs as separate entities within each report type. So part of CheckGalaxy or CheckSystem would report normal missions, with a separate part reporting MDMs. e.g. "You have 5 missions in this system. This is also a stop for one of your multi-stop missions".

3. Mark visited systems in the database so that they are not used for reporting. The only way I can think of doing this is when checking the current system for missions, either when entering or leaving the system. If one is found for the current system, mark it as 'visited' and no longer report it. This will be useful for finding your next nearest destination. The only problem with this, is if you leave the system without completeing that part of your mission, it will consider it done, and not tell you to go back.

4. Mix both 2 & 3 above. More complex, but overall I think would probably be the best option.

As an extension of 3, I could make any visited system be blocked from reporting. This would be useful if you have lots of missions spread out and you don't want the MissionSystem telling you to go back to a place you just visited. I could then make use of the other State variables of 'OriginSystem' and 'OriginStation'. If all systems (or the only one) for a mission have been visited, then it could guide you back to the system you got the misssion so you can claim your rewards.

Let me know what you think, and I'll get to work on it. I may just end up going for number 4 anyway, but I wanted to see what you all thought first.


Option 3. As long as I can have it SOON™
 
Hi all, just discovered this thread so I thought I should mention a tweak that I posted in the main EDDI thread to make "Body scanned" and "Body report" mention the base system name much less.

Body report diff:

Code:
-    {P(reportbody.name)} is a
+    This is a

Body scanned full code:

Code:
{_ Context }
{SetState('eddi_context_last_subject', 'body')}
{SetState('eddi_context_last_action', 'scan')}
{SetState('eddi_context_body_system', system.name)}
{SetState('eddi_context_body_name', event.name)}

{set shortBodyName to event.name}
{set sysNameLen to len(system.name)}
{if len(shortBodyName) > sysNameLen && eq(system.name, slice(shortBodyName, 0, sysNameLen)):
    {set shortBodyName to cat("Body", slice(shortBodyName, sysNameLen))}
}

{Pause(1000)}

Scan of {P(shortBodyName)} complete.

{F("Body report")}

Full personality file here: https://www.dropbox.com/s/se2a75e577pmfce/Succint%20Explorer.json?dl=0
 
Last edited:
Hi VerticalBlank!

Welcome to the thread!

That's an interesting way to deal with the problem, and looks quite useful. I was also bugged by the fact the body name was repeated by the report right after a scan. So I have something similar in my profile. That's available in this thread too, if you want to take a look at it.

With suggestions like yours, I think you'll be a valuable contributor to this thread! :) Hope you stick around!

Regards,

-=] Darkcyde [=-
 
Hey Darkcyde,

Trying to wrap my head around the changes to the "Add' script... could you provide an example of a 'multi-destination' destinationsystem string that the 'Add' script now parses? I need to incorporate multi-destination mission IDs into my 'Traveling Salesman' route finder and it would aid greatly to my understanding.

Thanks!
 
Last edited:
Back
Top Bottom