AGElint -- an AGE debugging toolkit

Post new mods and scenarios here.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

Are you realizing we are currently building a better way to create data in AGE game than in the official way? [:D]

...

I just can't wait to apply this for SVF 2.0; Development time divided by 4 to 5 at least. [:)]
In developing AGElint, that was one of my chief aims: to clean up the "small" stuff, drastically reduce the support time devoted to bug reporting/hunting/fixing/responding, thereby freeing up dev/modder time for the "big" stuff.

[:-] berto [8|]
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

Another false positive

WARNING: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Events/BalticSetup.sct, at (or before) line 224: suspicious, undocumented usage of ; as field separator

in event evt_nam_WHI_Baltarmydeploymentconditionfulfilled:

221
222 SelectRegion = $Liepaja
223
224> ChangeAssetsProd = 10;5;0;0;0;0
225
226 SelectFaction = $WHI
227 SelectRegion = $Valga

Syntax: ChangeAssetsProd = Supply|Ammo|Power|Money|WSU|Conscripts

; may be used in events as stated in the wiki
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

Another false positive

WARNING: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Events/BalticSetup.sct, at (or before) line 224: suspicious, undocumented usage of ; as field separator

in event evt_nam_WHI_Baltarmydeploymentconditionfulfilled:

221
222 SelectRegion = $Liepaja
223
224> ChangeAssetsProd = 10;5;0;0;0;0
225
226 SelectFaction = $WHI
227 SelectRegion = $Valga

Syntax: ChangeAssetsProd = Supply|Ammo|Power|Money|WSU|Conscripts

; may be used in events as stated in the wiki
Indeed.

I see at:

http://www.ageod.net/agewiki/ChangeAssetsProd

where it says:
(NB: it works also like this : 0;0;0;0;10;0 in an event file)
Again, the fix is fairly simple.

In txt.y, before:

Code: Select all

changeassetsprod: _CHANGEASSETSPROD eq int sc int sc int sc int sc int sc int {
                     txterrmsg(_WARNING, TRUE, linenorhs, "suspicious, undocumented usage of ; as field separator");
                   }
                 | _CHANGEASSETSPROD eq int vb int vb int vb int vb int vb int
                 {
                 /*                                                              
                 http://www.ageod.net/agewiki/ChangeAssetsProd                   
                 Syntax:  ChangeAssetsProd = Supply|Ammo|Power|Money|WSU|Conscripts
                 */
                 }
                 ;

And after:

Code: Select all

changeassetsprod: _CHANGEASSETSPROD eq int sc int sc int sc int sc int sc int {
                   if (filetype != FILETYPE_EVENTS)
                       txterrmsg(_WARNING, TRUE, linenorhs, "suspicious, undocumented usage of ; as field separator");
                   }
                 | _CHANGEASSETSPROD eq int vb int vb int vb int vb int vb int
                 {
                 /*
                 http://www.ageod.net/agewiki/ChangeAssetsProd
                 Syntax:  ChangeAssetsProd = Supply|Ammo|Power|Money|WSU|Conscripts
                 (NB: in an event file, it works also like this: 0;0;0;0;10;0)
                 */
                 }
                 ;

To be fixed in the next release.

Another great catch! [:)]

But why didn't I get this kind of cooperation and feedback months before? [:(] ... [:@]
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »


