User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

EvalSubUnitCount bug?

Sun Feb 22, 2009 12:05 pm

Hi folks, I have an event that places traders inside fort Detroit when Indians besige the structure. When the Indians leave the region the traders leave the fort.

However both events happen on the same turn. When Indians first move into the region traders move into the fort and immediatly move out.

Event 1 (This should be true)
SelectSubUnits Region $Le Detroit|Families $famRaider
EvalSubUnitCount >=|1

Event 2 (This should be false)
SelectSubUnits Region $Le Detroit|Families $famRaider
EvalSubUnitCount =|0

The log has this entry for the second event :-

EvalSubUnitCount: Natives Selected SUs: 18 against 0 - Operator: = Result: True

18 = 0 is True!

Something wrong here?
Full events attached and log below.
Cheers, Chris

Line 3053: SelectFactions, 1 Faction selected: Great Britain
Line 3055: Started processing event: evt_nam_DetroitTraders1PW
Line 3055: Event already referenced, current occurences 0 Max allowed: 1 <<Active>>
Line 3058: EvalRgnStruc: Checking 138 Le Detroit for the presence of a particular structure True
Line 3060: SelectFactions, 1 Faction selected: Natives
Line 3061: SelectSubUnits 1000812 Braves added, List Count now at: 1
Line 3061: SelectSubUnits 1000811 Braves added, List Count now at: 2
Line 3061: SelectSubUnits 1000808 Braves added, List Count now at: 3
Line 3061: SelectSubUnits 1000807 Braves added, List Count now at: 4
Line 3061: SelectSubUnits 1000783 Braves added, List Count now at: 5
Line 3061: SelectSubUnits 1000782 Braves added, List Count now at: 6
Line 3061: SelectSubUnits 1000786 Braves added, List Count now at: 7
Line 3061: SelectSubUnits 1000785 Braves added, List Count now at: 8
Line 3061: SelectSubUnits 1000777 Braves added, List Count now at: 9
Line 3061: SelectSubUnits 1000776 Braves added, List Count now at: 10
Line 3061: SelectSubUnits 1000780 Braves added, List Count now at: 11
Line 3061: SelectSubUnits 1000779 Braves added, List Count now at: 12
Line 3061: SelectSubUnits 1000774 Braves added, List Count now at: 13
Line 3061: SelectSubUnits 1000773 Braves added, List Count now at: 14
Line 3061: SelectSubUnits 1000794 Braves added, List Count now at: 15
Line 3061: SelectSubUnits 1000793 Braves added, List Count now at: 16
Line 3061: SelectSubUnits 1000815 Braves added, List Count now at: 17
Line 3061: SelectSubUnits 1000814 Braves added, List Count now at: 18
Line 3061: SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 18
Line 3062: EvalSubUnitCount: Natives Selected SUs: 18 against 1 - Operator: >= Result: True
Line 3064: SelectFactions, 1 Faction selected: Great Britain
Line 3066: Entering triggered actions for event evt_nam_DetroitTraders1PW
Line 3068: SelectFactions, 1 Faction selected: Great Britain
Line 3069: SelectRegion, 138 Le Detroit selected (simple mode)
Line 3077: Great Britain Detroit Traders created in region Le Detroit
Line 3082: Traders created in group Detroit Traders
Line 3084: Finished processing event: evt_nam_DetroitTraders1PW
Line 3084: ------------------------------
Line 3086: SelectFactions, 1 Faction selected: Great Britain
Line 3088: Started processing event: evt_nam_DetroitTraders2PW
Line 3088: Event already referenced, current occurences 0 Max allowed: 1 <<Active>>
Line 3091: EvalEvent evaluated: Checking evt_nam_DetroitTraders1PW 1 equal to 1 True
Line 3092: EvalRgnStruc: Checking 138 Le Detroit for the presence of a particular structure True
Line 3094: SelectFactions, 1 Faction selected: Natives
Line 3095: SelectSubUnits 1000812 Braves added, List Count now at: 1
Line 3095: SelectSubUnits 1000811 Braves added, List Count now at: 2
Line 3095: SelectSubUnits 1000808 Braves added, List Count now at: 3
Line 3095: SelectSubUnits 1000807 Braves added, List Count now at: 4
Line 3095: SelectSubUnits 1000783 Braves added, List Count now at: 5
Line 3095: SelectSubUnits 1000782 Braves added, List Count now at: 6
Line 3095: SelectSubUnits 1000786 Braves added, List Count now at: 7
Line 3095: SelectSubUnits 1000785 Braves added, List Count now at: 8
Line 3095: SelectSubUnits 1000777 Braves added, List Count now at: 9
Line 3095: SelectSubUnits 1000776 Braves added, List Count now at: 10
Line 3095: SelectSubUnits 1000780 Braves added, List Count now at: 11
Line 3095: SelectSubUnits 1000779 Braves added, List Count now at: 12
Line 3095: SelectSubUnits 1000774 Braves added, List Count now at: 13
Line 3095: SelectSubUnits 1000773 Braves added, List Count now at: 14
Line 3095: SelectSubUnits 1000794 Braves added, List Count now at: 15
Line 3095: SelectSubUnits 1000793 Braves added, List Count now at: 16
Line 3095: SelectSubUnits 1000815 Braves added, List Count now at: 17
Line 3095: SelectSubUnits 1000814 Braves added, List Count now at: 18
Line 3095: SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 18
Line 3096: EvalSubUnitCount: Natives Selected SUs: 18 against 0 - Operator: = Result: True
Line 3098: SelectFactions, 1 Faction selected: Great Britain
Line 3100: Entering triggered actions for event evt_nam_DetroitTraders2PW
Line 3101: SelectSubUnits 1001114 Traders added, List Count now at: 1
Line 3101: SelectSubUnits finished Regions Selected: 1 SubUnits Selected: 1
Line 3102: AlterCuSubUnit Probability set to: 100
Line 3102: AlterCuSubUnit Attempts set to: 1
Line 3102: RemoveCuSubUnit, operation done on Traders Unit: Traders Group: Detroit Traders Faction: Great Britain in region: Le Detroit
Line 3104: Finished processing event: evt_nam_DetroitTraders2PW
Attachments

