inigma Posted December 3, 2015 Share Posted December 3, 2015 (edited) 16 minutes ago, nightingale said: No, as None will actually cause a failure if the child conditions completes. But I just doubled checked, and you don't need the Any - Not can have multiple child parameters, and will not complete until all child parameters are incomplete. If None is set to disableOnStateChange = false and a kerbal is loaded in HasCrew, None will fail. But if kerbal is later unloaded will None revert to pass? And if so, does None act like Not but not switch the HasCrew && to || like Not does? If so can I then just have one HasCrew param with multiple kerbals when using None set to disableOnStateChange = false? I guess I'm not understanding the difference between Not and None and looking for the cleanest means to code for a multi passenger unload check. Edited December 3, 2015 by inigma Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 3, 2015 Author Share Posted December 3, 2015 29 minutes ago, inigma said: If None is set to disableOnStateChange = false and a kerbal is loaded in HasCrew, None will fail. But if kerbal is later unloaded will None revert to pass? And if so, does None act like Not but not switch the HasCrew && to || like Not does? If so can I then just have one HasCrew param with multiple kerbals when using None set to disableOnStateChange = false? I guess I'm not understanding the difference between Not and None and looking for the cleanest means to code for a multi passenger unload check. None will fail the contract if its conditions are unmet (whereas Not just goes incomplete). So it probably should've been named Never instead or something. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 3, 2015 Share Posted December 3, 2015 Oh fail the contract. Not just fail the parameter. Gotcha. Ok this one the wiki just says fail. I double checked this time. how can I contribute to the wiki? Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 3, 2015 Author Share Posted December 3, 2015 13 minutes ago, inigma said: Oh fail the contract. Not just fail the parameter. Gotcha. Ok this one the wiki just says fail. I double checked this time. how can I contribute to the wiki? I had to disable anonymous contributions to the wiki because editing it through the GUI screws up the folder structure, which messes up all the linking. So if you want to contribute, you'd have to fork the repository, make your changes by manually editing/commiting the .md files, and then submit a "manual" pull request (ie. an issue with a link to your repository saying "please pull these changes"). Quote Link to comment Share on other sites More sharing options...
inigma Posted December 3, 2015 Share Posted December 3, 2015 (edited) I will probably ask this at some point. Figured I'd do so now. Ok, now that we've established that Not>HasPassengers(kerbal1),HasPassengers(kerbal2) is the best way to check that they are unloaded how would I be able to check the unloading of a set number of kerbals determined at the beginning of the contract by random? I'm thinking about offering the Three Hour Tour contract repeatable, but randomizing the number of passengers between 2-6 per instance of the contract - to give the player the feel for a regular charter involving random passengers and passenger counts. Thoughts? Edited December 4, 2015 by inigma Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 4, 2015 Author Share Posted December 4, 2015 21 minutes ago, inigma said: I will probably ask this at some point. Figured I'd do so now. Ok, now that we've established that Not>HasPassengers(kerbal1),HasPassengers(kerbal2) is the best way to check that they are unloaded how would I be able to check the unloading of a set number of kerbals determined at the beginning of the contract by random? I'm thinking about offering the Three Hour Tour contract repeatable, but randomizing the number of passengers between 2-6 per instance of the contract - to give the player the feel for a regular charter involving. Thoughts? Totally doable, take a look at field research for an example (short version - put requirement nodes under the parameters that won't always show up). I'll give a more detailed example when I can later tonight if needed. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 4, 2015 Share Posted December 4, 2015 (edited) 7 minutes ago, nightingale said: Totally doable, take a look at field research for an example (short version - put requirement nodes under the parameters that won't always show up). I'll give a more detailed example when I can later tonight if needed. Sort of like: Not> HasPassenger(kerbal1)> Require(Expression) @/kerbal1 = !null HasPassenger(kerbal2)> Require(Expression) @/kerbal2 = !null ? Edited December 4, 2015 by inigma Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 4, 2015 Author Share Posted December 4, 2015 32 minutes ago, inigma said: Sort of like: Not> HasPassenger(kerbal1)> Require(Expression) @/kerbal1 = !null HasPassenger(kerbal2)> Require(Expression) @/kerbal2 = !null ? Yup, that's the basic idea. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 4, 2015 Share Posted December 4, 2015 (edited) Support Request (from https://github.com/inigmatus/GAP/issues/11): So far I have created 5 static Kerbals in https://github.com/inigmatus/GAP/blob/master/IslandTours-2-ThreeHourTour.cfg With: DATA { type = Kerbal kerbal1 = NewKerbal() kerbal2 = NewKerbal() kerbal3 = NewKerbal() kerbal4 = NewKerbal() kerbal5 = NewKerbal() } Is it possible for the above list of Kerbals to be randomized between 2-6 Kerbals and inserted into: BEHAVIOUR { name = SpawnPassengers type = SpawnPassengers passengerName = @/kerbal1 passengerName = @/kerbal2 ...and stopping here if the random number was 2? kerbalType = Crew } I realized I can do this: DATA { type = int numPassengers = Random(2,6) } BEHAVIOUR { name = SpawnPassengers type = SpawnPassengers count = @/numPassengers kerbalType = Crew } but doing so removes me from specifying those passengers with the NewKerbal() function. Any ideas? Edited December 4, 2015 by inigma Quote Link to comment Share on other sites More sharing options...
IRnifty Posted December 4, 2015 Share Posted December 4, 2015 Hey nightingale, I have a feature request. How about a parameter type like "ConfirmDialogBox"? The primary attribute would be the name of the BEHAVIOUR node which defines the DialogBox, and when the user clicks to close the box, this parameter would be triggered as complete. When this type of parameter is hidden, multiple of this type could be used to set up a string of DialogBoxes, resulting in a conversation of sorts. Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 4, 2015 Share Posted December 4, 2015 33 minutes ago, IRnifty said: The primary attribute would be the name of the BEHAVIOUR node which defines the DialogBox, and when the user clicks to close the box, this parameter would be triggered as complete. When this type of parameter is hidden, multiple of this type could be used to set up a string of DialogBoxes, resulting in a conversation of sorts. Take a look at K-Files - I do something similar with hidden parameters and behaviour nodes. Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 4, 2015 Author Share Posted December 4, 2015 (edited) 8 hours ago, inigma said: Support Request (from https://github.com/inigmatus/GAP/issues/11): So far I have created 5 static Kerbals in https://github.com/inigmatus/GAP/blob/master/IslandTours-2-ThreeHourTour.cfg <snip> but doing so removes me from specifying those passengers with the NewKerbal() function. Any ideas? You need to use arrays (lists) to get that working the way you want. Something along these lines: DATA { type = int numPassengers = Random(2,6) } DATA { type = List<Kerbal> kerbals = [ NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal() ].Random(@numPassengers) } BEHAVIOUR { name = SpawnPassengers type = SpawnPassengers passengerName = @/kerbals kerbalType = Crew } However, I suspect this won't work because SPawnPassengers is looking for a list of strings instead of a list of Kerbals. Raised [#378] to address this. 2 hours ago, IRnifty said: Hey nightingale, I have a feature request. How about a parameter type like "ConfirmDialogBox"? The primary attribute would be the name of the BEHAVIOUR node which defines the DialogBox, and when the user clicks to close the box, this parameter would be triggered as complete. When this type of parameter is hidden, multiple of this type could be used to set up a string of DialogBoxes, resulting in a conversation of sorts. 1 hour ago, severedsolo said: Take a look at K-Files - I do something similar with hidden parameters and behaviour nodes. Indeed, if you specify multiple DIALOG_BOX nodes, they will appear in sequence as the user clicks dismisses them. Edited December 4, 2015 by nightingale Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 4, 2015 Share Posted December 4, 2015 What will happen to active contracts if I change the name of the contract group and the player has active contracts from the old group? Will they get the failure messages and the penalties, or will it be fine? Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 4, 2015 Author Share Posted December 4, 2015 14 minutes ago, severedsolo said: What will happen to active contracts if I change the name of the contract group and the player has active contracts from the old group? Will they get the failure messages and the penalties, or will it be fine? Changing the name of the CONTRACT_TYPE will definitely cause the contract to fail and be removed. There isn't a direct link to the CONTRACT_GROUP in the save game though, so you should be okay. Quote Link to comment Share on other sites More sharing options...
IRnifty Posted December 5, 2015 Share Posted December 5, 2015 That's pretty cool. Didn't know it would do that. Next up. Is it possible to trigger a code event somehow? I'm looking to play a sound and do other things whenever certain parameters are met. Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 5, 2015 Author Share Posted December 5, 2015 1 hour ago, IRnifty said: That's pretty cool. Didn't know it would do that. Next up. Is it possible to trigger a code event somehow? I'm looking to play a sound and do other things whenever certain parameters are met. Not directly, but you can implement your own Contract Behaviour that does anything you want. Quote Link to comment Share on other sites More sharing options...
IRnifty Posted December 5, 2015 Share Posted December 5, 2015 I did just see that! Thanks for the help! Hey, I understand you're the developer of Anomaly Surveyor. I... Kiiinda want to extend that beyond its original scope. Care to talk over PM if the forums let us? Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 5, 2015 Author Share Posted December 5, 2015 10 minutes ago, IRnifty said: I did just see that! Thanks for the help! Hey, I understand you're the developer of Anomaly Surveyor. I... Kiiinda want to extend that beyond its original scope. Care to talk over PM if the forums let us? Sure! The PM system on the new forums is actually pretty decent. Quote Link to comment Share on other sites More sharing options...
inigma Posted December 5, 2015 Share Posted December 5, 2015 DATA { type = List<Kerbal> kerbals = [ NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal() ].Random(@numPassengers) } How do I reference a single kerbal in that list in the following? PARAMETER { name = HasPassengers type = HasPassengers kerbal = @/?dunno disableOnStateChange = true title = Passenger: @/?dunno } Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 5, 2015 Author Share Posted December 5, 2015 2 minutes ago, inigma said: DATA { type = List<Kerbal> kerbals = [ NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal() ].Random(@numPassengers) } How do I reference a single kerbal in that list in the following? PARAMETER { name = HasPassengers type = HasPassengers kerbal = @/?dunno disableOnStateChange = true title = Passenger: @/?dunno } See the List methods. What you want is @/kerbals.ElementAt(0), @/kerbals.ElementAt(1), etc. For the title you can just do title = Passenger: @kerbal Quote Link to comment Share on other sites More sharing options...
inigma Posted December 5, 2015 Share Posted December 5, 2015 Just now, nightingale said: See the List methods. What you want is @/kerbals.ElementAt(0), @/kerbals.ElementAt(1), etc. For the title you can just do title = Passenger: @kerbal Thanks! Quote Link to comment Share on other sites More sharing options...
inigma Posted December 5, 2015 Share Posted December 5, 2015 How can I load a list of a player's crew members into a variable? List<Kerbal> Crew() Gets all the Kerbals that are on board the vessel DATA { type = Vessel playersCrew = Crew() } i don't think i'm wrapping my head around how to use the list examples. I want to require the player to recover all their crew members in addition to the passengers on board their craft, to complete a contract: PARAMETER { name = RecoverKerbal type = RecoverKerbal kerbal = @/kerbals (a list of passengers) kerbal = @/playersCrew (a list of the players crew minus passengers) hideChildren = true hidden = true } Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 5, 2015 Share Posted December 5, 2015 (edited) @inigma - take a look at KSS's Crew Rotation - that will show you the general gist. Your main problem is that you are trying to find a Vessel, but you want a list. What exactly are you trying to do? Are you trying to get a list of the active vessels crew? (that's going to be quite difficult I think - but you may be able to do it using a VesselParameterGroup). If you are trying to get an already existing vessels crew, that's a bit easier. Edit: Yup I was right, VPG is the way to go: PARAMETER { name = ParameterGroup type = VesselParameterGroup define = RecoverMe PARAMETER { <insert your first parameter here> } } PARAMETER { name = RecoverKerbal type = RecoverKerbal kerbal = @/RecoverMe.Crew() } Edited December 5, 2015 by severedsolo Quote Link to comment Share on other sites More sharing options...
nightingale Posted December 5, 2015 Author Share Posted December 5, 2015 Keep in mind that the expressions execute when the contract is generated. So you cannot use it to do stuff like asking the player to recover the crew that is currently on their vessel, but only the crew that was on a specific vessel at the start of the contract. Quote Link to comment Share on other sites More sharing options...
severedsolo Posted December 5, 2015 Share Posted December 5, 2015 (edited) Oh, I was wrong then. On a related note: Is HasCrew() supposed to count passengers (specifically tourists) as crew? To elaborate: I had a KSS contract to send a new crew, and a Tourism Plus contract to send tourists up. I sent the tourists first... surprisingly this completed my "send a new crew" contract even though I only had 1 actual crew member (and 4 tourists) on board. I feel this may be a bug, and HasCrew() should ignore tourists? Edited December 5, 2015 by severedsolo 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.