Investigating further (on my development system; don't try this at home, kids!):

Code: Select all

[root@telemann agewiki]# pwd
 /home/berto/games/ageod/agewiki/www.ageod.net/agewiki
 
 [root@telemann agewiki]# egrep -i "works also like this" * | awk -F= '{print $2}' | awk -F\& '{print $1}' | sort | uniq
 
 ChangeAssetsProd
 
 [root@telemann agewiki]# egrep -i "is also a valid syntax" * | awk -F= '{print $2}' | awk -F\& '{print $1}' | sort | uniq
 
 AI.SetPoolRatio
 AlterCuSubUnit
 ChangeVPCount

Looks like there might be details I missed, alternative syntaxes, also in AI.SetPoolRatio & ChangeVPCount. I will look into it.

Unix/Linux, how do I love thee? Let me count the ways... [:D]
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

ANother false positive

in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Events/RUS F4 Options Politics.sct, at (or before) line 1770: syntax error: #-# (0x2d), #-999#

in event evt_nam_DonCossack_infighting:

1767 Actions
1768 ChgFacEngagementPts = -9
1769
1770> SetEvtOccurs = evt_nam_DonCossack_infighting;MaxOccurs;-999
1771 SetEvtOccurs = evt_nam_DonCossack_infighting;CuOccurs;0
1772 GenTextMsg = opt_notify_WHI_setting_strategy;1;NULL;NULL;NULL
1773

Syntax: SetEvtOccurs = EventName; OccParam; Value


-999 is a correct value to avoid an event to fire
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

ORIGINAL: berto



But why didn't I get this kind of cooperation and feedback months before? [:(] ... [:@]

http://www.ageod-forum.com/showthread.php?p=224720#post224720

[8D]
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

ANother false positive

in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/Events/RUS F4 Options Politics.sct, at (or before) line 1770: syntax error: #-# (0x2d), #-999#

in event evt_nam_DonCossack_infighting:

1767 Actions
1768 ChgFacEngagementPts = -9
1769
1770> SetEvtOccurs = evt_nam_DonCossack_infighting;MaxOccurs;-999
1771 SetEvtOccurs = evt_nam_DonCossack_infighting;CuOccurs;0
1772 GenTextMsg = opt_notify_WHI_setting_strategy;1;NULL;NULL;NULL
1773

Syntax: SetEvtOccurs = EventName; OccParam; Value


-999 is a correct value to avoid an event to fire
A very easy fix.

In txt.y, before:

Code: Select all

setevtoccurs:   _SETEVTOCCURS eq evtnam sc occurs sc intpos
                 {
                 /*
                 http://www.ageod.net/agewiki/SetEvtOccurs
                 Syntax:  SetEvtOccurs = EventName; OccParam; Value
                 */
                 }
                 ;

And after:

Code: Select all

setevtoccurs:   _SETEVTOCCURS eq evtnam sc occurs sc int
                 {
                 /*
                 http://www.ageod.net/agewiki/SetEvtOccurs
                 Syntax:  SetEvtOccurs = EventName; OccParam; Value
                 */
                 }
                 ;

with possibly also a CHKINT() call for that last int parameter.

Will be part of the next AGElint release.
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »


An invocation of the kwddat program, and the kwd database:

Code: Select all

[root@telemann agelint]# ./kwddat SetEvtOccurs | egrep -cv 999
 1044
 [root@telemann agelint]# ./kwddat SetEvtOccurs | egrep -c 999
 11

That is, across all AGEOD games, just 11 instances of SetEvtOccurs with (-)999, and 1044 instances without.

kwd, kwddat.pl, kwddat, and so on I relied on greatly for "advice" about proper AGE command and argument usage. (The AGEWiki was another important, and more authoritative, advisor.) But informed human advice is so much better! [:)]

The kwd database, and support programs, I'll have more to say about in future.
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

