Quantcast
Channel: forum.freeciv.org
Viewing all articles
Browse latest Browse all 354

General discussion • Re: --Warnings from Freeciv

$
0
0
I am trying to figure out how to determine (in Lua script) whether the currently running scenario has set all possible optional values for the currently running Freeciv software version in use ( to detect if new features exist which should be disabled for a scenario generated on an older version of Freeciv. )

I moved my Freeciv client rc file, ran 2.6.4 server and "/show all", getting all default values. Repeated that for 2.6.11, and there are no differences in default values between 2.6.4 and 2.6.11. Not surprising.

But, Lua script in Freeciv apparently has no way to know what other (new) features are in the currently running version of the software, so I can't even begin to disable them to ensure that the scenario behaves the same on a newer version as it does on an older version. Is there a feature in Freeciv 3 that would allow listing all possible options that could be in a Freeciv 3 scenario file? To be able to determine within a Lua script that new options exist and should be disabled for the duration of the scenario.

I gathered the "field" or var name entries from the default values list of v2.6.11:

Code:

option_names={ "aifill", "airliftingstyle", "allowtake", "alltemperate", "animals", "aqueductloss", "autoattack", "autosaves", "autotoggle", "barbarians", "borders", "citymindist", "citynames", "civilwarsize", "compress", "compresstype", "conquercost", "contactturns", "demography", "diplbulbcost", "diplchance", "diplgoldcost", "diplomacy", "disasters", "dispersion", "ec_chat", "ec_info", "ec_max_size", "ec_turns", "endspaceship", "endturn", "first_timeout", "fixedlength", "flatpoles", "foggedborders", "fogofwar", "foodbox", "freecost", "fulltradesize", "gameseed", "generator", "globalwarming", "gold", "happyborders", "homecaughtunits", "huts", "kicktime", "killcitizen", "killstack", "killunhomed", "landmass", "mapseed", "mapsize", "maxconnectionsperhost", "maxplayers", "mgr_distance", "mgr_foodneeded", "mgr_nationchance", "mgr_turninterval", "mgr_worldchance", "migration", "minplayers", "nationset", "naturalcitynames", "nettimeout", "netwait", "notradesize", "nuclearwinter", "occupychance", "onsetbarbs", "persistentready", "phasemode", "pingtime", "pingtimeout", "plrcolormode", "rapturedelay", "razechance", "restrictinfra", "revealmap", "revolen", "revolentype", "savefrequency", "savename", "savepalace", "saveturns", "sciencebox", "scorefile", "scorelog", "scoreloglevel", "separatepoles", "shieldbox", "singlepole", "size", "specials", "startcity", "startpos", "startunits", "steepness", "team_pooled_research", "teamplacement", "techlevel", "techlossforgiveness", "techlossrestore", "techlost_donor", "techlost_recv", "techpenalty", "temperature", "tilesperplayer", "timeaddenemymove", "timeout", "tinyisles", "topology", "trademindist", "trading_city", "trading_gold", "trading_tech", "traitdistribution", "turnblock", "unitwaittime", "unreachableprotects", "victories", "wetness", "xsize", "ysize" }
Then this to get the current values of those via Lua script:

Code:

for i = 1, #option_names, 1 dolog.error("%s",option_names[ i ] .. string.rep( " ", ( 21 - string.len( option_names[ i ] ) ) ) .. "\t=\t" .. server.setting.get( option_names[ i ] ) )end
BUT, I am already stumped as to how a Lua script could determine whether the currently running Freeciv client has additional, new features and parameters ( since server.setting.get( name ) relies upon the scenario already knowing the name of the feature/option ) ?

If v3 had a new feature "alienencounters" how could a Lua script know that the new feature exists on the running version of the software?

Ideally the script would be able to /show all and get the full list of optional values from the current running version.

Then the next hurdle will be whether or not the values can be disabled or otherwise changed just before gamestart.

Statistics: Posted by Molo_Parko — Sat Nov 30, 2024 8:17 pm



Viewing all articles
Browse latest Browse all 354

Trending Articles