HebaruSan Posted October 23, 2019 Share Posted October 23, 2019 8 minutes ago, AmpCat said: //[KSPAddon(KSPAddon.Startup.MainMenu, false)] Don't comment this line out. It's what's known in C# as an attribute, and it tells KSP that it should load your class as an add-on. Once you remove the '//' you should start getting more interesting results. Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 Just now, HebaruSan said: Don't comment this line out. It's what's known in C# as an attribute, and it tells KSP that it should load your class as an add-on. Once you remove the '//' you should start getting more interesting results. Oh, I only just commented that out to see if it would change anything. It didn't. Same behavior either way. Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 23, 2019 Share Posted October 23, 2019 (edited) 17 minutes ago, AmpCat said: I'm trying to start learning to mod, and I've gotten kind of stuck on a simple 'Hello World'. HebaruSan was faster than me for the KSPAddon but the HelloKerbinMod should work as a PartModule. Can you show the CFG you used ? Edited October 23, 2019 by sarbian Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 // --- internal setup --- CrewCapacity = 1 tags = #autoLOC_500321 //#autoLOC_500321 = capsule cmg control ?eva fly gyro ?iva moment pilot react rocket space stab steer torque INTERNAL { name = mk1pod_IVA } MODULE { name = HelloKerbinMod } MODULE { name = ModuleCommand minimumCrew = 1 defaultControlPointDisplayName = #autoLOC_6011003 //#autoLOC_6011003 = Default CONTROLPOINT { name = reverse displayName = #autoLOC_6011004 //#autoLOC_6011004 = Reversed orientation = 0,0,180 } } I stuck it into the default mk1 crew capsule here. I just copied the bit of that code and around it. It seemed a little sparse, but that's how I understood it from the tutorial. Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 23, 2019 Share Posted October 23, 2019 It looks fine. Can you share the dll somewhere ? Also, do you run the game from "Program Files (x86)" ? I used to disrupt mod loading on some PC Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 (edited) I'm trying to publish it the VS project on github (not sure if that's really the best way to do it), but in the meantime: https://drive.google.com/drive/folders/1bkDjVVgZh7I3Qcs24KXr4kOSCgQ9fa7C?usp=sharing That's the DLL. Here's the github link, if it's helpful: https://github.com/AmpCat/KSP-Hello-World Edited October 23, 2019 by AmpCat Quote Link to comment Share on other sites More sharing options...
zer0Kerbal Posted October 23, 2019 Share Posted October 23, 2019 7 minutes ago, AmpCat said: I'm trying to publish it the VS project on github (not sure if that's really the best way to do it), but in the meantime: https://drive.google.com/drive/folders/1bkDjVVgZh7I3Qcs24KXr4kOSCgQ9fa7C?usp=sharing That's the DLL. Here's the github link, if it's helpful: https://github.com/AmpCat/KSP-Hello-World I don't actually see a helloworld.cs file with the code. Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 Yeah, once again I borked the repo. Trying to figure out how to wipe it and start over. Quote Link to comment Share on other sites More sharing options...
HebaruSan Posted October 23, 2019 Share Posted October 23, 2019 47 minutes ago, AmpCat said: Oh, I only just commented that out to see if it would change anything. It didn't. Same behavior either way. Did you copy the DLL into the GameData folder? Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 Yep. Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 30 minutes ago, zer0Kerbal said: I don't actually see a helloworld.cs file with the code. Okay, I think it's fixed. I moved the .cs down a folder and updated it's path in the project. Seems to build fine for me. Quote Link to comment Share on other sites More sharing options...
zer0Kerbal Posted October 23, 2019 Share Posted October 23, 2019 (edited) I would change the following in the .csproj: <Reference Include="UnityEngine"> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll</HintPath> </Reference> to: <Reference Include="..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine*.dll"</> I am believing you are compiling for 1.8 - and some .dll were split up - and you seem to be missing the UI part. do you know how to set an environmental variable? if so - set one to the KSP_x64_Data/Managed/ directory (call it DEVDLL or something.) replace all the ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed with $(DEVDLL) notice - no spaces and need the \UnityEngine*.dll (or whatever) at the end. Edited October 23, 2019 by zer0Kerbal Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 But it has the UI part? It's the last one listed. Quote Link to comment Share on other sites More sharing options...
sarbian Posted October 23, 2019 Share Posted October 23, 2019 There is no UI so it does not really matter and it compiled so the required refs were there. Your dll works fine here.I get the "Hello world!" with the time. Did you wait until you reached the main menu ? It is set up to run only in there ( KSPAddon.Startup.MainMenu ) Or it could be an over zealous anti virus. Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 (edited) I'll check in the main menu again. Oh, there it is now. Huh. I wonder which of the million changes fixed it. I thought it would only show up on the flight menu or something, so for a while I wasn't checking on the main menu. Course, doesn't explain why the part module doesn't work. Edited October 23, 2019 by AmpCat Quote Link to comment Share on other sites More sharing options...
zer0Kerbal Posted October 23, 2019 Share Posted October 23, 2019 apologies - in my haste to try to help - I overlooked both the above facts. Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 And now it's broken again. I went to change it to 'Start' instead of 'Update', and it didn't work, so I changed it back.. now it doesn't work either. Quote Link to comment Share on other sites More sharing options...
zer0Kerbal Posted October 23, 2019 Share Posted October 23, 2019 asking for assistance: simple bit of code: need to run through three lists and multiple each value by a constant. I believe foreach is the optimal way to do this, just don't know C# and the KSP API well enough to do this. definitions: /// definitions public struct Fuel { public int resourceID; public float rate; public ResourceFlowMode resourceFlowMode; } public struct mode { public Fuel[] fuels, byproducts; public Double maxEC; } pseudocode: // Actual Code: internal void OnRescale(TweakScale.ScalingFactor.FactorSet scaleFactor) { /// this scales any resources on the part with ODFC: foreach (PartResource resource in this.part.Resources) { resource.maxAmount *= scaleFactor.cubic; resource.amount *= scaleFactor.cubic; } /// this scales the actual fuel cell, fuels, byproducts, and maxEC // below is pseudocode: foreach (Fuel fuel in fuels) *= scaleFactor.cubic; foreach (Fuel fuel in byproducts) *= scaleFactor.cubic; foreach (Fuel fuel in maxEC) *= scaleFactor.cubic; // calls module updater this.updateFT(); } Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 23, 2019 Share Posted October 23, 2019 (edited) 3 hours ago, AmpCat said: And now it's broken again. I went to change it to 'Start' instead of 'Update', and it didn't work, so I changed it back.. now it doesn't work either. Okay, I was able to randomly fiddle with things I've tried before, and got it working again; I switched the .NET target to 4.0, rather than 4.7.2, and now both parts of my hello world work. And, as one might expect, I no longer get the error it can't find that Module. I read here, and it says we should be able to use any 4.x .NET framework, though. So what's the real answer? Edit: Okay, now I'm real confused. I went back and tested other .NET frameworks to see which worked and which didn't, and now even 4.7.2 works. I'm very confused. I don't know what is messing up. Edit2: Annnnd, can someone help me figure out GitHub (again)? Just looking for a volunteer to help me figure out how to take my local files and make the github repo online match. I don't know why this is so hard. Edited October 23, 2019 by AmpCat Quote Link to comment Share on other sites More sharing options...
zer0Kerbal Posted October 24, 2019 Share Posted October 24, 2019 (edited) it gets easier (or so I hope *knocking on wood*) are you using github desktop? @AmpCat Edited October 24, 2019 by zer0Kerbal Quote Link to comment Share on other sites More sharing options...
Athlonic Posted October 24, 2019 Share Posted October 24, 2019 (edited) Wrong thread disregard ^^ Spoiler Hi, For some reason NetKAN bot didn't catch my Chatterer updates (v0.9.98 for KSP1.8 and v0.9.97 for KSP1.7.x) yesterday. https://github.com/KSP-CKAN/NetKAN/blob/master/NetKAN/Chatterer.netkan My other mod update for LCDLaunchCountDown worked flawlessly tho https://github.com/KSP-CKAN/NetKAN/blob/master/NetKAN/LCDLaunchCountDown.netkan Should I do something ? Thx. Edited October 24, 2019 by Athlonic WTOD - wrong thread of death Quote Link to comment Share on other sites More sharing options...
zer0Kerbal Posted October 24, 2019 Share Posted October 24, 2019 59 minutes ago, Athlonic said: Hi, For some reason NetKAN bot didn't catch my Chatterer updates (v0.9.98 for KSP1.8 and v0.9.97 for KSP1.7.x) yesterday. https://github.com/KSP-CKAN/NetKAN/blob/master/NetKAN/Chatterer.netkan My other mod update for LCDLaunchCountDown worked flawlessly tho https://github.com/KSP-CKAN/NetKAN/blob/master/NetKAN/LCDLaunchCountDown.netkan Should I do something ? Thx. https://github.com/KSP-CKAN/NetKAN/issues/7444 Quote Link to comment Share on other sites More sharing options...
Athlonic Posted October 24, 2019 Share Posted October 24, 2019 Oups I wanted to post my previous post on the CKAN thread ! Wrong thread happened, sorry Quote Link to comment Share on other sites More sharing options...
AmpCat Posted October 25, 2019 Share Posted October 25, 2019 16 hours ago, zer0Kerbal said: it gets easier (or so I hope *knocking on wood*) are you using github desktop? @AmpCat I am. Also the visual studio git plugin. Quote Link to comment Share on other sites More sharing options...
acmarin Posted October 25, 2019 Share Posted October 25, 2019 Is it possible for me to use the unity package manager API to install a package into ksp using a c# script. I have experience with unity, but little with ksp, so any help would be much appreciated. 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.