not so sure for -999. I have maybe a wrong rememberance [X(]
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

Not sure if this one is a false positive

ERROR: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/GameData/RgnDecisions/6-Nep.rgd, at (or before) line 16: syntax error: #I# (0x49), #Inp_Abs_EngagementPts#

13 Duration = 4
14 Inp_Rel_Morale = 1
15 Inp_Abs_Money = 13
16> Inp_Abs_EngagementPts = 3
17 RelBaseFlatValue = 100
18 RelBaseOwnAreaCityLevel = 1
19 SpecialOutputGain_Loyalty = 36

Regional decisions excel file has a column named by this expression,so I wonder why it is marked as wrong.

For the rest, I've almost achieved my search of false positives...Not that much, in conclusion :-) And so much almost invisible bugs solved in so few time...[8D]
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »


According to:

http://www.ageod.net/agewiki/SetEvtOccurs

the SetEvtOccurs arguments are:
EventName

String; Name (alias) of the event

OccParam

String; [MaxOccurs, CuOccurs];

* MaxOccurs - Changes the allowed amount of occurences.

MaxOccurs=0: Event never fires.

MaxOccurs=999: Event fires infinite times.

* CuOccurs - Changes the counter for how often the event already has occured.

Value

Integer; [0, 999]
The AGEWiki suggests that the third parameter must be between 0 to (positive) 999 only.

More from the kwd database:

[root@telemann agelint]# for g in acw ncp pon rop rus wia; do echo $g; ./kwddat SetEvtOccurs $g | egrep -cv 999; ./kwddat SetEvtOccurs $g | egrep -c ";999"; ./kwddat SetEvtOccurs $g | egrep -c ";-999"; echo; done
acw
0
0
0

ncp
0
0
0

pon
419
8
0

rop
85
0
0

rus
511
3
0

wia
29
0
0

The first figure is no 999, the second is positive 999, the third is -999.

As you can see, there is no instance of -999.

In fact:

[root@telemann agelint]# for g in acw ncp pon rop rus wia; do echo $g; ./kwddat SetEvtOccurs $g | awk -F\; '$NF>=0' | wc -l; ./kwddat SetEvtOccurs $g | awk -F\; '$NF<0' | wc -l; echo; done
acw
0
0

ncp
0
0

pon
427
0

rop
85
0

rus
510
4

wia
29
0

The only game with negative final value is rus, with 4 instances. They are:

[root@telemann agelint]# ./kwddat SetEvtOccurs rus | awk -F\; '$NF<0'
1 SetEvtOccurs = $evt_nam_RED_PartialMobilization_AIActivate2;CuOccurs;-1
1 SetEvtOccurs = $evt_nam_RED_PartialMobilization_AIActivate3;CuOccurs;-1
1 SetEvtOccurs = $evt_nam_RED_PartialMobilization_AIActivate;CuOccurs;-1
1 SetEvtOccurs = evt_nam_RED_UralTheaterprevendcountcons;CuOccurs;0;

Hmm, actually the fourth instance is bogus; see the spurious extra line-ending semi-colon.

A complete set of kwddat SevEvtOccurs data is available here:

SetEvtOccurs.dat.zip

(That's the sort of data I hope one day to make available for common reference on the Web.)

That's all the info I have on this.

What do you think? Should it be 'int' (positive or negative) or 'intpos' for that last parameter value?
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

Let do it easy: I'm writing an event I will test soon. So we'll know if -999 work or not [;)]
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

Not sure if this one is a false positive

ERROR: in /cygdrive/c/Revolution under Siege/Revolution Under Siege/RUS/GameData/RgnDecisions/6-Nep.rgd, at (or before) line 16: syntax error: #I# (0x49), #Inp_Abs_EngagementPts#

13 Duration = 4
14 Inp_Rel_Morale = 1
15 Inp_Abs_Money = 13
16> Inp_Abs_EngagementPts = 3
17 RelBaseFlatValue = 100
18 RelBaseOwnAreaCityLevel = 1
19 SpecialOutputGain_Loyalty = 36

Regional decisions excel file has a column named by this expression,so I wonder why it is marked as wrong.
The page

http://www.ageod.net/agewiki/Engagement_Points

references only

http://www.ageod.net/agewiki/EvalEngagementPts
http://www.ageod.net/agewiki/ChgFacEngagementPts

and at the AGEWiki nowhere do I see mention of Inp_Abs_EngagementPts:

[root@telemann agewiki]# pwd
/home/berto/games/ageod/agewiki/www.ageod.net/agewiki

[root@telemann agewiki]# egrep -il Inp_Abs_EngagementPts *
[nil]

Here are all the Inp_ commands/keywords that I know of:

[root@telemann agelint]# egrep -i "^inp_" txt.l | awk '{print $1}'
Inp_Abs_CAPITAL
Inp_Abs_COAL
Inp_Abs_CONSCRIPT
Inp_Abs_Diplomat
Inp_Abs_Mfg
Inp_Abs_Money
Inp_Abs_Officer
Inp_Abs_Steel
Inp_Abs_VP
Inp_Capital
Inp_Coal
Inp_Goods{D}+
Inp_Mfg
Inp_Minerals
Inp_Money
Inp_Oil
Inp_Rel_Morale
Inp_Rel_Conscript
Inp_Steel

???

(Between the kwd database of actual usage and the AGEWiki, do you begin to see how I decided what is "true" and "legal" usage?)
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

Let do it easy: I'm writing an event I will test soon. So we'll know if -999 work or not [;)]
That was part of my original plan: When still in doubt between the kwd usage and the AGEWiki docs, I had planned to decide issues with real-game experimentation. But my initial attempts were undercut by the clumsy, cumbersome, time-draining "official" procedure: .xls DB -> .csv saved file -> CSV Splitter -> run in game -> inspect log files. Life is too short for that!

But, yes, no speculating about the number of teeth a horse has, rather "Look in the Horse's Mouth"! [:D]
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

For the rest, I've almost achieved my search of false positives...Not that much, in conclusion :-) And so much almost invisible bugs solved in so few time...[8D]
I'm relieved to know that, in your estimation, there are not so many false positives.

And to think: Across all six AGEOD AGE system games, using (imperfect) AGElint, by now I have discovered thousands of "almost invisible bugs"!

(And remember: As AGElint performs still more data checks and loses some genericness, as we drill deeper into syntactical and semantic and logical complexities, there are how many -- what, maybe XXX? Y,YYY? -- bugs still to be discovered?)
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

why the "small" stuff matters

Post by berto »


Why does the "small" stuff matter?

http://en.wikipedia.org/wiki/For_Want_o ... proverb%29

For Want of a Nail

