Moreover, it forces player to remember where the tanker is. I like it more the way it is now.Geoff the Medio wrote: ↑Sun Nov 15, 2020 12:11 pm This sounds a bit awkward to use in practice, as it would seem to require the initial scout to leave the system immediately to avoid triggering the refuel effect.
Excruciating FOCS doubts
Moderators: Oberlus, Committer
Re: Excruciating FOCS doubts
Re: Excruciating FOCS doubts
Those are solvable I think.Oberlus wrote: ↑Sun Nov 15, 2020 1:24 pmMoreover, it forces player to remember where the tanker is. I like it more the way it is now.Geoff the Medio wrote: ↑Sun Nov 15, 2020 12:11 pm This sounds a bit awkward to use in practice, as it would seem to require the initial scout to leave the system immediately to avoid triggering the refuel effect.
Activate the effect if there are ships that arrived two turns before. One turn before activation there could be a sitrep "In next turn tankers at system refuel ships".
For making the effect one could create a field around that system as soon as tankers are discovered.
Note to the current implementation: using the extra special is the workaround so the sitrep can refer to the affected ships. If sitreps supported multiple ships, the special would not be necessary
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: Excruciating FOCS doubts
Can I use "Statistic" or something else to query the planetary focus within an effect?
Something like
Or should I make two effects, one for planets with the focus and one with planets without it?
Something like
Code: Select all
value = Value + (Statistic Condition LocalCandidate.focus = "FOCUS_PROTECTION") + 1
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
Yes, with an arbitrary condition, likeOberlus wrote: ↑Sat Dec 12, 2020 3:42 pm Can I use "Statistic" or something else to query the planetary focus within an effect?
Something likeCode: Select all
value = Value + (Statistic Condition LocalCandidate.focus = "FOCUS_PROTECTION") + 1
https://github.com/freeorion/freeorion/ ... cs.txt#L24
Code: Select all
effects = SetMaxCapacity partname = "FT_BAY_1" value = (
3 +
Statistic If condition = And [ Target OwnerHasTech name = "SHP_FIGHTERS_2" ] +
Statistic If condition = And [ Target OwnerHasTech name = "SHP_FIGHTERS_3" ] +
Statistic If condition = And [ Target OwnerHasTech name = "SHP_FIGHTERS_4" ]
)
Would be arguably simpler.Or should I make two effects, one for planets with the focus and one with planets without it?
Re: Excruciating FOCS doubts
How to refer to the Capital of an empire within an effect whose Source is a planet?
For example, in Centralization (policy) we have this effect (edited):
The JumpsBetween gets as parameters Source.ID and Target.ID.
Source.ID is the ID of the capital planet (I assume Source is the policy and asking an ID to a policy returns the planet ID of the capital empire, but IDK).
Target.ID is the ID of the planet being processed in the effect (from the planets in the Scope).
If I move this effect based on JumpsBetween to a species effect (those in default/scripting/species/common/*.macros), such as in influence.macros, it will not work:
The first part, based on Statistic Count, does work (as it did work before changing anything), but the second part, distance-based upkeep, is broken: JumpsBetween object = Source.ID object = Target.ID returns 0.
Source is the... species? And so Source.ID does not give anything useful to JumpsBetween?
I solved this problem moving the EffectsGroup from species/common/influence.macros to a tech unlocked at start, which also makes sense since it is an effect that only applies to empires (and not to unowned planets) and all empires have that tech unlocked at start. However, I wonder if it could be done within the species/common/influence.macros file.
For example, in Centralization (policy) we have this effect (edited):
Code: Select all
EffectsGroup
scope = And [
Planet
OwnedBy empire = Source.Owner
Population low = 0.001
ResourceSupplyConnected empire = LocalCandidate.Owner condition = And [
Planet
OwnedBy empire = Source.Owner
Capital
]
Not Capital
]
effects = SetTargetInfluence value = Value +
(NamedReal name = "PLC_CENTRALIZATION_TARGET_INFLUENCE_PERJUMP" value = -0.2)
* JumpsBetween object = Source.ID object = Target.ID
Source.ID is the ID of the capital planet (I assume Source is the policy and asking an ID to a policy returns the planet ID of the capital empire, but IDK).
Target.ID is the ID of the planet being processed in the effect (from the planets in the Scope).
If I move this effect based on JumpsBetween to a species effect (those in default/scripting/species/common/*.macros), such as in influence.macros, it will not work:
Code: Select all
EffectsGroup // colonies consume influence, proportional to how many planets the empire controls
scope = Source
activation = And [
Planet
Not Unowned
Not Capital
]
stackinggroup = "IMPERIAL_PALACE_MANY_PLANETS_INFLUENCE_PENALTY"
accountinglabel = "COLONY_ADMIN_COSTS_LABEL"
effects = SetTargetInfluence value = Value - (NamedReal name = "OLONY_ADMIN_COSTS_PER_PLANET" value = 0.2) *
Statistic Count condition = And [
Planet
OwnedBy empire = Source.Owner
] - (NamedReal name = "PLC_CENTRALIZATION_TARGET_INFLUENCE_PERJUMP" value = -0.2)
* JumpsBetween object = Source.ID object = Target.ID
Source is the... species? And so Source.ID does not give anything useful to JumpsBetween?
I solved this problem moving the EffectsGroup from species/common/influence.macros to a tech unlocked at start, which also makes sense since it is an effect that only applies to empires (and not to unowned planets) and all empires have that tech unlocked at start. However, I wonder if it could be done within the species/common/influence.macros file.
Re: Excruciating FOCS doubts
No, source for a species is a ship or planet with the species. So in this case it is a planet with the current species (and it is not a capital).Oberlus wrote: ↑Tue Feb 02, 2021 5:49 pmThe first part, based on Statistic Count, does work (as it did work before changing anything), but the second part, distance-based upkeep, is broken: JumpsBetween object = Source.ID object = Target.ID returns 0.
Source is the... species? And so Source.ID does not give anything useful to JumpsBetween?
And you chose your targets to be the source. So distance is always zero.
I guess the source for policies is either the capital or more likely the empire root.
It should work in a species file if you make the source the capital via activation condition - you want to apply an effect to the non-capital so it has to be in scope/the target.
Note that using a tech is probably more appropiate.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
To clarify, the script has
Code: Select all
scope = Source
Then later it has
Code: Select all
JumpsBetween object = Source.ID object = Target.ID
Re: Excruciating FOCS doubts
Is there a way to query if the species in a planet has this or that trait?
To clarify, could I query in a tech effect (e.g. robotic production) if the species has BAD_INDUSTRY, GOOD_INDUSTRY, etc., or better, use something like Source.Species.ResearchTrait that would return the multiplier (0.75, 1.5...)?
To clarify, could I query in a tech effect (e.g. robotic production) if the species has BAD_INDUSTRY, GOOD_INDUSTRY, etc., or better, use something like Source.Species.ResearchTrait that would return the multiplier (0.75, 1.5...)?
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
"trait" is not a FOCS thing. But tags are, and a planet has the tags of its species, so you can query if a planet has a tag with the HasTag condition, in order to find if the planet's species has that tag specified in its script.
"ResearchTrait" isn't a think known to FOCS or the C++ code.To clarify, could I query in a tech effect (e.g. robotic production) if the species has BAD_INDUSTRY, GOOD_INDUSTRY, etc., or better, use something like Source.Species.ResearchTrait that would return the multiplier (0.75, 1.5...)?
Re: Excruciating FOCS doubts
Understood. Thank you.
Re: Excruciating FOCS doubts
Is there a FOCS command to adopt (or de-adopt) a policy?
It would be to get policies adopted from start (before game starts), because I am having a hard time coping with the idea that no government-type policy equals some type of government (I'd like to allow empire to start with different types of government) and because I'd rather have the influence upkeep effects from policies coded in their policy files instead of in some root tech filled with if conditions to consider the different upkeep equations and modifiers depending on adopted policies.
Related to this, could it be possible to disallow not having any government-type policy? So that each player must have a government policy adopted at all time. That would make implementation simpler IMO.
Can planetary focus type be forbidden under certain conditions? E.g. a policy is (not) adopted, the species is (not) the same as capital.
This would be to forbid influence focus at non-capital species colonies when government is Empire/Dominion.
It would be to get policies adopted from start (before game starts), because I am having a hard time coping with the idea that no government-type policy equals some type of government (I'd like to allow empire to start with different types of government) and because I'd rather have the influence upkeep effects from policies coded in their policy files instead of in some root tech filled with if conditions to consider the different upkeep equations and modifiers depending on adopted policies.
Related to this, could it be possible to disallow not having any government-type policy? So that each player must have a government policy adopted at all time. That would make implementation simpler IMO.
Can planetary focus type be forbidden under certain conditions? E.g. a policy is (not) adopted, the species is (not) the same as capital.
This would be to forbid influence focus at non-capital species colonies when government is Empire/Dominion.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
No. Adopting or de-adopting a policy is/was thought of as an empire order, like production queue management or fleet movement. There are use cases, though, so it could be added.
That sounds like a problematic complication if enforce as a hard game rule. Doing it with an effect would seem more appropriate. But there's also no "government-type policy" concept in the game mechanics... The policies are all part of / aspects of the government of the empire.Related to this, could it be possible to disallow not having any government-type policy? So that each player must have a government policy adopted at all time. That would make implementation simpler IMO.
Focus definitions have a location condition, which the planet where they are to be set must meet. The planet's owner's policies can be checked in that with an EmpireHasAdoptedPolicy condition.Can planetary focus type be forbidden under certain conditions?
Re: Excruciating FOCS doubts
I'm trying to launch a test game with the latest version and some FOCS files of mine, and I get a LOT of parse errors, some of them due to the new rules about case-sensitiveness (which are tedious to solve but understandable - though apparently camel case is not supported, which makes the code less readable), some of them due to the evolution of the FOCS format (apparently there are no more "preferred foci" for Species due to the likes/dislikes novelty) and some that I do not understand at all.
Most if not all of the FOCS mistakes I have made have been corrected already since I played with the same files in a test game on Master, so there can be formatting mistakes due to the new format but normally there shouldn't be real mistakes left.
I tried to test the Whumsoon specie as a non-colonizable one in order to be able to advocate for its inclusion in the game, and here's the error I get :
I had similar errors in previous game and it took me some time to understand that they were from macros called by the file mentioned in the parse error, but there I cannot find why the relevant macro code is faulty since the only macro I touched is the focus.macros and I didn't erase it, I just added the modified version of Send and Receive stargate foci in order to use my Wormholes entrances and exits.
Whumsoon calls the [[NATIVE_PLANETARY_DEFENSE]] but I didn't touch this file ?
planet_defense.macros has the code
but why doesn't it parse ?
Also when I launch the game I have a quite reduced screen with a strange screen in the middle :
Last time I had that it was because in the string table I had entries spanning more than one line without ''' before and after them, but I checked many times and I don't think I have this problem in my string table now.
Could there be another reason ?
Most if not all of the FOCS mistakes I have made have been corrected already since I played with the same files in a test game on Master, so there can be formatting mistakes due to the new format but normally there shouldn't be real mistakes left.
I tried to test the Whumsoon specie as a non-colonizable one in order to be able to advocate for its inclusion in the game, and here's the error I get :
Code: Select all
scripting/default/scripting/species/SP_WHUMSOOM.focs.txt:1105:54: Parse error. Expected real number expression here:
activation = And [
Planet
Unowned
]
accountinglabel = "NATIVE_PLANETARY_DEFENSE_LABEL"
effects = SetMaxDefense value = Value + ( @1@ )
^
EffectsGroup
scope = Source
activation = And [
Planet
Whumsoon calls the [[NATIVE_PLANETARY_DEFENSE]] but I didn't touch this file ?
planet_defense.macros has the code
Code: Select all
NATIVE_PLANETARY_DEFENSE
'''EffectsGroup
scope = Source
activation = And [
Planet
Unowned
]
accountinglabel = "NATIVE_PLANETARY_DEFENSE_LABEL"
effects = SetMaxDefense value = Value + ( @1@ )
'''
Also when I launch the game I have a quite reduced screen with a strange screen in the middle :
Last time I had that it was because in the string table I had entries spanning more than one line without ''' before and after them, but I checked many times and I don't think I have this problem in my string table now.
Could there be another reason ?
- Attachments
-
- FO sreecn.png (884.78 KiB) Viewed 1058 times
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Excruciating FOCS doubts
The script in SP_WHUMSOOM.focs.txt that I got from your thread about them uses [[NATIVE_PLANETARY_DEFENSE]] without passing a parameter to the macro, which is required.
The macro is here: https://github.com/freeorion/freeorion/ ... .macros#L2
I located that by using the Find in Files feature of Notepad++ (similar to other text editors), pointed to the default/scripting directory and filtered to search: *.focs.txt;*.macros;*.txt
Your menu screen is missing the load and continue buttons because it doesn't think there are any save files it can read. Probably something in the format changed to make them unloadable. Does they reappear if you start a game and play a few turns so that some autosaves are generated?
The [[MAP_BTN_PEDIA]] label looks like a stringtable formatting error, but it's hard to tell without a log or stringtable file to inspect.
The macro is here: https://github.com/freeorion/freeorion/ ... .macros#L2
I located that by using the Find in Files feature of Notepad++ (similar to other text editors), pointed to the default/scripting directory and filtered to search: *.focs.txt;*.macros;*.txt
Your menu screen is missing the load and continue buttons because it doesn't think there are any save files it can read. Probably something in the format changed to make them unloadable. Does they reappear if you start a game and play a few turns so that some autosaves are generated?
The [[MAP_BTN_PEDIA]] label looks like a stringtable formatting error, but it's hard to tell without a log or stringtable file to inspect.
Re: Excruciating FOCS doubts
Thanks.
I should have checked the stringtable once more...
There was a "return" not easy to see at the end of one line.
I don't understand why it removed the "exit" button though ?
I've got a new parse error for the Whumsoom that I really don't understand :
I checked the code for the Sly and it's exactly the same syntax ?
(if it's relevant, here are the lines before to correct the faulty parameter-less call to the macro :
I counted many times the number of opening and closing brackets [] and I really believe that they're the right number)
I should have checked the stringtable once more...
There was a "return" not easy to see at the end of one line.
I don't understand why it removed the "exit" button though ?
I've got a new parse error for the Whumsoom that I really don't understand :
Code: Select all
Expected PlanetType here:
type = Tundra environment = Uninhabitable
type = Desert environment = Uninhabitable
type = Terran environment = Uninhabitable
type = Ocean environment = Uninhabitable
type = Asteroids environment = Good
type = Gasgiant environment = Uninhabitable
^
]
(if it's relevant, here are the lines before to correct the faulty parameter-less call to the macro :
Code: Select all
[[NATIVE_PLANETARY_DEFENSE(5*[[PLANET_DEFENSE_FACTOR]])]]
[[NATIVE_PLANETARY_SHIELDS(5*[[PLANET_SHIELD_FACTOR]])]]