Sigma88 Posted April 29, 2016 Share Posted April 29, 2016 3 minutes ago, MatterBeam said: Hi! I'm trying to modify the multiple ModuleResourceConverter sections of the ISRU part. However, all I know is using @MODULE[ModuleResourceConverter]. How do I write an MM config that targets the 'ConverterName =' line afterwards? I'm not sure this is what you want to do: @PART { @MODULE[ModuleResourceConverter]:HAS[#ConverterName[namehere]] { // your changes here } } this will target only the MODULE which have name = ModuleResourceConverter AND ConverterName = namehere Quote Link to comment Share on other sites More sharing options...
Rhedd Posted April 30, 2016 Share Posted April 30, 2016 (edited) What's the proper syntax to filter for a part that has "A" OR "B"? I can find examples of AND, but not OR. I'm looking for how to do this: @PART[*]:HAS[@PLUME[firstthing] OR IT HAS[@PLUME[secondthing]] one or the other, not both {} Edited April 30, 2016 by Rhedd Quote Link to comment Share on other sites More sharing options...
blowfish Posted April 30, 2016 Share Posted April 30, 2016 (edited) 11 minutes ago, Rhedd said: What's the proper syntax to filter for a part that has "A" OR "B"? I can find examples of AND, but not OR. I'm looking for how to do this: @PART[*]:HAS[@PLUME[firstthing] OR IT HAS[@PLUME[secondthing]] one or the other, not both {} You could do it by setting a value in one patch and then checking it in another @PART[*]:HAS[@PLUME[firstPlume],@PLUME[secondPlume]] { %somethingDescriptive = someValue } @PART[*]:HAS[@PLUME[firstPlume]|@PLUME[secondPlume]&#somethingDescriptive[someValue]] { // stuff you want to do } I'm pretty sure the order of operations on that is correct there. Maybe someone has a more efficient way to do it. You might also want to remove the value in another patch, since it'll generate a log warning otherwise (I think). Edited April 30, 2016 by blowfish Quote Link to comment Share on other sites More sharing options...
Rhedd Posted April 30, 2016 Share Posted April 30, 2016 1 hour ago, blowfish said: You could do it by setting a value in one patch and then checking it in another @PART[*]:HAS[@PLUME[firstPlume],@PLUME[secondPlume]] { %somethingDescriptive = someValue } @PART[*]:HAS[@PLUME[firstPlume]|@PLUME[secondPlume]&#somethingDescriptive[someValue]] { // stuff you want to do } I'm pretty sure the order of operations on that is correct there. Maybe someone has a more efficient way to do it. You might also want to remove the value in another patch, since it'll generate a log warning otherwise (I think). Clever solution, but it won't really work, because although I gave a two-part example, what I really want to do is apply the same long bunch of code to a whole LIST of things without having to write it all out for every one of them. I take it your response means that there isn't a simple OR syntax for this? I'm really surprised, it seems so obvious. Quote Link to comment Share on other sites More sharing options...
Jacke Posted April 30, 2016 Share Posted April 30, 2016 (edited) 3 hours ago, Rhedd said: I take it your response means that there isn't a simple OR syntax for this? I'm really surprised, it seems so obvious. Not quite. Module Manager scripts have operators for Logical AND (',' or '&'), that is, both A and B and only that. They have an operator for Logical OR, or more specifically a Logical Inclusive OR ('|'), that is only A, only B, or both A and B. But as far as I know, MM syntax doesn't yet have a Logical XOR, Exclusive XOR, A XOR B, just one of A or B, not both. Which is what you want, @Rhedd. 4 hours ago, Rhedd said: I'm looking for how to do this: @PART[*]:HAS[@PLUME[firstthing] OR IT HAS[@PLUME[secondthing]] one or the other, not both {} You can write a script that will act as an XOR operation and in not too much space. This will definitely work. I don't think current Module Manager syntax allows a simpler script that will do the same as this. @PART[*]:HAS[@PLUME[firstthing],!PLUME[secondthing]] { // whatever needs to be done 1st copy } @PART[*]:HAS[!PLUME[firstthing],@PLUME[secondthing]] { // whatever needs to be done 2nd copy } The advantage of the script above is if those two "whatever needs to be done" sections actually have to be a little bit different, it's very easy to make them so. But Rhedd, you said "whatever needs to be done" was the same for both cases. You still need to use this syntax, as I think there is no other more compact way in MM scripting to do so. @sarbianis likely well aware of this, as XOR is a common computer concept, and he'll know how he could introduce it. But it can be very complex to do. And XOR isn't commonly needed for the sort of stuff that MM scripts do. I search this whole topic and haven't found any mention in 2.5 years of Exclusive OR or XOR prior to this. EDIT: From the Modular Manager Syntax wiki entry: Quote You can use & for AND, | for OR and ! for NOT in the needs listing. To allow backwards compatibility , is treated as an alias for & (AND). If you combine several | and &, eg NEEDS[Mod1|Mod2&!Mod3|Mod4] this is treated as ( Mod1 OR Mod2 ) AND ( ( NOT Mod3 ) OR Mod4 ). I won't be implementing brackets, it would make the parser far too complicated. There's always a way to represent what you want in this form, although it might need a few repeated terms, but I'm not sure I can truly see much of a use case for anything super complex. Now that I think of it after reading this, there are better ways to do XOR, but it appears @Rhedd only needs standard Inclusive OR.... Edited April 30, 2016 by Jacke Quote Link to comment Share on other sites More sharing options...
Rhedd Posted April 30, 2016 Share Posted April 30, 2016 (edited) 2 hours ago, Jacke said: Not quite. Module Manager scripts have operators for Logical AND (',' or '&'), that is, both A and B and only that. They have an operator for Logical OR, or more specifically a Logical Inclusive OR ('|'), that is only A, only B, or both A and B. But as far as I know, MM syntax doesn't yet have a Logical XOR, Exclusive XOR, A XOR B, just one of A or B, not both. Which is what you want, @Rhedd. You can write a script that will act as an XOR operation and in not too much space. This will definitely work. I don't think current Module Manager syntax allows a simpler script that will do the same as this. @PART[*]:HAS[@PLUME[firstthing],!PLUME[secondthing]] { // whatever needs to be done 1st copy } @PART[*]:HAS[!PLUME[firstthing],@PLUME[secondthing]] { // whatever needs to be done 2nd copy } The advantage of the script above is if those two "whatever needs to be done" sections actually have to be a little bit different, it's very easy to make them so. But Rhedd, you said "whatever needs to be done" was the same for both cases. You still need to use this syntax, as I think there is no other more compact way in MM scripting to do so. @sarbianis likely well aware of this, as XOR is a common computer concept, and he'll know how he could introduce it. But it can be very complex to do. And XOR isn't commonly needed for the sort of stuff that MM scripts do. I search this whole topic and haven't found any mention in 2.5 years of Exclusive OR or XOR prior to this. I actually made it sound more complicated than I need it to be! Your information is great, Jacke, and thanks for taking the time to explain it. I'm sorry I didn't make the problem clear and save you some typing. A plain old inclusive OR is fine for what I want, since there will never be a time that the part has more than one of the choices, and it wouldn't hurt anything if it did! I've tried | , because I saw it used in a different context, but I couldn't get it to work so I assumed it didn't in this case. Sorry for being dense, but where exactly where would I put the | ? So what I believe I tried was... @PART[*]:HAS[@PLUME[firstthing] | PLUME[secondthing]] The first thing worked, but the second didn't, if I'm remembering correctly. (I've tried too many things to remember, now!:P) Edited April 30, 2016 by Rhedd Quote Link to comment Share on other sites More sharing options...
Jacke Posted April 30, 2016 Share Posted April 30, 2016 (edited) OH NOW I GET IT!!! What @blowfish was trying to do. But after reading the wiki pages, I believe there's a better way to do XOR. But @Rhedd just needs an Inclusive OR. 28 minutes ago, Rhedd said: A plain old inclusive OR is fine for what I want, since there will never be a time that the part has more than one of the choices, and it wouldn't hurt anything if it did! .... So what I believe I tried was... @PART[*]:HAS[@PLUME[firstthing] | PLUME[secondthing]] The first thing worked, but the second didn't, if I'm remembering correctly. (I've tried too many things to remember, now!:P) This is what you want, Rhedd. @PART[*]:HAS[@PLUME[firstPlume]|@PLUME[secondPlume]] { // long script of what you want to do to those parts } You missed the second '@'. Now if Exclusive OR, XOR, was needed.... From the Module Manager Syntax wiki page, OR ('|') binds tighter than AND (',' or '&'). And with the Module Manager Handbook wiki page implies that NOT (using '!' in place of '@') binds tightest of all. So.... Assuming what I've read applies to HAS blocks, including some things that only referred to NEEDS:.... // parts must have firstthing XOR secondthing // OR binds tighter than AND, but NOT binds tightest of all // thus (firstthing OR secondthing) AND ((NOT firstthing) OR (NOT secondthing)) @PART[*]:HAS[@PLUME[firstthing]|@PLUME[secondthing]&!PLUME[firstthing]|!PLUME[secondthing]] { // long script of what you want to do to those parts } Someone with better knowledge of MM syntax want to confirm this? Edited April 30, 2016 by Jacke Quote Link to comment Share on other sites More sharing options...
Rhedd Posted April 30, 2016 Share Posted April 30, 2016 @Jacke, I would've thought that the missing @ was a mistake in my post, not in what I did earlier, but it wasn't working, so I tried it. I've now tried everything I could think of, carefully documenting each try, and here are the results: (Note the two things I'm testing for are very similar in name- "Kerolox-Lower-F1" and "Kerolox-Lower".) @PART[*]:HAS[@PLUME[Kerolox-Lower-F1]]:FINAL ............. WORKS @PART[*]:HAS[@PLUME[Kerolox-Lower]]:FINAL ............. WORKS @PART[*]:HAS[@PLUME[Kerolox-Lower-F1] | @PLUME[Kerolox-Lower]]:FINAL ............. NOTHING WORKS @PART[*]:HAS[@PLUME[Kerolox-Lower-F1]|@PLUME[Kerolox-Lower]]:FINAL ............. FIRST CASE WORKS, SECOND DOES NOT So now I'm totally lost. But hey, I learned one thing I didn't know before! MM seems to care about spaces. >_> Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 30, 2016 Author Share Posted April 30, 2016 There is no OR. OR means handling operator priorities so no thanks. Quote Link to comment Share on other sites More sharing options...
Jacke Posted April 30, 2016 Share Posted April 30, 2016 (edited) 24 minutes ago, sarbian said: There is no OR. OR means handling operator priorities so no thanks. Indeed. As someone's who's coded priority operators (and may they all be suffix operators...) I completely understand. Starting to get the hang of the syntax. Wish I had better documentation (many of my old MM topic links from the old forum software I couldn't find the post and post numbers didn't auto-translate). Of course, I could always go diving in the source. Where it likely uses standard library calls. But I think I have a solution.... 2 hours ago, Rhedd said: @PART[*]:HAS[@PLUME[Kerolox-Lower-F1]|@PLUME[Kerolox-Lower]]:FINAL ............. FIRST CASE WORKS, SECOND DOES NOT So now I'm totally lost. But hey, I learned one thing I didn't know before! MM seems to care about spaces. >_> Keep spaces out of scripts except for indentation, values, and comments. And where the '|' is above, only ',' is allowed, AND. So try this (may work). @PART[*]:HAS[@PLUME[Kerolox-Lower|Kerolox-Lower-F1]]:FINAL { // changes go here } And if that doesn't work, and the only possibilities of PLUME names that start with "Kerolox-Lower" are those 2 and only those 2, try this. @PART[*]:HAS[@PLUME[Kerolox-Lower*]]:FINAL { // changes go here } Edited April 30, 2016 by Jacke Quote Link to comment Share on other sites More sharing options...
Cerberus738 Posted April 30, 2016 Share Posted April 30, 2016 SO just a heads up. Module manager does not initialize with 1.1.2. No patches get applied at the loading screen. Anyone else having this problem? Is there something i overlooked? Quote Link to comment Share on other sites More sharing options...
MOARdV Posted April 30, 2016 Share Posted April 30, 2016 37 minutes ago, Cerberus738 said: SO just a heads up. Module manager does not initialize with 1.1.2. No patches get applied at the loading screen. Anyone else having this problem? Is there something i overlooked? Yes, I see it, too. There's now an exception when MM tries to start: [EXC 07:20:31.521] MissingMethodException: Method not found: 'PopupDialog.SpawnPopupDialog'. ModuleManager.ModuleManager.Awake () UnityEngine.GameObject:AddComponent(Type) AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup) AddonLoader:StartAddons(Startup) <LoadObjects>c__Iterator32:MoveNext() UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) <CreateDatabase>c__Iterator31:MoveNext() UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) GameDatabase:StartLoad() <LoadSystems>c__Iterator45:MoveNext() UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) LoadingScreen:Start() Yay for breaking under-the-hood changes... =P Quote Link to comment Share on other sites More sharing options...
onlinegamesz Posted April 30, 2016 Share Posted April 30, 2016 Same problem for me, I hope there is a fix asap! Quote Link to comment Share on other sites More sharing options...
Red Iron Crown Posted April 30, 2016 Share Posted April 30, 2016 Removed some posts. Please recall that the 1.1.2 update has been out for about two hours, please give sarbian and the other modders some time to update before complaining. Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 30, 2016 Author Share Posted April 30, 2016 Version 2.6.24 : Built for 1.1.2 Downloads : ModuleManager.2.6.24.dll ModuleManager-2.6.24.zip Quote Link to comment Share on other sites More sharing options...
KerbOrbiter Posted April 30, 2016 Share Posted April 30, 2016 @sarbian, so fast, thank you for your work Quote Link to comment Share on other sites More sharing options...
eddiew Posted April 30, 2016 Share Posted April 30, 2016 Awesome, thanks for being so quick with it Quote Link to comment Share on other sites More sharing options...
onlinegamesz Posted April 30, 2016 Share Posted April 30, 2016 Thank you so much for the quick fix!!!! Quote Link to comment Share on other sites More sharing options...
legoclone09 Posted April 30, 2016 Share Posted April 30, 2016 A whole TWO hours and 15 minutes? Too slow! Just kidding, great job with getting it out fast! Quote Link to comment Share on other sites More sharing options...
sarbian Posted April 30, 2016 Author Share Posted April 30, 2016 2 minutes ago, legoclone09 said: A whole TWO hours and 15 minutes? Too slow! Just kidding, great job with getting it out fast! Yeah, sorry about that I was out getting food Quote Link to comment Share on other sites More sharing options...
CaptRobau Posted April 30, 2016 Share Posted April 30, 2016 Great. Means I can still get my update out this weekend! Quote Link to comment Share on other sites More sharing options...
Nightmare Posted April 30, 2016 Share Posted April 30, 2016 Ah perfect my weekend is safe now ;-) Quote Link to comment Share on other sites More sharing options...
Temeter Posted April 30, 2016 Share Posted April 30, 2016 14 minutes ago, sarbian said: Yeah, sorry about that I was out getting food You're crazy. Thanks! <3 Quote Link to comment Share on other sites More sharing options...
Somgosomgo Posted April 30, 2016 Share Posted April 30, 2016 Amazing. You sir, are truly devoted. Quote Link to comment Share on other sites More sharing options...
Kiwa Posted April 30, 2016 Share Posted April 30, 2016 :thumbsup: 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.