[The extension xls has been deactivated and can no longer be displayed.]


User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Sun Feb 22, 2009 12:59 pm

Have you tried setting the second instance to be < 1 rather than =0 ??

Quirky if that works, but computers are often 'floating point' math :blink:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]
[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]

[CENTER]Rules for new members[/CENTER]
[CENTER]Forum Rules[/CENTER]

[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Primasprit
Posts: 1614
Joined: Mon Jun 19, 2006 7:44 pm
Location: Germany

Sun Feb 22, 2009 1:16 pm

Hi Chris,

EvalSubUnitCount supports only the operators ">", ">=", "<", "<=". I will add the "=" operator. Sorry for the trouble. :indien:
Cheers
Norbert :cwboy:

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sun Feb 22, 2009 1:18 pm

Ah OK. I better check through my events.

Thanks, Chris

User avatar
Primasprit
Posts: 1614
Joined: Mon Jun 19, 2006 7:44 pm
Location: Germany

Sun Feb 22, 2009 1:20 pm

lodilefty wrote:Have you tried setting the second instance to be < 1 rather than =0 ??

Yes, this should work. <= 0 will work too.

Quirky if that works, but computers are often 'floating point' math :blink:
Yes, however Philippe likes integers more. Maybe because nuts are easy to count but hard to divide... :neener:

Cheers
Norbert

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sun Feb 22, 2009 2:07 pm

Maybe because nuts are easy to count but hard to divide :D

I have another weird one. I'm trying to find the most numurous group > 2
(for testing) and it keeps picking up one 2 element unit. I copied this from a similar 1812 event that seems to work.
Can anyone see a problem with this?
(Attached)

Line 941: SelectFactions, 1 Faction selected: Natives
Line 942: Started processing event: evt_nam_GBR_Smallpox4PW
Line 942: Event already referenced, current occurences 0 Max allowed: 999 <<Active>>
Line 945: Probability evaluated: Probability 100 rolled 6 True
Line 946: Select Most Numerous Group: 1000833 Ojibwa Hunters in 126 Ojibwa
Line 948: EvalSubUnitCount: Natives Selected SUs: 2 against 2 - Operator: > Result: False
Line 955: Finished processing event: evt_nam_GBR_Smallpox4PW
Attachments

[The extension xls has been deactivated and can no longer be displayed.]


User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sun Feb 22, 2009 2:12 pm

I just realised - it is picking the region with the most numerous group - but then picking a smaller stack that also exists in this region.

A bug?
Cheers, Chris

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Mon Feb 23, 2009 11:45 am

I think the last post might have been a red Herring. After some more testing it just seems to pick a random group and then looks to see if it is larger than the EvalSubUnitCount.

SelMostNumGroup just seems to select any random group - can anyone see if I have a mistake in the script?

Thanks, Chris

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Mon Feb 23, 2009 12:32 pm

Hobbes wrote:I think the last post might have been a red Herring. After some more testing it just seems to pick a random group and then looks to see if it is larger than the EvalSubUnitCount.

SelMostNumGroup just seems to select any random group - can anyone see if I have a mistake in the script?

Thanks, Chris


Try with the faction tag in column A of your rows 7 & 8

That's the only difference I see from your favorite event: "Sanitation" :blink:
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]

