Jump to content

The official unoffical "help a fellow plugin developer" thread


Recommended Posts

2 hours ago, DennyTX said:

messrs, how can i catch only "revert to launch" event? (user has pressed stock "revert to launch" button)

Try checking to see if "revert to launch" will fire OnVesselRollout. You'd have to listen for onGameSceneSwitchRequested before that so that you can distinguish between a new launch from VAB/SPH (from EDITOR to FLIGHT) vs actually revert to launch (from FLIGHT to FLIGHT)

Link to comment
Share on other sites

On 20/05/2017 at 2:18 PM, Kobymaru said:

ps.: Is there some sort of "reference frame guide" for KSP? I keep getting confused by World/Body-Relative/Krakensbane/Surface-Relative and all kinds of coordinate systems.

I'd love to see a guide/tuto about this. I recently try to calculate the distance between two ship orbiting different bodies but couldn't figure it out :(

Link to comment
Share on other sites

Two related questions

My current contracts have english strings in the source code to which I append the names of bodies for the which the contract applies e.g.

"Crash a probe into " +body.GetDisplayName();

As of 1.3 that code is appending the gender to the end of the string as ^N I want the simplest way to replicate the functionality of the previous theName property so it at least makes gramatical sense in English

Second question

Is there a guide anywhere on how to localize mods properly? Generating contracts, science experiment definitions etc.

Edited by tomf
Link to comment
Share on other sites

8 minutes ago, tomf said:

Two related questions

My current contracts have english strings in the source code to which I append the names of bodies for the which the contract applies e.g.


"Crash a probe into " +body.GetDisplayName();

As of 1.3 that code is appending the gender to the end of the string as ^N I want the simplest way to replicate the functionality of the previous theName property so it at least makes gramatical sense in English

You need to pass the display name through Lingoona to get the gender code stripped/used.  The hacky way to do that would be:

KSP.Localization.Localizer.Format("Crash a probe into <<1>>", body.GetDisplayName());

The better way is to put the string "Crash a probe into <<1>>" into a localisation string in the proper file/format (some details in the thread below).

8 minutes ago, tomf said:

Second question

Is there a guide anywhere on how to localize mods properly? Generating contracts, science experiment definitions etc.

Check out @DMagic's thread here:

 

Link to comment
Share on other sites

Has anyone noticed that the toggle options in the game settings are vertically aligned centered? Not vertically aligned top? Is there a fix for that? It looks pretty silly when I only have one or two options. See pictures below for Basic settings on the left, especially the floating toggle option in the middle column, and my mod's setting in the picture on the right.

Also, what does "autoPersistance" in GameParameters.CustomParameterNode do?

  OQFst3Q.png    gykNlLh.png

Link to comment
Share on other sites

44 minutes ago, ev0 said:

Has anyone noticed that the toggle options in the game settings are vertically aligned centered? Not vertically aligned top? Is there a fix for that? It looks pretty silly when I only have one or two options. See pictures below for Basic settings on the left, especially the floating toggle option in the middle column, and my mod's setting in the picture on the right.

Also, what does "autoPersistance" in GameParameters.CustomParameterNode do?

  OQFst3Q.png    gykNlLh.png

It's a reported bug for 1.3.

autoPersistence if true will persist the variable into the sfs save file and reload it for you automatically.

Link to comment
Share on other sites

I was wanting to drop some pull requests to help updated the various open source modes mods to 1.3.0

What are the changes in "part only" mods if there are any?

Link to comment
Share on other sites

On 6/3/2017 at 1:04 PM, Ruedii said:

I was wanting to drop some pull requests to help updated the various open source modes mods to 1.3.0

What are the changes in "part only" mods if there are any?

I have not seen any changes, but there may (or may not) have been some new functions added. All purly parts mods from 1.2.2 will work in KSP 1.3. 

Link to comment
Share on other sites

So I'm trying to add an action to a part's right-click menu, but when I click the in-game button, nothing happens--the debug messages I programmed in don't even show up anywhere. As far as I can tell, this is the relevant bit in KSP.log:

[ERR 14:14:51.877] ADDON BINDER: Cannot resolve assembly: System.Collections, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

[EXC 14:14:51.879] FileNotFoundException: Could not load file or assembly 'System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
	BaseEvent.Invoke ()
	UIPartActionButton.OnClick ()
	UnityEngine.Events.InvokableCall.Invoke (System.Object[] args)
	UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEvent.Invoke ()
	UnityEngine.UI.Button.Press ()
	UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
	UnityEngine.EventSystems.EventSystem:Update()

And here's my code. Is there something I screwed up?

Link to comment
Share on other sites

1 minute ago, Deus Zed Machina said:

So I'm trying to add an action to a part's right-click menu, but when I click the in-game button, nothing happens--the debug messages I programmed in don't even show up anywhere. As far as I can tell, this is the relevant bit in KSP.log:


[ERR 14:14:51.877] ADDON BINDER: Cannot resolve assembly: System.Collections, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

[EXC 14:14:51.879] FileNotFoundException: Could not load file or assembly 'System.Collections, Version=4.0.10.0

And here's my code. Is there something I screwed up?

It looks like you compiled against .NET 4.0. Try 3.5, that's the version mods are supposed to use.

Link to comment
Share on other sites

1 minute ago, Deus Zed Machina said:

So I'm trying to add an action to a part's right-click menu, but when I click the in-game button, nothing happens--the debug messages I programmed in don't even show up anywhere. As far as I can tell, this is the relevant bit in KSP.log:


[ERR 14:14:51.877] ADDON BINDER: Cannot resolve assembly: System.Collections, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

[EXC 14:14:51.879] FileNotFoundException: Could not load file or assembly 'System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
	BaseEvent.Invoke ()
	UIPartActionButton.OnClick ()
	UnityEngine.Events.InvokableCall.Invoke (System.Object[] args)
	UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters)
	UnityEngine.Events.UnityEvent.Invoke ()
	UnityEngine.UI.Button.Press ()
	UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
	UnityEngine.EventSystems.EventSystem:Update()

