Jump to content

Payload

Members
  • Posts

    433
  • Joined

  • Last visited

Everything posted by Payload

  1. No because the loop isn't executed until it's falling 200 above radar alt because the previous loop doesn't break until then. To be frank about it. If you are anywhere near orbit and you have some loop from a landing program checking for vertical speed less than that, then you are doing something way wrong. Also now we can have compound if. If alt:radar is < x and vertical speed is < x { set landed to 1 }. Checks for both conditions. Here is the whole thing. Simple lander test. This style is called lasagna. It uses more drive space but everything is compartmentalized so it's easy to debug and expand. clearscreen. set landed to 0. print "Five Seconds Until Liftoff!". wait 5. lock throttle to 1. stage. wait 1. stage. toggle gear. set Ralt to alt:radar. until Ralt > 2500 { set Ralt to alt:radar. lock throttle to 1. lock steering to up + R(0,0,180). if verticalspeed > 100 { lock throttle to 0. }. }. until Ralt < 1000 { set Ralt to alt:radar. lock steering to up + R(0,0,180). if verticalspeed > -100 { lock throttle to 0. }. if verticalspeed < -100 { lock throttle to 1. }. }. until Ralt < 100 { set Ralt to alt:radar. lock steering to up + R(0,0,180). if verticalspeed > -30 { lock throttle to 0. }. if verticalspeed < -30 { lock throttle to .75. }. }. toggle gear. until landed = 1 { set Ralt to alt:radar. lock steering to up + R(0,0,180). if verticalspeed > -2 { lock throttle to 0. }. if verticalspeed < -2 { lock throttle to .75. }. if Ralt < 3.5 { set landed to 1. }. }. Ok we need a separate thread for these script discussions guys. Lets get one setup in the science area. Perhaps a collaborative works thread to set up a basic UI autopilot. We can all have modules to do and discuss the methodology there.
  2. Why are you trying to check for landed anyway? It's just the status of your ship according to the game. You need to set your own landed condition. until landed = 1 { set Ralt to alt:radar. lock steering to up + R(0,0,180). if verticalspeed > -2 { lock throttle to 0. }. if verticalspeed < -2 { lock throttle to .75. }. if Ralt < 3.5 { set landed to 1. }. }. Before we had radar alt I was using if verticalspeed < -.2 { set landed to 1. }. and that worked just fine. About the string concatenation, see if this works for you. I tried concatenation in the console and it worked. When I run the program it always fails at the same line. print "Select your orbit altitude.". print "--------------------------------". print " ". print "Default orbit alt is set to " + tOrbit. print " ". print "Use action group 9 to add 10Km to orbit alt.". print " ". print "Use action group 8 to remove 10Km from orbit alt.". print " ". print "Use action group 7 to confirm orbit alt.". For me program always halts at t of tOrbit. Very strange. I suspect it may be because the arrangement or the blank lines. Even when I type this in console print "Default orbit alt is set to " + tOrbit. I get a fail. Yes I initialized tOrbit first just to be sure. Try it yourself. Unless there are more than one version 4.4. something is amiss. What now we cant use variables that start with "T".? HAHAHAHA
  3. Check for another break condition. Such as.... ON AG9 SET X TO 1. UNTIL X = 1 { do this }. I posted an example script a few pages ago that has examples of a working UI. If you are relying on BREAK to exit loops you are doing it wrong anyway. Loops should always have a breakout planned before you even put anything in them.
  4. you have version 4.4? I was using version 4.2 just this morning. I wrote the script and it worked just fine. I exited the game and DLed the new 4.4 dll. No more worky. I didn't change a thing from the functioning script.
  5. I hate to be the bearer of bad news or bugs, however, string concatenation is bugged. print "Default orbit alt is set to " + tOrbit + "m". no longer works as of the newest version. It throws up an error when it gets to the t of tOrbit. Unrecognized term 't'. And I had just spent five minutes making my UI look all spiffy and everything. Darn. No more "m" at the end for now. EDIT: Well it's worse than that actually. It doesn't work at all anymore.
  6. Have you tried printing the throttle value? Maybe it's not what you expect. I'm not sure about the situation with the math right now. Kevin had stated that the divide and multiply were executing out of order. I would print that value over some seconds to make sure the math is correct. Also there is a value called verticalspeed. You can use that directly to hover in place. I setup an on/off hover and landing system that preforms flawlessly unless it has to cancel horizontal speed. There is obviously not a good way to do that right now. Also someone brought up earlier, the game is only single precision floating point. Could just be that small variance. Seems plausible. Also there is lagg to this. I learned really quickly that this wasn't a real time microprocessor like I was used to working with. My opinion, forget trying to set the throttle to anything other than 0 or 1. Check against a variable and set the throttle on if < and off if >. That is self regulating and your average height will only vary a few mm.
  7. Sweet noticed the update. Do nested If statements work now? If so... This crap just got real. Saving just updates the changes you made so the program will run with them. You have to copy the program to the archive. Using "Copy myprogram to archive." Conversely, you could just use an external editor like notepad or notepad++ and save as plain text to the archive. When you want to run the program all you have to do is "Copy my program from archive." then "Run my program." The programs are saved as txt files and it's really easy to manipulate them. Just make sure you put them in the archive folder or preform a copy to archive.
  8. Thankfully you weren't the only person to have this idea. What you are asking about already exists. It's called kOS scriptable auto pilot. It's in the addon release section of the forum. This is not really an auto pilot unless you program it to be. It's a programmable computer for KSP. I think it has access to most of the variables you are talking about. Maybe not solar array output but it does have access to the battery charge.
  9. What I want to know is who is going to write a plugin to play an alarm sound when it's toggled? We don't even need a model. We can use a dupe cfg from a rcs thruster. It kinda even looks like an alarm. I tried getting the light to play a sound but it was a no go. Squad broke standard sound loading a few updates ago. It will require a plugin as far as I know. The good thing is we need a generic sound module anyway. Firespitter's only works for engines. I know I'm not kevin but from my experience it does not work. If you want to check against a boolean, then you will have to use 0 or 1. I tried checking against True False for action groups and it failed. I had to use them as a trigger to set my boolean value to a variable.
  10. Ok guys.. Here is the example launch to orbit script that I have written. It does everything from auto staging to letting you set your orbit altitude with a user interface. There is an example craft that I have hosted on my clans website. Get it here. http://clansmokejaguar.enjin.com/forums/m/423292/viewthread/8558153-thread-for-hosting-ksp-crafts/page/1 Modparts: B9 red light. Novapunch NP_lfe_125m_berthaminiquad engine. kOS version .43. Scroll down to under the chat box. You will see the post. You will have to sign up for the site but it's the best I can do. At least you wont get spammed and I don't have to make a dummy e-mail to signup for media fire. FOR THE UI TO WORK YOU MUST NOT HAVE FOCUS ON THE kOS TERMINAL. Once you run the script it will tell you how to set your orbit altitude. Click outside the terminal window and set your orbit with the keys instructed. This craft has one B9 red light on it. Other than the kOS computer, the rest is stock. EDIT: I forgot it also has a nova punch engine on it. Sorry. The light is required to function. I challenge you to learn why and to gain understanding of this very rudimentary method of user input. Here is the script. It's ugly. Without most of the operators I am used to working with and without nested "IF" support, it's what I have come up with. Please don't hate. Just Update. The power is in your hands. clearscreen. set rpAlt to 100. set rProgram to 90. set r to 180. set p to 0. set y to 0. set orbit to 0. set tOrbit to 100000. set hAtmo to 69500. set tAngle to up + R(y,p,r). set tThr to 1. set turn1 to 9999. set turn2 to 14999. set turn3 to 19999. set turn4 to 24999. set turn5 to 49000. set selection to 0. set flagup to 0. set flagdown to 0. set confirm to 0. set autoliquid to 0. set autosolid to 0. print "Select your orbit altitude.". print "--------------------------------". print " ". print "Default orbit alt is set to 100km.". print " ". print "Use action group 9 to add 10Km to orbit alt.". print " ". print "Use action group 8 to remove 10Km from orbit alt.". print " ". print "Use action group 7 to confirm orbit alt.". until selection = 1 { on ag9 set flagup to 1. on ag8 set flagdown to 1. on ag7 set confirm to 1. if flagup = 1 { clearscreen. set tOrbit to tOrbit + 10000. print tOrbit. toggle ag9. set flagup to 0. }. if flagdown = 1 { clearscreen. set tOrbit to tOrbit - 10000. print tOrbit. toggle ag8. set flagdown to 0. }. if confirm = 1 { clearscreen. print "You have confirmed " + tOrbit. print "Begin countdown.". toggle ag7. set confirm to 0. wait 5. set selection to 1. }. }. set cAlt to tOrbit - (tOrbit*.2). set xAlt to tOrbit - 1000. set hAlt to tOrbit - 5. clearscreen. print "Orbit altitude set to " + tOrbit. print "3". wait 1. print "2". wait 1. print "1". Wait 1. Print "Lift Off!". stage. lock steering to tAngle. lock throttle to tThr. when altitude > rpAlt then { set r to rProgram. print "Roll Program". }. when altitude > turn1 then set p to -35. when altitude > turn2 then set p to -45. when altitude > turn3 then set p to -60. when altitude > turn4 then set p to -75. when apoapsis > turn5 then set p to -90. when apoapsis > tOrbit then { { set tThr to 0. }. until altitude > hAtmo { if apoapsis < hAlt { set tThr to .05. }. if apoapsis > tOrbit { set tThr to 0. }. }. when Eapoapsis < 1 then set tThr to 1. }. when periapsis > cAlt then set tThr to .05. when periapsis > xAlt then { set tThr to 0. sas on. print "You Are Now In Orbit". wait 1. set orbit to 1. }. until orbit = 1 { set StageLiquid to stage:liquidfuel. set StageSolid to stage:solidfuel. set Eapoapsis to eta:apoapsis. set tAngle to up + R(y,p,r). set throttle to tThr. if StageLiquid > 0 { set autoliquid to 1. }. when autoliquid = 1 then { if StageLiquid < 1 { stage. }. }. if StageLiquid = 0 { set autoliquid to 0. }. if StageSolid > 0 { set autosolid to 1. }. when autosolid = 1 then { if StageSolid < 1 { stage. }. }. if StageSolid = 0 { set autosolid to 0. }. }. Have fun. Make it better!
  11. That is because it tanks on those. You will need to make a variable and wrap it in an until loop. like until condition = 1 { set StageSolid to stage:solidfuel. }. The problem is now how do you wrap all the things that are dynamic into that loop? The good thing is that isn't too hard. I'm working on a pretty dynamic launch to orbit script right now that I will release for you all to fondle to your hearts desire in a little while. I am still working on the UI. It's a little wonky and crappy right now though it does function. Then you all will have a solid if ugly example.
  12. My world for an autoexec.txt. I could easily run a simple UI OS with that. I already have a working UI for my launch to orbit script. It only lets you scroll through preset values and select one but it could easily be expanded.
  13. You can already do most of those things with this mod. This mod isn't for people who want to push buttons. It's for people who want to do things their own way and aren't afraid to write some script to get there. It can already activate or deactivate anything that has an Action group. I have a perfectly functioning ascent and orbit script. Hohmann transfers are easy. It's just a flat burn then circ at apoap or periaps whatever you prefer. Because it can toggle action groups it can already interact with Infernal robotics. The external editor is called notepad. The scripts are stored in a folder called Archive in plain text. Seems like everything you are asking for is already here but for the remote tech thing. I am not sure what it would take to get this working over remote tech link and I don't care to speculate. I would be nice if it did. Then you could program your movements in advance.
  14. No bro.. Set the numbers to purple or something. Yellow on white is harsh. Dat green... Too green. Try a darker color. Other than that. I would love to have this. Would have saved me some headaches.
  15. I just made an Archive folder and it stared working Of course. I will grab that one. Also stage:resource have stopped working in expressions since the older version. A script that put me into orbit at least five times last night is calling an error on those now. On the bright side. Formatting now appears to be preserved. That was killing me. EDIT: OK upon further investigation. It is any variable with a colon : is no longer working in expression. I had to wrap up all of my stage:resource and eta:somethings in variables in the main loop to keep them updated. Not sure what happened to that but it was working before. EDIT: Ok to clarify a little more. They do work when they are followed by a terminator. In cases such as set Ralt to alt:radar.. However, in cases such as if alt:radar > 0 {do something}. the parser throws a hissy. That worked perfectly fine in the last version. Not a huge deal but having to constantly update a value my self when there is direct access seems like a waste.
  16. I think you uploaded the wrong version. This thing can't read .txt files and it says its version 17xxx something. Unless I'm putting them in the wrong place... You just said apropriate folder in the video. You failed to mention if that was the same folder as the arc was or what. Also I had to remove the arc file or else it locked the little screen and wouldn't let me exit the game normally. Edit Ok. I guess I missed it the first time but I see it in the video now. Trying that.
  17. Sweet!! Could you give some example of how you would keep a craft oriented to opposite the direction of travel? I tried retrograde but that seems to mean west. My landing auto pilot works just fine straight up and down. Maybe if I was in an obit inclined to 0. canceling horizontal velocity I haven't been able to wrap my head around aside from trying to track lat and long and horizontal speed in some meaningful way. I think that is a little beyond me at this point.
  18. I have mechjeb and all sorts of mods like firespitter and procedural everything. Etc... I haven't had too many problems other than realizing I need to move a whole section from the top to the bottom because my stupid brain wrote it out of order. The whole loop at the bottom and one time trigger thing is a little strange to me. My brain wants to put everything in a main loop. Then I find out the operators I need just don't exist. I hear you guys about the "and" thing. As many times as my brain has said " if this and that are true." Oh.. there is no and!
  19. "random jibberish". EDIT: Hmm I'm betting that the first number is vector N/S and the center is vector E/W and the third number is strictly roll. That is because of the modifier "up". Up is a body reference not just a gravity reference?
  20. I just can't wait until we get the plain text editor. Then we can go full nerd on this thing and have some amazing collaborative works. Like from reading someones script here earlier, I realized this thing has user input already in the form of action groups. I read it in the readme but it just didn't stick what could be done with it. We can make a launch computer that asks for values such as desired orbit and the like. We only need two keys for scrollable alpha numeric input.
  21. I am trying to add a simple wav file sound to a part to make it play while activated. No matter what I do the sound will not play when the part is activated. I have put the sound in the ksp/sounds and in squads folder in game data and in the mod folder in game data. // --- Sound FX definition --- sound_alarm.wav = active That is what I put in the config file. So what gives? I noticed everyone uses custom sound modules or just stock sounds. I just need to add a single sound to a part. I am not writing a plugin to do that. Tell me there is a generic sound module.
  22. You could do that. You just need different lights setup to play different sounds. HAHAH you could even make a beat machine!!! We can do this right now!!! No changes to anything are needed. EDIT: OK a bit of a wrench in the works. I can't get the sound to play at all. Apparently Squad broke sounds loading a while back and now you need a module to make it work. Uggghhhh.
  23. You know what I just realized? We need an alarm buzzer! How about a low fuel alarm or a low battery alarm? All it needs to be is a part that makes the sound of your choice when it's action group it toggled. Maybe even put a little flashing light on it. Hmm. I think I'll take the little B9 red light and do a little hacking...
  24. You just clock the moon when it goes over KSP and wait until you see it again. Do some maths and now you have a phase angle. The mun is on the same inclination as Kerbin in the game. You have a window every single orbit. As I said, you have a clock. You have all of the info you need. Also I played this game long before any kind of flight computer so I got really good at eyeballing the lift off time anyway.
×
×
  • Create New...