Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

Something new for kOS:

So how to use pieces of that for producing sounds with kOS?

Bizz I think you might be able to just mod a part to play a sound when it is activated by action group.

The sound playing function of KSP is a little weird right now requiring a very strange and specific directory structure to get it to work properly.

Check this out.

http://forum.kerbalspaceprogram.com/threads/53982-0-22-New-SRB-sounds

There is a full explanation of how to add custom sounds to KSP in the first post.

I tried to do this about a month ago but I didn't have that information available at the time.

I haven't tried this method but it is reported to work by lots of people for KSP .22.

Note: You may or may not have to configure the part as an engine with no thrust.

Edited by Payload
Link to comment
Share on other sites

Bizz I think you might be able to just mod a part to play a sound when it is activated by action group.

The sound playing function of KSP is a little weird right now requiring a very strange and specific directory structure to get it to work properly.

Check this out.

http://forum.kerbalspaceprogram.com/threads/53982-0-22-New-SRB-sounds

There is a full explanation of how to add custom sounds to KSP in the first post.

I tried to do this about a month ago but I didn't have that information available at the time.

I haven't tried this method but it is reported to work by lots of people for KSP .22.

Note: You may or may not have to configure the part as an engine with no thrust.

Not true! Simply not true.

This code is from chatterer and those sounds are in <KSP Folder>\GameData\RBR\Sounds

Well actually he sorted it up in the last version to chatterer, probe and sstv, but never the less its just for sorting them. It may be different if you use the KSP internal function that might be useful if you create a part and don't want to use a dll, hey wait don't we use already one?

Link to comment
Share on other sites

I've perused the wiki but I'm having trouble finding an answer.

When a craft unloads, the code its running ceases to function and does not restart with the computer when it is reloaded later on. Is there any way to modify or replace that startup functionality to have codes run when the craft loads? Such as to ensure a space station remains properly oriented to its parent planet or to keep a long-range missile on target.

Link to comment
Share on other sites

Not true! Simply not true.

This code is from chatterer and those sounds are in <KSP Folder>\GameData\RBR\Sounds

Well actually he sorted it up in the last version to chatterer, probe and sstv, but never the less its just for sorting them. It may be different if you use the KSP internal function that might be useful if you create a part and don't want to use a dll, hey wait don't we use already one?

What is not true? That you don't need a plugin to play custom sounds? Because you don't. I'm sorry I fail to see what is not true about what I posted. Who cares what chatterer does? It isn't required so why use it? You can create a part that plays custom sounds. You don't need a plugin to do it.

Link to comment
Share on other sites

It would be interesting if it consumed more power as the script/program becomes more intricate and complex or as many lines get added.

Having peeked at the github code it looks like there is a calculation that makes electrical drain depend on clock speed. The faster the clock rate the faster the electrical drain. But you don't notice that this calculation is taking place because currently there's only one kind of CPU with one hardcoded clock speed. It seems as if the groundwork is there to be able to support multiple different speeds of CPU in the future.

Link to comment
Share on other sites

I've perused the wiki but I'm having trouble finding an answer.

When a craft unloads, the code its running ceases to function and does not restart with the computer when it is reloaded later on. Is there any way to modify or replace that startup functionality to have codes run when the craft loads? Such as to ensure a space station remains properly oriented to its parent planet or to keep a long-range missile on target.

There appears to be code in the github source that deals with saving and restoring the program state when the craft goes on/off of rails. But I've had a lot of trouble getting it to behave right so I'm not sure that part works right yet. For example, I have one program that runs just fine as long as it stays within 2.2 km, but the moment I send a craft away form it and leave the 2.2 km distance and then turn around and come back to it, the entire KSP game bogs down as soon as it re-loads, dropping to a frame rate of less than 1/sec. I'm not sure what's happening but I assume something about the re-loading code isn't working right.

Link to comment
Share on other sites

I have a coding question.

I have the following:

