nightingale Posted December 11, 2015 Author Share Posted December 11, 2015 Okay, I've finally implemented an oft-requested feature (@linuxgurugamer requested it most recently, although I'm pretty sure @inigma and possibly @severedsolo have also asked in the past): magically expanding nodes! Or as I like to call them - iterators! Rather than trying to explain, I'll go straight into an example: PARAMETER { type = ReachState ITERATOR { type = Biome biome = @/biomes } } What this will do is it will go through each item in the @/biomes list and create a parameter for it. For each parameter created, the biome is stored in the @biome variable, and can be accessed as normal through expressions. Of course, this can be used with any List<> type - common uses will be making child parameters for all moons of a target body, repeating parameters for lists of Kerbals/passengers. Look for this change in the 1.9.1 release. Contract Configurator - one step closer to Turing completeness. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 11, 2015 Share Posted December 11, 2015 8 hours ago, nightingale said: Okay, I've finally implemented an oft-requested feature (@linuxgurugamer requested it most recently, although I'm pretty sure @inigma and possibly @severedsolo have also asked in the past): magically expanding nodes! Or as I like to call them - iterators! Rather than trying to explain, I'll go straight into an example: PARAMETER { type = ReachState ITERATOR { type = Biome biome = @/biomes } } What this will do is it will go through each item in the @/biomes list and create a parameter for it. For each parameter created, the biome is stored in the @biome variable, and can be accessed as normal through expressions. Of course, this can be used with any List<> type - common uses will be making child parameters for all moons of a target body, repeating parameters for lists of Kerbals/passengers. Look for this change in the 1.9.1 release. Contract Configurator - one step closer to Turing completeness. Could you give additional examples that could be wikified? I'm not sure I'm wrapping my head around this. Is the iterator creating lists, or using lists to create parameters? Can you give me a SpawnKerbal example? Quote Link to comment Share on other sites More sharing options...
inigma Posted December 11, 2015 Share Posted December 11, 2015 Also, the wiki says Data nodes may existing within CONTRACT_TYPE and CONTRACT_GROUP nodes. Can they not also be in PARAMETER nodes? I have a barnstorming contract for the R&D Center to barnstorm the pedestrian bridge and optionally the tunnel for additional reward. I want barnstorming the tunnel to be an optional and reward bonusRep = 40 which is added to the rewardReputation = 30 attribute if completed. How would I do this? Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 11, 2015 Author Share Posted December 11, 2015 3 hours ago, inigma said: Could you give additional examples that could be wikified? I'm not sure I'm wrapping my head around this. Is the iterator creating lists, or using lists to create parameters? Can you give me a SpawnKerbal example? There's another example on the wiki already. Here's a SpawnKerbal one from GAP: DATA { type = List<Kerbal> kerbals = [ NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal() ].Random(@numPassengers) } PARAMETER { name = HasPassengers type = HasPassengers title = Passenger: @kerbal hideChildren = true ITERATOR { type = Kerbal kerbal = @/kerbals } } Which replaces all this. 32 minutes ago, inigma said: Also, the wiki says Data nodes may existing within CONTRACT_TYPE and CONTRACT_GROUP nodes. Can they not also be in PARAMETER nodes? They cannot. 32 minutes ago, inigma said: I have a barnstorming contract for the R&D Center to barnstorm the pedestrian bridge and optionally the tunnel for additional reward. I want barnstorming the tunnel to be an optional and reward bonusRep = 40 which is added to the rewardReputation = 30 attribute if completed. How would I do this? Have a parameter with optional=true and rewardReputation=40. See Parameters for more info. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 11, 2015 Share Posted December 11, 2015 Do CC configs take a block /* */ comment option or is it just single line // ? Quote Link to comment Share on other sites More sharing options...
Kerbas_ad_astra Posted December 11, 2015 Share Posted December 11, 2015 Just single-line comments (the entire KSP config system is like this). Quote Link to comment Share on other sites More sharing options...
inigma Posted December 12, 2015 Share Posted December 12, 2015 (edited) The following code is giving me an error: Unexpected node "Module" PARAMETER { name = Not type = Not title = release Solid Rocket Boosters PARAMETER { name = PartValidation type = PartValidation hideChildren = true hidden = true MODULE { name = ModuleEngines EngineType = SolidBooster } } } edit: still can't figure it out. even with FILTER and MODULE and NONE. All I'm trying to do is check when I've released any type of solid boosters on my shuttle. any ideas? edit2: this worked! PARAMETER { name = PartValidation type = PartValidation FILTER { partModule = ModuleEngines } NONE { EngineType = SolidBooster } } Edited December 12, 2015 by inigma Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 12, 2015 Share Posted December 12, 2015 (edited) Ok figured it out. There is something wrong with WaypointGenerators targetBody parsing. BEHAVIOUR { name = WaypointGenerator type = WaypointGenerator WAYPOINT { name = Base Landing Spot targetBody = @/targetBody1 icon = balloon altitude = 0.0 latitude = @/vesselLocation.Latitude() longitude = @/vesselLocation.Longitude() } } This will cause it to complain that "the Mun" is not a valid body (even though it parses absolutely fine elsewhere, it's all drawn from a DATA node. Edited December 12, 2015 by severedsolo Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 12, 2015 Author Share Posted December 12, 2015 8 hours ago, severedsolo said: Ok figured it out. There is something wrong with WaypointGenerators targetBody parsing. <snip> This will cause it to complain that "the Mun" is not a valid body (even though it parses absolutely fine elsewhere, it's all drawn from a DATA node. Should be the same as anywhere else, no idea what would make that one special. Raised [#396]. Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 12, 2015 Author Share Posted December 12, 2015 I've gotten a few reports about the contracts disabled by contract packs starting to show up again, but it's not something I've reproduced yet. If anybody is having this issue, I'd really love to get some more details into [#397]. The questions I would hopefully like answered: Was it disabled at some point, but then started showing up? Or for the save you're on does it appear to always have been not working? In the Contract Configurator settings window (button in space centre), does the particular contract type show as disabled? If you click it, does that "fix" the issue? If you go to the main menu and back, does it stay clicked? Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 12, 2015 Share Posted December 12, 2015 Can confirm for 2) that disabling through the in game menu fixes it (forever). Can also confirm for 1) that a) If you mouse over the in game entry, it will say "disabled by <whatever>" - In my case I can't confirm that I wasn't affected by the last time this cropped up because I haven't started a new game since then (which is why I never reported it) Quote Link to comment Share on other sites More sharing options...
inigma Posted December 15, 2015 Share Posted December 15, 2015 I'm in the final QA stage of releasing GAP 0.3 dependent on CC 1.9.1. CC 1.9.1 seems stable now. Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 15, 2015 Author Share Posted December 15, 2015 Stable - but there's two issues remaining to be worked before I release. Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 16, 2015 Author Share Posted December 16, 2015 Contract Configurator 1.9.1 is out! Lots of bug fixes and a couple neat new features. Including automatic Draft Twitch Viewers integration. If you have Draft Twitch Viewers installed and in use, any Contract Configurator contract that generates Kerbals will use Draft Twitch Viewers to get Kerbal names. Download now! Contract Configurator 1.9.1 Draft Twitch Viewers integration - when creating new random Kerbals for contracts will get names from Draft Twitch Viewers (thanks IRNifty for assisting on this one). ITERATOR nodes for automatically duplicating PARAMETER nodes for every value in a list. AutoAccept contracts now more likely get generated immediately when available. Added Biome.PrimarySituation() method. Added CelestialBody.SCANsatCoverage() method. Allow multiple parameter identifiers in WaypointGenerator (for blocks with more than one waypoint). Support for clustered waypoints in WaypoingGenerator. ReachState supports multiple vessel situations. Fixed VisitWaypoint support for contracts with multiple WaypointGenerator behaviours (thanks linuxgurugamer). Fixed further issues requiring rouding when checking for a zero speed (thanks Aelfhe1m). Fixed issue where ContractMultiplier() wasn't calculated correctly. Fixed issue where failureFunds was not being set when the contract had an advance. Fixed issue with load passenger dialog disappearing too early (thanks inigma). Fixed parsing of CelestialBody in WaypointGenerator (thanks severedsolo). Fixed some parser issues for exceptional cases (thanks inigma). Fixed major issues with CopyCraftFile behaviour (thanks inigma). Fixed default Kerbal type back to tourist in SpawnPassengers (thanks CovertJaguar). Minor bug fixes. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 16, 2015 Share Posted December 16, 2015 Thanks for the update nightingale! I'm already off working on GAP 0.4. I have a question: I want to create and reference a random list of ship names for Coast Guard distress contracts. To make it uniquely Kerbal, I was thinking of creating a list of ships based on the kerbal name generator, except lopping off the Kerman part of the name. So something like this: S.S. Billy-bobfreid S.S. Girron S.S. Teke etc. Any ideas on how best to accomplish this? Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 16, 2015 Share Posted December 16, 2015 @nightingale Just installed the release of 1.9.1, thanks I was in the Admin Center, and saw my unmanned contracts, but the flag was all white. I checked, and the agent was: agent = Space Penguins, Inc And in the agency file: GameData\ContractPacks\Spacetux\SharedAssets\Agencies\spacetux.cfg name = Space Penguins, Inc // Logo URL should be the full path to the image file for the logo (256x160) logoURL = spacetux/Agencies/spacetux // Logo URL is the full path to the scaled down image for thumbnails (64x40) logoScaledURL = spacetux/Agencies/spacetux_sm I also verified that the flag was there: GameData\spacetux\Agencies I'm not sure if this is a contact error or a CC error, how can I check, and what should I be looking for? Thx Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 16, 2015 Author Share Posted December 16, 2015 (edited) 8 hours ago, inigma said: Thanks for the update nightingale! I'm already off working on GAP 0.4. I have a question: I want to create and reference a random list of ship names for Coast Guard distress contracts. To make it uniquely Kerbal, I was thinking of creating a list of ships based on the kerbal name generator, except lopping off the Kerman part of the name. So something like this: S.S. Billy-bobfreid S.S. Girron S.S. Teke etc. Any ideas on how best to accomplish this? Something like this (untested): DATA { type = string shipName = "S.S. " + RandomKerbalName(Random()).FirstWord() } 2 hours ago, linuxgurugamer said: @nightingale Just installed the release of 1.9.1, thanks I was in the Admin Center, and saw my unmanned contracts, but the flag was all white. I checked, and the agent was: agent = Space Penguins, Inc And in the agency file: GameData\ContractPacks\Spacetux\SharedAssets\Agencies\spacetux.cfg name = Space Penguins, Inc // Logo URL should be the full path to the image file for the logo (256x160) logoURL = spacetux/Agencies/spacetux // Logo URL is the full path to the scaled down image for thumbnails (64x40) logoScaledURL = spacetux/Agencies/spacetux_sm I also verified that the flag was there: GameData\spacetux\Agencies I'm not sure if this is a contact error or a CC error, how can I check, and what should I be looking for? Thx That is not likely to be a Contract Configurator issue - the white box happens when KSP was unable to load/find the texture. Look for any [EXC] (exception) or [ERR] (error) blocks in the KSP.log - likely you'll see something in the agency loading section. If I had to guess I'd say you're missing the ContractPacks/ part in your logo URLs. EDIT: Also, case matter on Linux, so that could also be the issue. Edited December 16, 2015 by nightingale Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 16, 2015 Share Posted December 16, 2015 1 hour ago, nightingale said: Something like this (untested): DATA { type = string shipName = "S.S. " + RandomKerbalName(Random()).FirstWord() } That is not likely to be a Contract Configurator issue - the white box happens when KSP was unable to load/find the texture. Look for any [EXC] (exception) or [ERR] (error) blocks in the KSP.log - likely you'll see something in the agency loading section. If I had to guess I'd say you're missing the ContractPacks/ part in your logo URLs. EDIT: Also, case matter on Linux, so that could also be the issue. ok, thanks. BTW, running on Windows, but am (obviously) aware of the case issue :-) Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 16, 2015 Share Posted December 16, 2015 (edited) 3 hours ago, linuxgurugamer said: ok, thanks. BTW, running on Windows, but am (obviously) aware of the case issue :-) well, I'm referencing the GameData\spacetux\Agencies\spacetux.png and GameData\spacetux\Agencies\spacetux_sm.png. I know there is also a SharedAssets in the ContractPack, is that where it has to be? Edit: Oh, I think that's the problem, I found an error : ContractConfigurator.ContractConfigurator: Couldn't load CONTRACT_GROUP 'SpaceTuxGroup' due to a duplicate name testing now after deleting the conflict Edited December 16, 2015 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
Kerbas_ad_astra Posted December 16, 2015 Share Posted December 16, 2015 Hey nightingale, I've found a brittle point in Contract Configurator. My AntennaRange Relays contract pack includes some PartValidation PARAMETERs to require (one of) various dishes to be present on a satellite to qualify. The contracts use the stock three antennas by default, but I've got some Module Manager patches that add some more parts when various mods are installed. I had accepted a contract that included a mod antenna PartValidation check, and just recently removed that part (among others, while trimming my mod load). When I started KSP back up, Contract Configurator was not happy about having a contract that called for a nonexistent part: Exception occured while loading contract parameter 'PartValidation' in contract 'AntennaRangeRelayMoon': System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: 'FixedDish01' is not a valid Part. at ContractConfigurator.ConfigNodeUtil.ParsePartValue (System.String partName) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[AvailablePart] (System.String key, System.String stringValue, Boolean allowExpression) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfigNodeUtil.ParseValue[List`1] (.ConfigNode configNode, System.String key, Boolean allowExpression) [0x00000] in <filename unknown>:0 I can certainly fix this on my own install (tinker in the save file to remove the offending parameter), and it's "my fault" that it's in this state, but here it is. Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 16, 2015 Share Posted December 16, 2015 The problem turned out to be an error in the RoverMissions.cfg file (which I'm testing), and it appears to be a CC bug. I'll provide the cfg and the log here, along with the error: log file: https://www.dropbox.com/s/8f7pr6tytaklw9q/output_log.rovererror?dl=0 RoverMissions.cfg: https://www.dropbox.com/s/46osmqtic1gbo7i/RoverMissions.cfg?dl=0 cfg line error seems to be on: title = @/k1 would like you to go investigate the Interesting place Data node k1-k5 are defined in: DATA { type = string k1 = RandomKerbalName(Male) k2 = RandomKerbalName(Female) k3 = RandomKerbalName(Male) k4 = RandomKerbalName(Female) k5 = RandomKerbalName(Female) } Error: ArgumentException: Unexpected value: would at ContractConfigurator.ExpressionParser.ExpressionParser`1[System.String].ParseStatement[String] (System.String lval) [0x00000] in <filename unknown>:0 Rethrow as Exception: Error parsing statement. Error occurred near '*': @/k1 would like you to go investigate the Interesting place .....* <-- HERE at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[String] (System.String key, System.String stringValue, Boolean allowExpression) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfigNodeUtil.ParseValue[String] (.ConfigNode configNode, System.String key, Boolean allowExpression) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfigNodeUtil.ParseValue[String] (.ConfigNode configNode, System.String key, System.Action`1 setter, IContractConfiguratorFactory obj, System.String defaultValue, System.Func`2 validation) [0x00000] in <filename unknown>:0 UnityEngine.Debug:Internal_LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) ContractConfigurator.LoggingUtil:LogException(Exception) ContractConfigurator.ConfigNodeUtil:ParseValue(ConfigNode, String, Action`1, IContractConfiguratorFactory, String, Func`2) ContractConfigurator.ConfigNodeUtil:ParseValue(ConfigNode, String, Action`1, IContractConfiguratorFactory, String) ContractConfigurator.ParameterFactory:Load(ConfigNode) ContractConfigurator.VisitWaypointFactory:Load(ConfigNode) ContractConfigurator.ParameterFactory:GenerateParameterFactory(ConfigNode, ContractType, ParameterFactory&, ParameterFactory) ContractConfigurator.ParameterFactory:GenerateParameterFactory(ConfigNode, ContractType, ParameterFactory&, ParameterFactory) ContractConfigurator.ParameterFactory:GenerateParameterFactory(ConfigNode, ContractType, ParameterFactory&, ParameterFactory) ContractConfigurator.ContractType:Load(ConfigNode) ContractConfigurator.<LoadContractConfig>d__1e:MoveNext() ContractConfigurator.ContractConfigurator:Update() Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 16, 2015 Author Share Posted December 16, 2015 10 minutes ago, Kerbas_ad_astra said: Hey nightingale, I've found a brittle point in Contract Configurator. My AntennaRange Relays contract pack includes some PartValidation PARAMETERs to require (one of) various dishes to be present on a satellite to qualify. The contracts use the stock three antennas by default, but I've got some Module Manager patches that add some more parts when various mods are installed. I had accepted a contract that included a mod antenna PartValidation check, and just recently removed that part (among others, while trimming my mod load). When I started KSP back up, Contract Configurator was not happy about having a contract that called for a nonexistent part: <snip> I can certainly fix this on my own install (tinker in the save file to remove the offending parameter), and it's "my fault" that it's in this state, but here it is. #404'd I'll have to give it some thought. Ideally I'd like it to be smart enough to just silently drop those contracts, but in general those pop-ups are there so when stuff goes pear-shaped there's the possibility to recover. Out of curiosity, what other side effects did you see from removing the parts? If the rest of KSP is pretty graceful about it, then I definitely need to do something. 23 minutes ago, linuxgurugamer said: well, I'm referencing the GameData\spacetux\Agencies\spacetux.png and GameData\spacetux\Agencies\spacetux_sm.png. I know there is also a SharedAssets in the ContractPack, is that where it has to be? Edit: Oh, I think that's the problem, I found an error : ContractConfigurator.ContractConfigurator: Couldn't load CONTRACT_GROUP 'SpaceTuxGroup' due to a duplicate name testing now after deleting the conflict It can be whereever you want - I just didn't expect that you had stuff in ContractPacks/spacetux/ and spacetux/ Quote Link to comment Share on other sites More sharing options...
linuxgurugamer Posted December 16, 2015 Share Posted December 16, 2015 (edited) Ok, so the missing flags is a different problem, which I've solved, it's related to some testing files. Thanks Edited December 16, 2015 by linuxgurugamer Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 16, 2015 Share Posted December 16, 2015 10 minutes ago, linuxgurugamer said: cfg line error seems to be on: title = @/k1 would like you to go investigate the Interesting place CC does not like it if you start a string with an expression. If you reword it a little it will probably work. Quote Link to comment Share on other sites More sharing options...
Kerbas_ad_astra Posted December 16, 2015 Share Posted December 16, 2015 17 minutes ago, nightingale said: #404'd I'll have to give it some thought. Ideally I'd like it to be smart enough to just silently drop those contracts, but in general those pop-ups are there so when stuff goes pear-shaped there's the possibility to recover. Out of curiosity, what other side effects did you see from removing the parts? If the rest of KSP is pretty graceful about it, then I definitely need to do something. Any ships that use removed parts get eaten on first load, and cannot be loaded in the VAB. If the part in question is a cockpit that is being used as the ship of a stranded Kerbal, that contract fails. Honestly, you're already being more graceful than stock with that popup! I had thought that the parameter could be silently dropped, but that only works because my contracts are a one-of-several kind of setup -- it wouldn't work very well if somebody removes a part that is the only way to complete a contract. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.