Closed rodan123 closed 6 years ago
Update again: Didn't have this issue prior to localization. Inspecting the code I see that systemState, VA {TXT:System state}, is the only localized variable in setStarSystemValues.
Commented out vaProxy.SetText(prefix + " state", system?.systemState.localizedName);
in VoiceAttackPlugin.cs method setStarSystemValues, compiled
and restarted EDDI , VA threw no exceptions on startup. Test script output:
8:25:30 PM - STNS: 9
8:25:30 PM - DTH: 20.11
8:25:30 PM - COMT: Not set
8:25:30 PM - MV: Not set
8:25:30 PM - PV: Not set
8:25:30 PM - VSTS: 1
8:25:30 PM - Z: -23.8125
8:25:30 PM - Y: -10.0625
8:25:30 PM - X: 4.9375
8:25:30 PM - POWS: <phoneme alphabet="ipa" ph="ˈzækərɪ">Zachary</phoneme> <phoneme alphabet="ipa" ph="ˈhʌdsən">Hudson</phoneme>
8:25:30 PM - POW: Zachary Hudson
8:25:30 PM - STE: Not set
8:25:30 PM - ECON: Industrial
8:25:30 PM - FAC: Green Party of Lung
8:25:30 PM - GOV: Corporate
8:25:30 PM - ALG: Federation
8:25:30 PM - POPS: around 11 and a half million
8:25:30 PM - POP: 11509728
8:25:30 PM - NAMS: Tabit
8:25:30 PM - SYS: Tabit
Will continue testing to verify.
Note: Also in the wiki under VA integration, {DATETIME:System previous visit}: the last time the commander visited the system (empty if this is their first visit) There is no DATETIME variable type in VA, should be DATE? From the VA docs: DateTimeValues parameter The dateTimeValues parameter is a dictionary of (String, DateTime). It behaves pretty much exactly like the smallIntegerValues parameter, except the token to access a text value is {DATE:variableName}, and you pass in values to your plugin via the Date/Time Variables box in the command action.
Followup:
Traced issue to DataDefinitions\SystemState.cs
Declarations for;
None
CivilUnrest
CivilWar
are treated differently than the other system states. Not sure why. Seem to be set as constants...
… Gets messy. Maybe cleanup is part of Internationalization - phase 2 ?
I also noticed this inconsistency while working on the Mission Monitor. Also not sure why specific coding for those faction states.
Alright... regarding the date question:
EDDI uses this function detailed in VoiceAttack's help. SetDate(string VariableName, DateTime? Value) – Set a nullable DateTime value
. Usage appears to be correct and I'm not seeing any exceptions coming from this.
I'll look at system state next...
Copied from EDDI Dev Team discord message...
Question: @VerticalBlank (CMDR Ky Vatta)#7518 Why are some system states treated differently than others?
None = new SystemState("None");
var Retreat = new SystemState("Retreat");
var War = new SystemState("War");
var Lockdown = new SystemState("Lockdown");
CivilUnrest = new SystemState("CivilUnrest");
CivilWar = new SystemState("CivilWar");
var Boom = new SystemState("Boom");
var Expansion = new SystemState("Expansion");
var Bust = new SystemState("Bust");
var Outbreak = new SystemState("Outbreak");
var Famine = new SystemState("Famine");
var Election = new SystemState("Election");
var Investment = new SystemState("Investment");
}
public static readonly SystemState None;
public static readonly SystemState CivilUnrest;
public static readonly SystemState CivilWar;
Why not follow the same format for all?
Response: I only exposed the ones that are directly referenced externally. All the others are only looked up by name or by EDName. I was kind of feeling my way at the time and was trying to minimise the amount of public API. To be honest right now I just want to get the damn thing squared away -- I'm getting a bit sick of it as you might imagine!
Conclusions:
Needs further testing to determine whether this break from the standard pattern is the true source of these exceptions... I'll head to a system with Civil War
or Civil Unrest
states tonight and try to replicate the exceptions you are reporting.
Alright... regarding the date question: EDDI uses this function detailed in VoiceAttack's help. SetDate(string VariableName, DateTime? Value) – Set a nullable DateTime value. Usage appears to be correct and I'm not seeing any exceptions coming from this. I'll look at system state next...
I guess I wasn't clear. The issue with the date has nothing to do with the exceptions. It is an error I noticed in the Wiki Documentation https://github.com/EDCD/EDDI/wiki/VoiceAttack-Integration under the headings; Current System Variables and Last System Variables DATETIME is listed as the variable type for visits, it should read DATE
The system, Tabit, that I had exceptions thrown with, was in a None
state.
You can see from my testing that the VA variables System state and everything below that are unset when the plugin bails on the exception.
I have been running a build with
the line vaProxy.SetText(prefix + " state", system?.systemState.localizedName);
commented out in method setStarSystemValues (VoiceAttackPlugin.cs) .
VA hasn't thrown an exception since.
So I am pretty confident the problem lies there. None
, Civil War
. and Civil Unrest
can't be changed since they're declared static readonly
Ahh ok. Wiki updated.
I'm having trouble replicating your results for the state exceptions... I've been jumping all around None
state systems and haven't seen this exception yet. Definitions are by definition something that we don't expect to modify, and like I said I haven't been able to replicate your results yet.
It's possible that EDDI isn't choking on the current version of the system data but rather the archived version that it pulls from your database to refresh as you travel between systems. If so, you should be able to resolve these errors with a Develop
build of EDDI by re-obtaining your EDSM logs (which will refresh the star systems in your database to match current definitions)?
I did a full sync with EDSM as you suggested and am on an develop build.
Tried testing in a Civil Unrest system, didn't see the issue. So, may have gone down a wrong path blaming the static readonly
declarations. But...
Went to another system in a "None" faction state, Toofla. See attached log. Also received errors when I jumped out of Toofla to a uninhabited system, but need to verify more that the issue happens in uninhabited systems also.
Found a few more unrelated minor bugs while testing;
Logging:_Report [I] Reporting unique data, anonymous ID 488bd183-1431-4f31-8aec-ccc0b3ac9727: Unknown ED name power transfer bus in resource EddiDataDefinitions.Properties.CommoditiesSystem.Collections.Generic.Dictionary
2[System.String,System.Object] `
I was interdicted near the star and got this error;
EDDI:eventHandler [E] Failed to handle event {"system":"Toolfa","bodytype":"Star","body":"Toolfa A","raw":"{ \"timestamp\":\"2018-06-02T14:25:17Z\", \"event\":\"SupercruiseExit\", \"StarSystem\":\"Toolfa\", \"SystemAddress\":35855326520745, \"Body\":\"Toolfa A\", \"BodyID\":1, \"BodyType\":\"Star\" }","timestamp":"2018-06-02T14:25:17Z","type":"Entered normal space"} System.NullReferenceException: Object reference not set to an instance of an object. at Eddi.EDDI.eventEnteredNormalSpace(EnteredNormalSpaceEvent theEvent) at Eddi.EDDI.eventHandler(Event event)
Visited a few systems around Toolfa, errors galore.
Rebuilt EDDI with one line commented out in setStarSystemValues (VoiceAttackPlugin.cs) .
vaProxy.SetText(prefix + " state", system?.systemState.localizedName);
and did a return trip, clean log.
Did you happen to log in in Toolfa? I just got a very similar set of error messages right after logging in... We may be trying to set Star System values before they have been set...
Ok, I think I've found the issue. Please test PR #619?
See #619 comment. Looks good. Will continue testing. Thx.
PRT merged.
EDDI version in which issue found
3.0.1-b4 running under Voice Attack
Steps to reproduce
Expected
Clean Startup _2018-05-28T20:03:48 VoiceAttackPlugin:VAInit1 [I] EDDI VoiceAttack plugin initialization complete 2018-05-28T20:03:48 StarMapService:Sync [I] EDSM sync completed
Observed
Exceptions thrown _2018-05-28T19:24:09 EDDI:Start [I] Started VoiceAttack responder 2018-05-28T19:24:09 StarMapService:Sync [I] Syncing with EDSM 2018-05-28T19:24:10 VoiceAttackPlugin:setStatus [W] EDDI exception: System.NullReferenceException: Object reference not set to an instance of an object. at EddiVoiceAttackResponder.VoiceAttackPlugin.setStarSystemValues(StarSystem system, String prefix, Object& vaProxy) 2018-05-28T19:24:10 VoiceAttackPlugin:VAInit1 [I] EDDI VoiceAttack plugin initialization complete 2018-05-28T19:24:10 StarMapService:Sync [I] EDSM sync completed 2018-05-28T19:24:10 VoiceAttackPlugin:setStatus [W] EDDI exception: System.NullReferenceException: Object reference not set to an instance of an object. at EddiVoiceAttackResponder.VoiceAttackPlugin.setStarSystemValues(StarSystem system, String prefix, Object& vaProxy)
Investigation
After it throws exceptions, all calculated system EDDI VA variables appear 'Not set" ie; {DEC:System minutes since previous visit}, {DEC:System X}, {DEC:System distance from home}, {INT:Last system visits}, although they are set in EDDI when using cottle scripting. Static system variables appear to be unaffected, ie; {TXT:System name}, {DEC:System population}
Update: Looking at the System variables, they all seem to be set in EDDI but everything below and including {TXT:system state} are not set in VA. cottle {system.state} and others are set in EDDI.
Output from VA;
Read from bottom in order set by VoiceAttackPlugin.cs. 7:36:05 PM - DTH: Not set 7:36:05 PM - COMT: Not set 7:36:05 PM - MV: Not set 7:36:05 PM - PV: Not set 7:36:05 PM - VSTS: Not set 7:36:05 PM - Z: Not set 7:36:05 PM - Y: Not set 7:36:05 PM - X: Not set 7:36:05 PM - POWS: Not set 7:36:05 PM - POW: Not set 7:36:05 PM - STE: Not set 7:36:05 PM - ECON: Industrial 7:36:05 PM - FAC: Green Party of Lung 7:36:05 PM - GOV: Corporate 7:36:05 PM - ALG: Federation 7:36:05 PM - POPS: around 11 and a half million 7:36:05 PM - POP: 11509728 7:36:05 PM - NAMS: Tabit 7:36:05 PM - SYS: Tabit