SET tVal TO 1.
LOCK THROTTLE TO tVal.
LOCK tVal TO (MASS * 13)/MAXTHRUST.
STAGE.

When staged, both the launch clamp and engine are ignited, however the engine appears to lock into full throttle and doesn't alter based on the equation tVal is locked to.

Can anybody give me any insight as to why?

Link to comment
Share on other sites

Are you using KOS 0.84? it has problems with locking variables to variables, at least for me.

Instead of:

lock vel to velocity:orbit.

It does this:

set vel to velocity:orbit.

So it isn't adapting as it should, it just stays with the initial value.

Try using your code in a loop, and maybe it will work?

Link to comment
Share on other sites

I just installed the latest version and

lock throttle to 1.
isn't working for me... Anyone know what might be wrong?

Edit: I read some more and it looks like this is happening in .84. I'll try .7.

Edited by BahamutoD
Link to comment
Share on other sites

I just installed the latest version and isn't working for me... Anyone know what might be wrong?

Edit: I read some more and it looks like this is happening in .84. I'll try .7.

Is that the only line of code you have? Maybe there is an issue happening elsewhere in the program? Because that line by itself should work fine.

Link to comment
Share on other sites

Is that the only line of code you have? Maybe there is an issue happening elsewhere in the program? Because that line by itself should work fine.

Yeah, just with that line, nothing happens. And a print of the throttle value returns 0.

Everything I've tried so far seems to work in 0.7 though, and this thing is sweet! I can't wait to show off what I'm making when its done haha.

Link to comment
Share on other sites

This mod could save me so much stupdity with just one line of code.

Program name: UponVac

WHEN ALTITUDE > 69999 THEN TOGGLE AG10. // Open solar panels, because I forgot. Again.

or even

WHEN STATUS = "ORBITING" THEN TOGGLE AG10.

I run either of these and it just says program ended. I bet I am missing a parentheses somewhere. Altitude is ~68, status is prelaunch. What am I missing?

I would like to request two more parts, a TRS-80 Model 100 (my first laptop) [3.2k of storage and slower cpu] and a TRS-80 Pocket Computer (my first palmtop) [<1k of storage and snail-crawling cpu]. Because hauling the original to run one line of code sucks. You could have upgrades in the tech tree, for a decent laptop and a HP200 palmtop (man, I had so much fun with that thing). I would send you a TRS-80 Model 100 if you did this (yep, still have it and it still works.)

If each computer has to have 10k of room fill up the extra with a read-only file, maybe same interesting reading?

Link to comment
Share on other sites

Program name: UponVac

WHEN ALTITUDE > 69999 THEN TOGGLE AG10. // Open solar panels, because I forgot. Again.

or even

WHEN STATUS = "ORBITING" THEN TOGGLE AG10.

I run either of these and it just says program ended. I bet I am missing a parentheses somewhere. Altitude is ~68, status is prelaunch. What am I missing?

Both of these set up a trigger that will be executed when the condition is met.

Then the program ends, and the triggers it set up are wiped out.

You can run either of these lines outside of a program, and they should work. Or, you can set up a program such as:

WAIT UNTIL ALTITUDE > 69999.
TOGGLE AG10.

This sets up a waiting condition, and execution of the program will wait until that condition is true before stepping to the next line. (Of course, this means that your program will not do anything else until then. There are other ways to set it up, too.)

Link to comment
Share on other sites

It would be interesting if it consumed more power as the script/program becomes more intricate and complex or as many lines get added.

I feel like the change in power usage would be so minimal it wouldn't make much of a difference.

Link to comment
Share on other sites

No go on v0.85. Syntax Error on line 2.

Line 2 is a blank line.

Program runs fine in 0.71.

Also programs that would run just fine on 0.84 now exhibit the same behavior.

syntax error on random line number.

Shy of inserting a print statement after every line, there is no way to debug this.

EDIT: That wont work either. I set line 0 to...print "passed".

I still get the same error and it never prints passed.

Edited by Payload
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...