FreeOrion

Forums for the FreeOrion project
It is currently Thu May 23, 2013 4:34 pm

All times are UTC




Post new topic Reply to topic  [ 115 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8  Next
Author Message
 Post subject: Re: Help with EffectsGroups
PostPosted: Sat Apr 14, 2012 12:23 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
Code:
            activation = ResourceSupplyConnectedByEmpire empire = Source.Owner condition = And [
                                                ^
I think it's just ResourceSupplyConnected (without the ByEmpire).


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Sat Apr 14, 2012 12:28 am 
Offline
Designer and Programmer
User avatar

Joined: Tue Aug 14, 2007 6:33 pm
Posts: 1772
Location: Orion
Doesn't seem like it:
Code:
2012-04-13 18:27:34,609 ERROR Client : C:\Users\Isaac\Downloads\Games\FreeOrion_VS2010_SDK\FreeOrion\default\species.txt:416:20: Parse error.  Expected Condition here:
            ]
            accountinglabel = "POPULATION_FOR_GOOD_LABEL"
            effects = SetTargetPopulation Value + 0

        EffectsGroup
            scope = Source
                    ^
            activation = ResourceSupplyConnected empire = Source.Owner condition = And [
                Focus "FOCUS_FARMING"
                Species "SP_HIDDENGARDENER"
                Planet environment = Good
            ]

_________________
Warning: Antarans in dimensional portal are closer than they appear.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Sat Apr 14, 2012 12:39 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
Doesn't seem like it:
Does changing to "activation = Source" remove the parse error?


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Sat Apr 14, 2012 12:52 am 
Offline
Designer and Programmer
User avatar

Joined: Tue Aug 14, 2007 6:33 pm
Posts: 1772
Location: Orion
Never mind - turns out the real problem was that the order of stackinggroup and accountinglabel were reversed...

edit: ...and that the actual effect is just called ResourceSupplyConnected, apparently.

_________________
Warning: Antarans in dimensional portal are closer than they appear.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Sat Apr 14, 2012 1:06 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
Never mind - turns out the real problem was that the order of stackinggroup and accountinglabel were reversed...
Yeah; one thing I don't like much about the boost parsing framework is that it seems to be difficult to have a set of (different) parameters that can be specified in any order. The way things are set up now, it has to be A then B then (C or nothing) then D. And then the location is specifies and the problem it had with parsing isn't always accurate, particularly when dealing with one or more optional parameters and the various optional labels for those parameters, as in this case of it complaining it wants a condition at the location where there is a condition. I guess it's still a lot better than writing one from scratch, though...

It might make things work better if all parameter labels were made non-optional, though that would be a bit of a pain to update the scripts to work with.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Thu Apr 26, 2012 6:29 pm 
Offline
Designer and Programmer
User avatar

Joined: Tue Aug 14, 2007 6:33 pm
Posts: 1772
Location: Orion
I'm trying to use the Max property to reduce the number of effectsgroups needed to select the best growth planet in range to provide a bonus. The following...
Code:
            EffectsGroup
                scope = Source
                activation = HasTag "ORGANIC"
                stackinggroup = "GROWTH_STACK"
                accountinglabel = "LEVEL_8_GROWTH_LABEL"
                effects = SetTargetPopulation Value + Max Growth And [
                    ResourceSupplyConnected Source.Owner Source
                    OwnedBy TheEmpire Source.Owner
                    Focus "FOCUS_GROWTH"
                ]

...gives a big fat bonus of 0 to all my planets, despite having a resource-supply connected planet with Growth of 2 in my empire. Is the Max statistic working?

Also, is there any max(a,b) function I can use to define the greater of either a or b?

_________________
Warning: Antarans in dimensional portal are closer than they appear.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Thu Apr 26, 2012 7:39 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
Is the Max statistic working?
I haven't tested any statistics in quite a while... Could you do some incremental testing, starting with something simpler?
Code:
effects = SetTargetPopulation Value + 5
Code:
effects = SetTargetPopulation Value + Source.Defense
Code:
effects = SetTargetPopulation Value + Sum Defense Planet
Code:
effects = SetTargetPopulation Value + Sum Growth Planet
Code:
effects = SetTargetPopulation Value + Max Growth Planet
Code:
effects = SetTargetPopulation Value + Max Growth And [
    Planet
    OwnedBy TheEmpire Source.Owner
    Focus "FOCUS_GROWTH"
]
etc... Try to see if it's any statistic, just Max, or something more particular that makes it not work...
Quote:
Also, is there any max(a,b) function I can use to define the greater of either a or b?
No.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Thu Apr 26, 2012 11:10 pm 
Offline
Designer and Programmer
User avatar

Joined: Tue Aug 14, 2007 6:33 pm
Posts: 1772
Location: Orion
Only the first two worked. All the ones involving statistics failed.

This appeared in the freeorion.log:

Code:
2012-04-26 17:12:33,596 ERROR Client : Variable<double>::Eval unable to follow reference:

_________________
Warning: Antarans in dimensional portal are closer than they appear.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Thu Apr 26, 2012 11:59 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
Only the first two worked. All the ones involving statistics failed.
Is there any error about parsing failing earlier in the log?


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Fri Apr 27, 2012 12:08 am 
Offline
Designer and Programmer
User avatar

Joined: Tue Aug 14, 2007 6:33 pm
Posts: 1772
Location: Orion
Geoff the Medio wrote:
Bigjoe5 wrote:
Only the first two worked. All the ones involving statistics failed.
Is there any error about parsing failing earlier in the log?

No. Also, it's in species.txt, and my species still exists, so it seems unlikely that the parsing failed.

_________________
Warning: Antarans in dimensional portal are closer than they appear.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Fri Apr 27, 2012 1:16 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
...it seems unlikely that the parsing failed.
Hmm. I'm quite busy this week, so I probably won't have a chance to look into this in the next few days. You might want to try adding (or uncommenting some existing) debug output lines in ValueRef::Statistic::<T>::GetObjectPropertyValues and ValueRef::Statistic<T>::ReduceData to see why it's not returning anything but 0...


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Fri Apr 27, 2012 1:57 am 
Offline
Designer and Programmer
User avatar

Joined: Tue Aug 14, 2007 6:33 pm
Posts: 1772
Location: Orion
On a totally unrelated note, is there a condition associated with Empire Meters?

_________________
Warning: Antarans in dimensional portal are closer than they appear.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Fri Apr 27, 2012 2:09 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
Bigjoe5 wrote:
...is there a condition associated with Empire Meters?
The EmpireMeterValue condition exists in code, but doesn't have parsing set up for it yet.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Sun Apr 29, 2012 10:52 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7891
Location: Vancouver, BC
I did some reworking, with a bit of a hack, but seem to have gotten statistics working, at least in a simple test case.


Top
 Profile  
 
 Post subject: Re: Help with EffectsGroups
PostPosted: Thu Jul 05, 2012 5:47 pm 
Offline
Design & Graphics Lead
User avatar

Joined: Sat Sep 23, 2006 7:09 pm
Posts: 3693
Location: USA — midwest
Generally population boost effect groups have to be repeated for each of the planet sizes, which is kind of an annoying complication to the scripts. Especially since they are mostly even increment increases from the size below.

Any chance that "planet size" could return a numeric value, so we could write something like this that would work for all planet sizes:

Code:
effects = SetTargetPopulation Value + 4 * PlanetSize


The numbers values would be simple, the smallest size would count as "1", and each increasing size would be one higher.

I don't see a clean way to do something similar with macros, and this would reduce the number of effect groups that need to be calculated.

_________________
—• Read this First before posting Game Design Ideas!
—• Design Philosophy

—•— My Ideas, Organized —•— Get an Avatar —•— Acronyms —•—


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 115 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8  Next

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 © 2000, 2002, 2005, 2007 phpBB Group