Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'inventory' always blank during the 'Location' event #2622

Closed
Darkcyde13 opened this issue Jun 16, 2024 · 3 comments
Closed

'inventory' always blank during the 'Location' event #2622

Darkcyde13 opened this issue Jun 16, 2024 · 3 comments
Assignees
Labels
7. confusing The expected behaviour per the spec turned out to be misunderstood by real-world users. please test Please test and provide feedback.

Comments

@Darkcyde13
Copy link

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

Expected

The 'inventory' object to always be populated when you are carrying cargo.

Observed

When used within the 'Location' event, either while playing the game, or clicking the test button, 'inventory' is empty, even when you have cargo on board.

Steps to reproduce

  1. Have some cargo in your ship.
  2. Create a blank script, and add this code:
{for cargo in inventory:
    {cargo.name}
}
  1. Run the code and check the inventory list is correct.
  2. Add that same code to the end of the 'Location' event script and run the script.
  3. Observe that the inventory is blank.

Configuration

  • Version [Please give full version numbers here, not just "latest" or "current"]
    • EDDI Version: v4.0.4-b2
    • VoiceAttack Version: [if applicable] N/A
  • Localization [if applicable]
    • EDDI's language: [or the operating system language if EDDI's language setting is "Automatic"]
    • Voice: [Name and language]

My Investigation

Investigation Notes

I first noticed this when looking into adding some functionality that CMDR Yianniv provided to me regarding corrosive cargo, using v4.0.4-b1. I wanted to add a call to the code at the end of the 'Location' event script, but I was getting odd results, like I had no cargo, even though I had a few Thargoid items on board.

I narrowed it down to 'inventory' being empty during the 'Location' event (although 'cargoCarried' is correct). As 'Location' comes straight after 'Commander continued' when starting a game, I added the call to the 'Commander continued' script, and it worked as expected there, but not in 'Location'. As a workaround, I've set it to a State() variable in 'Commander continued' which I then use at the end of the 'Location' script.

I've tried going back to v4.0.3, but that is the same.

EDDI Logs

I'm not seeing any entries in the log for this.

Player journals

N/A

@Tkael
Copy link
Member

Tkael commented Jun 17, 2024

I apologize but I am unable to replicate the issue by injecting

{for cargo in inventory:
    {cargo.name}
}

at either the start or end of the default Location event.

Perhaps your personality is overwriting the inventory variable the same way we saw recently with state? This might happen indirectly if you call another script which does this.

For the default personality I do see some scripts which set inventory to a new value. I'll plan to update these to prevent a conflict.

  • Blueprint make report
  • Material discard report
  • Material inventory report
  • Material required report

@Tkael Tkael self-assigned this Jun 17, 2024
@Tkael Tkael added please test Please test and provide feedback. 7. confusing The expected behaviour per the spec turned out to be misunderstood by real-world users. labels Jun 17, 2024
@Darkcyde13
Copy link
Author

Hmm, OK. I tried it with a copy of the default EDDI personality (yeah, I know, I should have done that first. It was late, I was tired. 😅 ) and yep it worked. So I looked into my version of the Location script, adding that code snippet at the very start, and it worked.

Well, to cut a long story short as they say, I traced it to a call in 'Location' to my 'System Exploration Report' script, and from there I traced it to the 'System material report'. In that script is a line setting 'inventory' to an inline function!
{set inventory(materialName) to: and it's THIS that was messing everything up for me! This is line 99 in the EDDI default, so that's another instance that needs to be changed along with the four you mentioned above.

I have gone through my personality and changed all instances of {set inventory... to {set materialInventory... as, so far, they are all used with regards to materials. I may shorten it to just matInventory, but for now materialInventory works fine.

Thank you for pointing me in the right direction! I don't think I would have traced it so easily otherwise. 😄

@Tkael
Copy link
Member

Tkael commented Jun 18, 2024

Hmm, OK. I tried it with a copy of the default EDDI personality (yeah, I know, I should have done that first. It was late, I was tired. 😅 ) and yep it worked. So I looked into my version of the Location script, adding that code snippet at the very start, and it worked.

Well, to cut a long story short as they say, I traced it to a call in 'Location' to my 'System Exploration Report' script, and from there I traced it to the 'System material report'. In that script is a line setting 'inventory' to an inline function! {set inventory(materialName) to: and it's THIS that was messing everything up for me! This is line 99 in the EDDI default, so that's another instance that needs to be changed along with the four you mentioned above.

I have gone through my personality and changed all instances of {set inventory... to {set materialInventory... as, so far, they are all used with regards to materials. I may shorten it to just matInventory, but for now materialInventory works fine.

Thank you for pointing me in the right direction! I don't think I would have traced it so easily otherwise. 😄

Nice sleuthing! :-)

@Tkael Tkael closed this as completed in a3151ac Jun 18, 2024
bcthund pushed a commit to bcthund/EDDI that referenced this issue Jun 26, 2024
…inventory` map used for tracking cargo.

Resolves EDCD#2622.
bcthund pushed a commit to bcthund/EDDI that referenced this issue Jun 26, 2024
…inventory` map used for tracking cargo.

Resolves EDCD#2622.
bcthund pushed a commit to bcthund/EDDI that referenced this issue Jun 26, 2024
…inventory` map used for tracking cargo.

Resolves EDCD#2622.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7. confusing The expected behaviour per the spec turned out to be misunderstood by real-world users. please test Please test and provide feedback.
Projects
None yet
Development

No branches or pull requests

2 participants