Jump to content

Science Classes?


Recommended Posts

I've been poking around here in my preparation to write a random science log generator, but I can't find any information on the science logs themselves. Any help appreciated greatly!

Newbie coder in C#, beware! Lots of experience in VB tho, don't know if that means anything

IMMEDIATE EDIT: Just found them :) I'm guessing that what I'd need to do is write first a random text generator in C# (not that much of a test of skills for me), and have the results write to the ScienceExperiment.experimentTitle string on OnActive() or whatever function initiates the science experiment.

Another edit: First time coding for KSP. Might hop on #KSPmodders for help, but at the moment I've got to set up the IDE

Edited by DuoDex
Link to comment
Share on other sites

Good stuff, sounds like you're well on your way :) I'd suggest a mod that messes with science stuff for some source for you to poke through, but it's not something I tend to mess with.

Loads of people helped me out when I was learning C# and finding my way around the KSP/Unity API's, so shout if you need help. Good hunting and happy coding!

Link to comment
Share on other sites

The actual results printed onscreen are from ExperimentResultDialogPage.resultText. You can fetch the results for each experiment from a ScienceSubject ID (the experiment@KerbinSrfLanded string) using ResearchAndDevelopment.GetResults(SubjectID).

The results themselves are stored in the Results dictionary for each ScienceExperiment. But that dictionary is only accessible through a read-only property (ScienceExperiment.Results).

I'm not sure how you can add results to the dictionary without re-loading the science experiment definition config. And I'm not sure how to do that without breaking the science experiment dictionary used by ResearchAndDevelopment (the thing that gives the dictionary key errors if you try to load duplicate science experiments).

Link to comment
Share on other sites

The actual results printed onscreen are from ExperimentResultDialogPage.resultText. You can fetch the results for each experiment from a ScienceSubject ID (the experiment@KerbinSrfLanded string) using ResearchAndDevelopment.GetResults(SubjectID).

The results themselves are stored in the Results dictionary for each ScienceExperiment. But that dictionary is only accessible through a read-only property (ScienceExperiment.Results).

I'm not sure how you can add results to the dictionary without re-loading the science experiment definition config. And I'm not sure how to do that without breaking the science experiment dictionary used by ResearchAndDevelopment (the thing that gives the dictionary key errors if you try to load duplicate science experiments).

Well, crap. Maybe I can directly modify ExperimentResultDialogPage.resultText and bypass using the definition config. I'll have to have a look.

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