[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]



[CENTER]Rules for new members[/CENTER]

[CENTER]Forum Rules[/CENTER]



[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Mon Feb 23, 2009 9:34 pm

Sanitation is now Smallpox - one of the great events I have copied into my scenario :)

I put the IND tag into column A and get the same result. Weird as the sanitation event seemed to work pretty well! ;)

The log below was created after I made a huge Indian stack. The huge stack was ignored by the event - and as you can see a small 3 SU stack was selected with the Select Most Numerous Group command. (For this test I upped the EvalSubUnitCount to > 6).

Line 941: SelectFactions, 1 Faction selected: Natives
Line 942: Started processing event: evt_nam_GBR_Smallpox4PW
Line 942: Event already referenced, current occurences 0 Max allowed: 999 <<Active>>
Line 945: Probability evaluated: Probability 100 rolled 41 True
Line 946: SelectFactions, 1 Faction selected: Natives
Line 947: Select Most Numerous Group: 1000803 Ojibwa Warband in 135 Saint Clair
Line 949: EvalSubUnitCount: Natives Selected SUs: 3 against 6 - Operator: > Result: False
Line 956: Finished processing event: evt_nam_GBR_Smallpox4PW

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Tue Feb 24, 2009 8:53 pm

I just cut and pasted the sanitation event from 1812, changed the GBR to IND, removed all conditions and changed the 52 to 10 and it still doesn't work. I tested the 1812 scenario and that is fine. Very odd.

Line 958: SelectFactions, 1 Faction selected: Natives
Line 959: Started processing event: evt_nam_USA_Poor_Sanitation
Line 959: Event already referenced, current occurences 0 Max allowed: 999 <<Active>>
Line 962: SelectFactions, 1 Faction selected: Natives
Line 963: Select Most Numerous Group: 1000833 Ojibwa Hunters in 126 Ojibwa
Line 965: EvalSubUnitCount: Natives Selected SUs: 2 against 10 - Operator: >= Result: False
Line 972: Finished processing event: evt_nam_USA_Poor_Sanitation

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Tue Feb 24, 2009 10:08 pm

I just changed the faction from IND to GBR and for the British side it works fine. Could there be a bug with SelMostNumGroup and either the IND faction or the raider type - something like that?

Cheers, Chris

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Mar 13, 2009 10:24 pm

Hobbes wrote:I just changed the faction from IND to GBR and for the British side it works fine. Could there be a bug with SelMostNumGroup and either the IND faction or the raider type - something like that?

Cheers, Chris


Hi chaps, I created a scenario to test this out. It was soon obvious that the problem is not with the IND faction but with the $famRaider type as Rangers are also not considered for SelMostNumGroup. I assume this is a bug and not WAD? It is the last major problem I have for the Pontiac scenario so I hope it can be fixed :love:

If it is WAD I do not understand why. I doubt Rangers would ever be the most numerous group, the only impact is on scenarios where one faction is Indian and a lot options are lost to the scenario designer.

Cheers, Chris

User avatar
Pocus
Posts: 25662
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Sun Mar 15, 2009 8:30 am

Are you using the command with the CPCount option? Because often raiders don't cost any CP, so that would explain...
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sun Mar 15, 2009 11:03 am

Pocus wrote:Are you using the command with the CPCount option? Because often raiders don't cost any CP, so that would explain...


Aha I see. Damn then I have no way of preventing massive Indian stacks :(

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Sun Mar 15, 2009 11:18 am

Now I see that it is possible to use SelMostNumGroup with NULL rather than cpcount :bonk:

I wish I had known this a few weeks ago!
Thanks, Chris

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 5 guests