cmdrmcdonald / EliteDangerousDataProvider

Apache License 2.0
134 stars 31 forks source link

Login while docked at station doesn't trigger location or docked. #287

Closed bronney closed 6 years ago

bronney commented 6 years ago

Hello mcdonald!

Thanks for a fantastic app. I am currently improving my VA profile and noticed if I log in to ED while already docked in a station, the Location event doesn't trigger, nor does ((EDDI docked)). But if I login while landed on a planet's surface, it triggers ((EDDI touchdown)).

Login while docked. image

Login while landed. image * I got around it by starting my initialization with inserting a conditional check if {TXT:EDDI docked station} does not equal ''. So if this car has a string, VA knows I am docked. It works for now but would be great if ((EDDI docked)) works like ((EDDI touchdown)). Can you take a look please?

bronney commented 6 years ago

Well, just tested. The {TXT:EDDI docked station} trick doesn't work either as after I undocked, {TXT:EDDI docked station} still report the station name. So sad :(

Tkael commented 6 years ago

why not initialize off of ((EDDI commander continued))?

bronney commented 6 years ago

What if I login in space? As an example, I am writing a profile where instead of trying to deploy your guns while docked and fail, with zero feedback, yet VA thinks you deployed and therefore set var deploy = 1. Right when you undocked and really wanna deploy but either the var won't let you, or that you don't check var and it deploys but now the var is 0. You see the problem? All sorts of problem.

I see many commanders resort to an initializing script but this should be a last resort, it should only be run once because it's called "initialize". I shouldn't have to keep resetting my var while busy flying a spaceship. I hope it clears up why it's imperative to have a state of docked triggered when login from stations. Cheers and thanks for reply :)

If you have 30 mins. to spare and don't mind my chinglish, have a look at a demo I did just now. Something I am working on off Ishmair's: https://www.youtube.com/watch?v=SRFedNqFwn8

mikelimtw commented 6 years ago

Hi Bronney,

I use a boolean variable called Docked which I save with the profile. When I dock it gets set to True and when I undock it gets set to False. When I log back in, I check the value of the Docked variable in my VA profile to tell me whether I am in a station or out in space and set the defaults for things like gear and weapons, etc. So far it's worked for me.

bronney commented 6 years ago

Thanks for help dude. But what if you docked, log out, and quit VA? And tomorrow you undocked, log out and quit VA? After you turn VA back on how will it know whether you're docked or undocked? How do you save a variable with a profile? I see write text to a file which can be useful but there's no read text from a file function.

Tkael commented 6 years ago

In VoiceAttack, when you set a variable you can check a box that says 'Save value to profile'. If this box is checked, VoiceAttack will remember the variable's value even after you've exited VA. untitled

bronney commented 6 years ago

omg you guys!! Thank you so much. Big mug for you!!

Tkael commented 6 years ago

if this issue is resolved, please mark it as closed. thanks!

bronney commented 6 years ago

Well it came back but I am guessing it's a cAPI issue and will just wait. I think we can close it. Just a note it came back right when I successfully connect to the Frontier API. If I disconnect it, the docked event acts fine.

Tkael commented 6 years ago

hmm. sounds like EDDI might be throwing an exception from your docked event. Do you use a custom docked script or call EDDI for information as part of your VoiceAttack ((EDDI docked)) command?

bronney commented 6 years ago

Nope, my docked script in EDDI is default, only saying docking complete. The one inside VA is like below with VA vars. I am puzzled.
image

Btw the shipyard and ship sizes also never updates even with API connection. It kept saying my annie is a python and never refresh my ship list. I swapped all 5 of my ships at Sol, same result. image

Tkael commented 6 years ago

If your shipyard isn't updating, even after connecting to the API, they your shipyard data may be corrupted. Fixing that might help. Do you have multiple accounts?

You can reset the shipyard by closing completely out of VoiceAttack and EDDI, then navigating to %APPDATA%/EDDI. Delete 'shipmonitor.json', then restart EDDI. If you are on the latest beta, basic info should repopulate immediately for all ships in your shipyard. Cycling through each of your ships is still recommended to allow EDDI to collect full information on those ships again.

bronney commented 6 years ago

I followed your instructions and now it shows below after swapping all ships. Ship size now says small no matter what ship. Does it have to do with not running VA or EDDI as admin? My user is admin. Does it have to do with virus scan being on? I am very puzzled if the hauler write was successful what's preventing the json from capturing more ships? I opened it with notepad and only see the hauler also.

image

bronney commented 6 years ago

Wow this is so weird, after I quit everything just now, it sees my dolphin but no name. And when I opened the file in notepad there's this messed up part in the middle. Attaching. I changed it to txt to attach. shipmonitor - Copy.txt EDIT: I went in yet again and this time it captures more, but the Type-7 is blank. I am going to uninstall EDDI and delete the whole EDDI in app data and try reinstalling again. I haven't done much within EDDI so it should be fine. Will update if anything new. Cheers. image