And here's my code. Is there something I screwed up?

seems like a compiler issue. Check your file paths in your programing environment (visual studio or whatever you're using)

Link to comment
Share on other sites

29 minutes ago, Bonus Eventus said:

seems like a compiler issue. Check your file paths in your programing environment (visual studio or whatever you're using)

 

29 minutes ago, HebaruSan said:

It looks like you compiled against .NET 4.0. Try 3.5, that's the version mods are supposed to use.

As far as I can tell, I'm using NET 3.5, though the project properties don't show an Application tab for some reason so I'm not 100% sure. How would I go about checking the file paths? I'm using Visual Studio 2017.

Link to comment
Share on other sites

Just now, Deus Zed Machina said:

As far as I can tell, I'm using NET 3.5, though the project properties don't show an Application tab for some reason so I'm not 100% sure. How would I go about checking the file paths? I'm using Visual Studio 2017.

Your csproj file should have this:

    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

 

Link to comment
Share on other sites

9 minutes ago, HebaruSan said:

Your csproj file should have this:


    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

 

My csproj file doesn't have any .NET framework version specified, apparently. It lacks the <TargetFrameworkVersion> tag altogether. Should I just paste that line in or..?

Link to comment
Share on other sites

1 minute ago, Deus Zed Machina said:

My csproj file doesn't have any .NET framework version specified, apparently. It lacks the <TargetFrameworkVersion> tag altogether. Should I just paste that line in or..?

Make a backup and try it, I guess? I don't know much about Visual Studio, but I would guess that without that line, it would use the latest version you have installed. Here's a full example if you want to see it in context:

https://github.com/HebaruSan/Astrogator/blob/master/src/Astrogator.csproj#L12

Link to comment
Share on other sites

20 minutes ago, HebaruSan said:

Make a backup and try it, I guess? I don't know much about Visual Studio, but I would guess that without that line, it would use the latest version you have installed. Here's a full example if you want to see it in context:

https://github.com/HebaruSan/Astrogator/blob/master/src/Astrogator.csproj#L12

Well, that didn't work. It says I need to update visual studio to open the .cs file, then it takes me to MSN. I think the issue has something to do with my version of visual studio...

EDIT: If I make a new project and select .NET 3.5 in the file creation menu, the resulting .csproj still lacks the <TargetFrameworkVersion> tag.

Edited by Deus Zed Machina
Link to comment
Share on other sites

1 hour ago, Deus Zed Machina said:

Well, that didn't work. It says I need to update visual studio to open the .cs file, then it takes me to MSN. I think the issue has something to do with my version of visual studio...

EDIT: If I make a new project and select .NET 3.5 in the file creation menu, the resulting .csproj still lacks the <TargetFrameworkVersion> tag.

Well, I'd say that's the problem, then. I can't help you with wrangling your software, but I can wish you good luck. :)

Have you tried compiling the source for another mod that already works?

Link to comment
Share on other sites

3 minutes ago, Deus Zed Machina said:

Visual Studio Community 2017 ver. 15.2 (26430.12) Release

Let's check if you have the proper component then. In your start menu you should have a "Visual Studio Installer". Launch it and press the Modify button in the "Visual Studio Community 2017" section.  In the new windows make sure ".NET desktop development" is checked, and then do in the "Individual components" tab and make sure you have ".NET Framework 3.5 development tools" checked (2 line for me). Then press close. It should add what was missing.

NL3OZP5.png

 

Launch VS, open your solution and check your project config (Project menu, last item  : "xxxxx properties"). Go in the application tab and set it up like that : 

f5xBHym.png

 

 

 

 

 

Link to comment
Share on other sites

2 hours ago, sarbian said:

Let's check if you have the proper component then. In your start menu you should have a "Visual Studio Installer". Launch it and press the Modify button in the "Visual Studio Community 2017" section.  In the new windows make sure ".NET desktop development" is checked, and then do in the "Individual components" tab and make sure you have ".NET Framework 3.5 development tools" checked (2 line for me). Then press close. It should add what was missing.

[etc.]

I installed the .NET 3.5 tools, but when I open my project's properties, I don't have an "application" tab. Is there some other component I might be missing?

EDIT: I figured it out. I'm using the wrong kind of class library. Whoops :P Now it works just fine!

Edited by Deus Zed Machina
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...