Jump to content

Is there a way to get multiple value at one param?


Efour

Recommended Posts

I'm making one simple PartModule mod, and I need to get multiple value like this format

 

module

{

    name=/*my_module*/

    param= 1, 0.5f

}

 

I tried this code :  But It didn't work.

[KSPField]
public float[] param = { 1, 0.25f };

 

can I receive value array from .cfg to KSPField? If so, where is my mistake?

 

(P.S : I'm sorry that  I did a mistake that choosing category of this thread. If I could change category.)

Edited by Efour
Link to comment
Share on other sites

[KSPField]
public Vector2 param = Vector2.zero; // or new Vector2(x, y) to change defaults

You can also use Vector3 and Vector4.  The alternative is to make param a string and parse the values yourself, but it's way easier to use Vec2/Vec3/Vec4 for simple numbers.

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