bronney commented 6 years ago

Ok now we're in business! image I uninstalled EDDI 2.3.1, delete the EDDI app data folder. Installed b5. Now all the ship sizes reports correctly when I swap. I still don't get a docked event when log in, or swap. And as you can see in the last row of the ship monitor there are blank fields. I suspect if I quit ED now it will corrupt the files again. So as I type this now I am swapping the anaconda once more to the hauler, and as suspected it fills up the blank fields: image

But when I am in my hauler now, the hauler has blank fields. I think that's how it screwed up. Quitting while blank. Perhaps you can fix it somehow? And notice I am still not getting the docked event when log in, maybe they're related. Cheers.

EDIT: by "blank fields" I meant "location", which is related to my earlier issue post about how EDDI isn't recognizing the location event for me. Something deep is going on bro.

EDIT2: I quit ED and went back in, swapped ship, whatever ship I swap to, the Sol will be gone from ship monitor. I guess it's working as intended. It's not corrupted anymore. I also tested all the location commands and they're all working. So as far as this goes it's solved aside from not getting a docked event when log in. Thanks for taking care of this man. I am happy at this state.

EDIT3: I tested the location event again and it's broke. I flew to EURYBIA and docked at Liz Ryder and the location report me being in SOL.

Tkael commented 6 years ago

I can't open your txt file? you didn't mention whether you have multiple accounts... the account you use with the API needs to be the same as the account your flying. The location of your active ship is always un- set / in motion.

for the docked issue, here's what I want you to do:

  1. fly yourself to just outside of a station
  2. exit EDDI/VoiceAttack
  3. Navigate to %appdata%/EDDI
  4. Delete EDDI.log
  5. Open EDDI & enable verbose logging
  6. Switch back to Elite and dock
  7. Switch back to EDDI and turn off verbose logging
  8. attach a copy of the log to this issue so that I can review it

Thanks!

bronney commented 6 years ago

I followed exactly as you said, here's the log file. Thanks bro. Also I only have one account. eddi.log

Tkael commented 6 years ago

Ok. I don't see anything particularly weird in the log here. Did the dock event trigger during this test?

bronney commented 6 years ago

Yes. It always triggers. It just doesn't trigger if I log in already docked. But it used to when the API was non-operational. So that if I, Say, '{TXT:EDDI docked station}', right after log in while docked, it will say not set. If I launch and dock again it will say the correct thing.

And if I do this after undocking and jumped from RHEA to LQ, next to destination star: Say, 'Dock is {BOOL:EDDI location docked}, station type {TXT:EDDI location stationtype}' (and wait until it completes) Say, 'Location {TXT:EDDI location system} system.' (and wait until it completes) Execute external plugin, 'EDDI 2.4.0-b5' and wait for return

It will say I am docked, read me the station type, and in LQ. Now I drop off the passengers, and jump back to RHEA, and do the above again it will say I am still in LQ. And {BOOL:EDDI location docked} is always true.

EDIT: I recorded the above, see if it helps or if you need anything else to solve the location event thing. Thanks. https://youtu.be/JNip4t_khM8

Tkael commented 6 years ago

did you happen to have a verbose log from that flight? what specific EDDI variables are you calling in your commands?

bronney commented 6 years ago

I can do another logged session tomorrow, but the 2 commands I used in the vid are these: 1: Log in while docked, it says not set. Say, '{TXT:EDDI docked station}' Execute external plugin, 'EDDI 2.4.0-b5' and wait for return 2: I say ship size it returns the following. Say, '{TXT:Ship size}' (and wait until it completes) Say, 'Dock is {BOOL:EDDI location docked}, station type {TXT:EDDI location stationtype}' (and wait until it completes) Say, 'Location {TXT:EDDI location system} system.' (and wait until it completes) Execute external plugin, 'EDDI 2.4.0-b5' and wait for return

Tkael commented 6 years ago

Event specific variables are only updated during the applicable event. The docked variables are only updated during the docked event. Likewise, the location variable is only updated during the location event. Essentially, you're using variables that capture a snapshot in time. VoiceAttack holds onto the last value that they were set to but in EDDI they would be "not set" except during the applicable event.

The globally updated variables are listed at https://github.com/EDCD/EDDI/wiki/VoiceAttack-Integration. Try using {TXT:System name (spoken)} or {TXT:System name} if you want a system value shall remain up to date when you aren't docked? I'd also recommend setting your own VoiceAttack boolean as true or false based on the initial "docked" condition and following events. There is not currently any global variable in EDDI for tracking whether your ship is docked or undocked at any given moment.

If you would like to raise any further issues, please raise them here: https://github.com/EDCD/EDDI/issues

bronney commented 6 years ago

Thanks man this clears it up totally. Wasn't aware those aren't global. The above doesn't affect me once you told me I can save var values in VA it solved all my problems. Thanks again dude and keep up the good work. Sorry for taking up so much of your time I know you're busy :)