Page 1 of 1

Adding FOCS way to get empire meter value

Posted: Fri Jan 27, 2017 3:47 pm
by Ophiuchus
There is SetEmpireMeter for set a meter and EmpireMeter for comparing in a query.
As far as I understand the parser and scripting system, there is currently no way to get the value of an empire meter (e.g. for using it in a sitrep).

In which of the parsers would I add this? I looked around awhile am not completely sure where to add it.

Re: Adding FOCS way to get empire meter value

Posted: Fri Jan 27, 2017 6:12 pm
by dbenage-cx
Which value are you looking for, most are in parse/DoubleValueRefParser.cpp
e.g. for supply:

Code: Select all

tag = "rawtext" data = Target.Supply

Re: Adding FOCS way to get empire meter value

Posted: Fri Jan 27, 2017 10:10 pm
by Ophiuchus
dbenage-cx wrote:Which value are you looking for, most are in parse/DoubleValueRefParser.cpp
e.g. for supply:

Code: Select all

tag = "rawtext" data = Target.Supply
I was not looking really looking for a specific value. You can add empire meters using FOCS. I think it would be good to have a scripting access to the current value as well.

And of course there is also a specific value. The reason is that i added empire meters (e.g. for yield) for the implementation of imperial stockpile. I want to give a sitrep indication about it.
And as long there is no automatic UI and effect accounting for an empire meter this might be the only way for a scripter to communicate values .

Re: Adding FOCS way to get empire meter value

Posted: Sat Jan 28, 2017 7:17 am
by Geoff the Medio
You'd need to add cases in ComplexVariable<double>::Eval to handle "EmpireDetection", "EmpireProductionStockpileYield", "EmpireProductionStockpileMax", and perhaps others. Then add cases in DoubleComplexValueRefParser.cpp to parse this. Should add cases for all the empire meters in Empire::Init. Any new symbols need to be added to Tokens.h for the parser.

Re: Adding FOCS way to get empire meter value

Posted: Sat Jan 28, 2017 11:51 pm
by Ophiuchus
Geoff the Medio wrote:You'd need to add cases in ComplexVariable<double>::Eval to handle "EmpireDetection", "EmpireProductionStockpileYield", "EmpireProductionStockpileMax", and perhaps others. Then add cases in DoubleComplexValueRefParser.cpp to parse this. Should add cases for all the empire meters in Empire::Init. Any new symbols need to be added to Tokens.h for the parser.
I addressed the general meter access first and created a pull request

Re: Adding FOCS way to get empire meter value

Posted: Sun Jan 29, 2017 6:36 pm
by Ophiuchus
Ophiuchus wrote:
Geoff the Medio wrote:You'd need to add cases in ComplexVariable<double>::Eval to handle "EmpireDetection", "EmpireProductionStockpileYield", "EmpireProductionStockpileMax", and perhaps others. Then add cases in DoubleComplexValueRefParser.cpp to parse this. Should add cases for all the empire meters in Empire::Init. Any new symbols need to be added to Tokens.h for the parser.
I addressed the general meter access first and created a pull request
The general case is merged.
So for those special cases, a question regarding the parser concepts.
Why should those be "complex" compared to not-complex variables?

Re: Adding FOCS way to get empire meter value

Posted: Sun Jan 29, 2017 6:40 pm
by Geoff the Medio
Ophiuchus wrote:So for those special cases, a question regarding the parser concepts.
Why should those be "complex" compared to not-complex variables?
An empire meter is not a property of an UniverseObject. Target.Stealth make sense. Target.SomeEmpireShowhowRelatedToTargetOrMaybeNotsDetection doesn't really.

Re: Adding FOCS way to get empire meter value

Posted: Sun Jan 29, 2017 8:58 pm
by Ophiuchus
Geoff the Medio wrote:
Ophiuchus wrote:So for those special cases, a question regarding the parser concepts.
Why should those be "complex" compared to not-complex variables?
An empire meter is not a property of an UniverseObject. Target.Stealth make sense. Target.SomeEmpireShowhowRelatedToTargetOrMaybeNotsDetection doesn't really.
Ok, thanks :)