Jump to content

[1.8.x to 1.12.x] kRPC: Remote Procedure Call Server (v0.5.1, 2nd March 2023)


djungelorm

Recommended Posts

9 hours ago, goldmine48 said:

Hi,

Awesome mod! I've been using it for a while now(when I was on 1.1.3) but I tried downloading and installing this pre-release for 1.2 and I've copied the GameData contents to the GameData folder for KSP and unzipped the python client zip file but I'm a little confused as to where I'm meant to move it to(i'm on Windows btw). I've only ever used pip.exe to install krpc before so I'm a little unfamiliar with manual installation. Once the official release is out I'll probably revert to using pip.exe but in the meantime any help would be appreciated.

Thanks

You can install the pre-release python client using pip too! Just pass it the path to the zip file. Or use this and it will download it too:

pip.exe install --upgrade https://krpc.s3.amazonaws.com/deploy/feature/ksp-1.2/714.1/client/krpc-python-0.3.6-61-g0f6458a.zip

 

Edited by djungelorm
Typo
Link to comment
Share on other sites

On 23/10/2016 at 0:00 AM, djungelorm said:

You can install the pre-release python client using pip too! Just pass it the path to the zip file. Or use this and it will download it too:


pip.exe install --upgrade https://krpc.s3.amazonaws.com/deploy/feature/ksp-1.2/714.1/client/krpc-python-0.3.6-61-g0f6458a.zip

 

Thanks! It works now.

Link to comment
Share on other sites

Hi @djungelorm! Excellent work on this mod, I really enjoy it, great to see so much progress on 1.2 already.

I've a request: Contracts, would it be possible to have clients support getting Active contracts and their text? Shall I put the request on the Github project page?

Cheers!

 

On 19/09/2016 at 11:49 AM, gowthamn said:

22.5 KM is too small to do a spacex type landing and launching the satellite and the same time :(. Any other way of making this work?

For the record, it's actually 2.5km. Unless it has changed in the last 2 versions of KSP. 

Link to comment
Share on other sites

On 27/10/2016 at 0:50 PM, NeverCast said:

I've a request: Contracts, would it be possible to have clients support getting Active contracts and their text? Shall I put the request on the Github project page?

Hi, yes please open an issue on GitHub. It's the best place to avoid requests getting lost!

Link to comment
Share on other sites

  • 4 weeks later...

Hi @djungelorm

  Just getting back into this after some real life intrusions! Thanks for the dev build! I am noticing a couple of issues now compared to 0.3.6 on 1.1.3. I am running the latest dev build and python has been updated using the PIP instructions you provided in a previous post.

Firstly, camera mode query is throwing an error.

>>> import krpc
>>> conn = krpc.connect(name='Game Controller')
>>> vessel = conn.space_center.active_vessel
>>> cam = conn.space_center.camera
>>> cam.mode
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "C:\Users\petern\AppData\Local\Programs\Python\Python35-32\lib\site-packages\krpc\client.py", line 88, in _invoke
    raise RPCError(response.error)
krpc.error.RPCError: Field '.MapView.MapIsEnabled' not found.

Second, i am struggling with propellants, as 'total_resource_available' and 'total_resource_capacity' give errors.

>>> y
<SpaceCenter.Propellant remote object #56>
>>> y.name
'LiquidFuel'
>>> y.total_resource_available
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "C:\Users\petern\AppData\Local\Programs\Python\Python35-32\lib\site-packages\krpc\client.py", line 88, in _invoke
    raise RPCError(response.error)

Can you let me know if these are related to changes in the latest versions, or if they are bugs?

Cheers

Pete

 

Link to comment
Share on other sites

Is there a way to get extended action groups working? Obviously it throws an exception after 9. I found the code that does this. 

   /// <summary>
        /// Toggles the state of the given action group.
        /// </summary>
        /// <param name="group">A number between 0 and 9 inclusive.</param>
        [KRPCMethod]
        public void ToggleActionGroup (uint group)
        {
            if (group > 9)
                throw new ArgumentException ("Action group must be between 0 and 9 inclusive");
            InternalVessel.ActionGroups.ToggleGroup (ActionGroupExtensions.GetActionGroup (group));

Im fairly new to programming and I only use python right now so bear with me.

Would changing the exception from 9 to 250 work? Of course it wouldnt throw an exception anymore, but would it toggle the action groups past 9? The mod works for kos, and says that it just continues the same numbering scheme past 9. I could be way off. Anyone have any insight? I am building a simulator that will have no hud so I will need buttons to control literally everything. Way more than 10. Hopefully I can get this figured out :D

Link to comment
Share on other sites

@Kotagi It is a bit more complicated then that.

I've made a pull request here with the needed changes.

Note that I do not have the time to download KRPC and actually test this, but that is the code that works in RemoteTech and kOS integration so it is good.

The only thing is that I had to add the ActionGroupExtendedMod class for code that needs to be in KRPC, there is probably a better place in the project's file structure to place it, but as I'm not familiar with it I'll have to ask you move it where it should go @djungelorm

The only other catch is I have not had a chance to look at the client side code yet, they have to have the ability to pass numbers larger then 10 for this to work.

D.

Link to comment
Share on other sites

  • 2 weeks later...
On 03/12/2016 at 9:47 PM, Diazo said:

@Kotagi It is a bit more complicated then that.

I've made a pull request here with the needed changes.

Note that I do not have the time to download KRPC and actually test this, but that is the code that works in RemoteTech and kOS integration so it is good.

The only thing is that I had to add the ActionGroupExtendedMod class for code that needs to be in KRPC, there is probably a better place in the project's file structure to place it, but as I'm not familiar with it I'll have to ask you move it where it should go @djungelorm

The only other catch is I have not had a chance to look at the client side code yet, they have to have the ability to pass numbers larger then 10 for this to work.

D.

Thanks Diazo! I'll take a look when I, hopefully..., have some spare time! Been a bit swamped recently...

I don't think any client side changes would be needed. The <= 9 validation check is only done on the server.

On 26/11/2016 at 11:36 AM, PeteWasEre said:

Hi @djungelorm

  Just getting back into this after some real life intrusions! Thanks for the dev build! I am noticing a couple of issues now compared to 0.3.6 on 1.1.3. I am running the latest dev build and python has been updated using the PIP instructions you provided in a previous post.

... snip ...

Can you let me know if these are related to changes in the latest versions, or if they are bugs?

Look like bugs :( There were lots of changes to these parts of KSPs API in 1.2.x. Have you tried the latest dev build? Available here: https://krpc.s3.amazonaws.com/deploy/master/742.1/krpc-0.3.7-110-g5267fdb.zip

Link to comment
Share on other sites

Version 0.3.7 has been released! Happy Christmas!

Here's a summary of the changes:

A full changelog is available here: https://github.com/krpc/krpc/releases/tag/v0.3.7

Link to comment
Share on other sites

On 24/12/2016 at 5:07 AM, djungelorm said:

@PeteWasEre I think those issues were due to the pre-release build being compiled for KSP 1.2.0.

I'm not seeing the bugs with the latest pre-release build and KSP 1.2.2. Available here: https://krpc.s3.amazonaws.com/deploy/master/756.1/krpc-0.3.7-122-ge9f70cf.zip

Yep, retested with the 0.3.7 build and all appears ok! Thank you!

Link to comment
Share on other sites

  • 3 weeks later...
On 14/01/2017 at 3:55 PM, lramos15 said:

Can someone let me know what the 3 values for velocity represent, I try to find the values they relate to in game but I'm unable to 

They are the x, y and z components of the velocity vector, in meters per second. This is worth a read: http://mathworld.wolfram.com/VelocityVector.html

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Version 0.3.8 has been released :)

Here's a summary of the changes:

A full changelog is available here: https://github.com/krpc/krpc/releases/tag/v0.3.8

Link to comment
Share on other sites

  • 2 weeks later...
On 19/04/2017 at 0:55 PM, Jamesstewart97 said:

Just wondering if there is any way to get KRPC working on Mac OS?

Should do, although I've not tested it, and don't have access to a Mac OS machine to test. There is nothing in the code for any of the clients or the server that's Windows/Linux specific, so should work.

 

16 hours ago, Thertor said:

Is it possible to get the state of the SAS (If it's on or off), and then print out a message if it is?

Indeed it is! Here's an example using the python client:

import krpc
conn = krpc.connect()
control = conn.space_center.active_vessel.control
if control.sas:
    print 'SAS is enabled'
else:
    print 'SAS is disabled'

The documentation for the Control class containing this functionality is here: https://krpc.github.io/krpc/python/api/space-center/control.html

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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...