For want of a nail the shoe was lost.
For want of a shoe the horse was lost.
For want of a horse the rider was lost.
For want of a rider the message was lost.
For want of a message the battle was lost.
For want of a battle the kingdom was lost.
And all for the want of a horseshoe nail.

Another analogy:

It's like the space agency of the Duchy of Grand Fenwick (http://en.wikipedia.org/wiki/The_mouse_that_roared) is planning a moon shot. Except in their fictional fantasy universe, 2+2 sometimes equals 4, sometimes 4.5, sometimes 3.5, and numbers in between. Their calculating devices malfunction (sticky #7 calculator key, glitchy LED display, etc.), most of the time giving right answers, but very often giving wrong ones. On the first and third Tuesday of every odd month, addition becomes subtraction. Between the hours of 9 PM and 10 PM, up becomes down. On snowy days in January, right becomes left. And so on.

Do you think they will hit their target, the moon? Or send their astronauts to Mars or deep space instead? Or crash them into the moon's surface? Or blow them up on liftoff? ...

How can you explore the moon and decide the really "big" stuff -- were did the moon come from? is there water on the moon? is the moon made of green cheese? ... [:D] -- when the basics fail you?

Nails matter. The laws of mathematics and physics matter. The "small" stuff matters.

QA matters.

Sweat the small stuff!
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: why the "small" stuff matters

Post by Chilperic »

BTW, lokk at the last RED AI stunning manuevers in my test game. Even myself I'm amazed...

The xls files for RUS have all infos about regional policies. There are almost endless parameters for them.
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

ORIGINAL: berto

ORIGINAL: Chliperic

Let do it easy: I'm writing an event I will test soon. So we'll know if -999 work or not [;)]
That was part of my original plan: When still in doubt between the kwd usage and the AGEWiki docs, I had planned to decide issues with real-game experimentation. But my initial attempts were undercut by the clumsy, cumbersome, time-draining "official" procedure: .xls DB -> .csv saved file -> CSV Splitter -> run in game -> inspect log files. Life is too short for that!

But, yes, no speculating about the number of teeth a horse has, rather "Look in the Horse's Mouth"! [:D]

Yes, I write in notepad and test immediatly. 10 minutes needed. If I had used the xls for FY, I would yet be at version 0.99 [:D]
User avatar
Chilperic
Posts: 964
Joined: Sun Mar 21, 2010 4:11 pm

RE: txt.y -- the AGElint parser

Post by Chilperic »

ORIGINAL: berto

ORIGINAL: Chliperic

For the rest, I've almost achieved my search of false positives...Not that much, in conclusion :-) And so much almost invisible bugs solved in so few time...[8D]
I'm relieved to know that, in your estimation, there are not so many false positives.

And to think: Across all six AGEOD AGE system games, using (imperfect) AGElint, by now I have discovered thousands of "almost invisible bugs"!

(And remember: As AGElint performs still more data checks and loses some genericness, as we drill deeper into syntactical and semantic and logical complexities, there are how many -- what, maybe XXX? Y,YYY? -- bugs still to be discovered?)

Certainly some more. How much? I guess from my own experience higher level bugs to be more rare as the scriptreport and player's experience point them out quickly. The worst in AGE script language, due to its verbosty and lack of full coherence, are the small errors unreproted by the official tools having great effects like wrong terrains, etc.
User avatar
berto
Posts: 21461
Joined: Wed Mar 13, 2002 1:15 am
Location: metro Chicago, Illinois, USA
Contact:

RE: txt.y -- the AGElint parser

Post by berto »

ORIGINAL: Chliperic

ORIGINAL: berto

(And remember: As AGElint performs still more data checks and loses some genericness, as we drill deeper into syntactical and semantic and logical complexities, there are how many -- what, maybe XXX? Y,YYY? -- bugs still to be discovered?)

Certainly some more. How much? I guess from my own experience higher level bugs to be more rare as the scriptreport and player's experience point them out quickly. The worst in AGE script language, due to its verbosty and lack of full coherence, are the small errors unreproted by the official tools having great effects like wrong terrains, etc.
Maybe. But how do you account for:

The Friendly Skies of Delaware etc. -- A Major WIA Weathers Bug

I was, frankly, stunned that neither devs nor beta testers nor players had detected that bug for so very long. I would think that after a bit of serious game play, surely somebody would have noticed (and reported) it.

The bug was entirely due to data file errors, of course. [8|]
Campaign Series Legion https://cslegion.com/
Campaign Series Lead Coder https://www.matrixgames.com/forums/view ... hp?f=10167
Panzer Campaigns, Panzer Battles Lead Coder https://wargameds.com
Post Reply

Return to “Mods and Scenarios”