FreeOrion

Forums for the FreeOrion project
It is currently Mon Dec 11, 2017 2:08 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Jan 27, 2017 3:47 pm 
Offline
Dyson Forest

Joined: Tue Sep 30, 2014 10:01 am
Posts: 211
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.

_________________
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Fri Jan 27, 2017 6:12 pm 
Offline
Programmer

Joined: Sun Feb 14, 2016 12:08 am
Posts: 358
Which value are you looking for, most are in parse/DoubleValueRefParser.cpp
e.g. for supply:
Code:
tag = "rawtext" data = Target.Supply


Top
 Profile  
 
PostPosted: Fri Jan 27, 2017 10:10 pm 
Offline
Dyson Forest

Joined: Tue Sep 30, 2014 10:01 am
Posts: 211
dbenage-cx wrote:
Which value are you looking for, most are in parse/DoubleValueRefParser.cpp
e.g. for supply:
Code:
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 .

_________________
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Sat Jan 28, 2017 7:17 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12039
Location: Munich
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.


Top
 Profile  
 
PostPosted: Sat Jan 28, 2017 11:51 pm 
Offline
Dyson Forest

Joined: Tue Sep 30, 2014 10:01 am
Posts: 211
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

_________________
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Sun Jan 29, 2017 6:36 pm 
Offline
Dyson Forest

Joined: Tue Sep 30, 2014 10:01 am
Posts: 211
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?

_________________
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
PostPosted: Sun Jan 29, 2017 6:40 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12039
Location: Munich
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.


Top
 Profile  
 
PostPosted: Sun Jan 29, 2017 8:58 pm 
Offline
Dyson Forest

Joined: Tue Sep 30, 2014 10:01 am
Posts: 211
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 :)

_________________
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group