Excruciating FOCS doubts

Creation, discussion, and balancing of game content such as techs, buildings, ship parts.

Moderators: Oberlus, Committer, Oberlus, Committer

Message
Author
User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12675
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Excruciating FOCS doubts

#16 Post by Geoff the Medio » Tue Jun 30, 2020 3:47 pm

If you script something and it doesn't appear in game, first thing to do is check the client log file for relevant errors. If I paste your script into ST_COATING.focs.txt and put it in the scripting/ship_parts/stealth directory, then start the client, the log contains:

Code: Select all

17:34:12.876545 {0x00005aa8} [error] client : reportparseerror.cpp:92 : C:/Users/Geoff/Desktop/FOSDK11/FreeOrion/default\scripting/ship_parts\Stealth\ST_COATING.focs.txt:4:18: Parse error.  Expected string here:
Part
    name = "ST_COATING_GG"
    description = "ST_COATING_GG_DESC"
    exclusions = [[ST_COATING_GG]]
                  ^
    mountableSlotTypes = Internal
    buildcost = 2 * (1 +
    (1 - (GameRule name = "RULE_SHIP_PART_BASED_UPKEEP")) * (
        (0.01 * ShipDesignsOwned empire = Source.Owner) +
        (0.01 * ShipDesignsInProduction empire = Source.Owner)) +

17:34:12.881049 {0x00005aa8} [warn] client : parse.cpp:526 : A parser failed while parsing "C:/Users/Geoff/Desktop/FOSDK11/FreeOrion/default\scripting/ship_parts\Stealth\ST_COATING.focs.txt"
It doesn't recognized [[ST_COATING_GG]] as a string, because there is no ST_COATING_GG macro defined. Changing the [[]] to "" and saving, I get

Code: Select all

17:39:57.330146 {0x0000603c} [error] client : reportparseerror.cpp:92 : C:/Users/Geoff/Desktop/FOSDK11/FreeOrion/default\scripting/ship_parts\Stealth\ST_COATING.focs.txt:5:4: Parse error.  Expected unnamed-rule here:
Part
    name = "ST_COATING_GG"
    description = "ST_COATING_GG_DESC"
    exclusions = "ST_COATING_GG"
    mountableSlotTypes = Internal
    ^
    buildcost = 2 * (1 +
    (1 - (GameRule name = "RULE_SHIP_PART_BASED_UPKEEP")) * (
        (0.01 * ShipDesignsOwned empire = Source.Owner) +
        (0.01 * ShipDesignsInProduction empire = Source.Owner)) +
    (GameRule name = "RULE_SHIP_PART_BASED_UPKEEP") * (
That's not very helpful for an error message, but I suspect it's because there's no part class or capacity scripted. Pasting in

Code: Select all

    class = Stealth
    capacity = 20
from another stealth part, I get

Code: Select all

17:42:36.764861 {0x00003d18} [error] client : reportparseerror.cpp:92 : C:/Users/Geoff/Desktop/FOSDK11/FreeOrion/default\scripting/ship_parts\Stealth\ST_COATING.focs.txt:31:39: Parse error.  Expected unnamed-rule here:
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = ContainedBy And [
                System 
                Contains Planet type = Gas_Giant
                                       ^
            ]
            accountinglabel = "GAS_GIANT_FIELD_STEALTH"
            effects = SetStealth value = Value + 20
            stackinggroup = "STEALTH_GG_STACK"
which is due to "Gas_Giant" not being a valid planet type. I searched for "Planet type =" in other .focs.txt files and found a relevant example, so correct it to "Planet type = GasGiant".

Another error complains about stackinggroup being in the wrong place, so I move it before effects =. Then another search to realize it should be before accountinglabel.

Then there are no errors in the log and it shows up in the pedia.

User avatar
LienRag
Space Kraken
Posts: 182
Joined: Fri May 17, 2019 5:03 pm

Re: Excruciating FOCS doubts

#17 Post by LienRag » Wed Jul 01, 2020 3:34 am

Thanks !
Where are the log files?
I searched for them in the snap folder and in /var/log and they're in neither (or at least I couldn't find them)...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12675
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Excruciating FOCS doubts

#18 Post by Geoff the Medio » Wed Jul 01, 2020 7:24 am

LienRag wrote:
Wed Jul 01, 2020 3:34 am
Where are the log files?
see: https://www.freeorion.org/index.php/Config.xml

FOCS parse errors are also output to stdout when launching the client.

Ophiuchus
Programmer
Posts: 1521
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Excruciating FOCS doubts

#19 Post by Ophiuchus » Wed Jul 01, 2020 1:22 pm

LienRag wrote:
Wed Jul 01, 2020 3:34 am
Thanks !
Where are the log files?
I searched for them in the snap folder and in /var/log and they're in neither (or at least I couldn't find them)...
Somewhere in the snap dir in your home directory.
Like ~/snap/freeorion or similar. Maybe ~/.snap
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Furthermore, I propse... we should default to four combat rounds instead of three ...for the good of playerkind.

Post Reply