This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KillaVanilla's profile picture

ICBM Launch Control System

Started by KillaVanilla, 18 August 2012 - 12:33 AM
KillaVanilla #1
Posted 18 August 2012 - 02:33 AM
After seeing Kadecamz's Missile control system, I decided to post my own:

keyHandle = fs.open("disk/verify", "r")
key = keyHandle.readLine()
print("Press any key to continue to launch sequence.")
while true do
event = os.pullEvent()
if event == "key" then
  break
end
end
if key == "A5 C5 B2 F7 E3" then
print("Key Verified.")
os.sleep(1)
print("Confirm Launch (Y/N)>")
confirm = io.read()
if confirm == "y" or confirm == "Y" then
  term.clear()
  term.setCursorPos(1,1)
  term.write("Enter launch code: ")
  launchCode = io.read()
  if launchCode == "ATCDIN255" then
   print("Cancel launch with Ctrl+T.")
   print("Launching in ten seconds...")
   print("T-minus 10 seconds to launch.")
   os.sleep(1)
   print("T-minus 9 seconds to launch.")
   os.sleep(1)
   print("T-minus 8 seconds to launch.")
   os.sleep(1)
   print("T-minus 7 seconds to launch.")
   os.sleep(1)
   print("T-minus 6 seconds to launch.")
   os.sleep(1)
   print("T-minus 5 seconds to launch.")
   os.sleep(1)
   print("T-minus 4 seconds to launch.")
   os.sleep(1)
   print("T-minus 3 seconds to launch.")
   os.sleep(1)
   print("T-minus 2 seconds to launch.")
   os.sleep(1)
   print("T-minus 1 seconds to launch.")
   os.sleep(1)
   print("T-minus 0 seconds to launch.")
   os.sleep(1)
   print("Firing missile.")
   redstone.setOutput("back", true)
   rednet.open("top")
   rednet.broadcast("ATCDIN255")
   print("Launch code transmitted.")
   print("Automated silos firing.")
   os.sleep(1)
   redstone.setOutput("back", false)
   print("Missile launched.")
  else
   print("Invalid launch code.")
   os.shutdown()
  end
else
  print("Cancelling launch...")
  os.sleep(2)
  os.shutdown()
end
else
print("Invalid key.")
os.sleep(2)
os.shutdown()
end

It has 2 methods of authentication: password/launch code and and a disk drive-based password.
It checks the first floppy for a file named "verify" with a special code inside. If that check passes, it asks for a launch code, and checks to see if it's the right one. If that passes, it activates the back redstone output, and it broadcasts the launch code on rednet, so that a separate piece of software can recieve it and launch their missiles.
KronixGames #2
Posted 18 August 2012 - 02:36 AM
good script
computercraftrules89 #3
Posted 05 November 2012 - 06:40 AM
How do you use these


ComputerCraft
Missile launchers (both cruise and conventional) can be controlled with a ComputerCraft computer. Functions avaliable are:

launch() - Launchs the missile to the target.
getTarget() - Returns a table with the 3 value of the coord.
setTarget(x, y, z) - Sets the target to the specific coord.
setFrequency(frequency) - Sets the frequency of the launcher of it if it is tier three.
getFrequency() - Gets the frequency of the launcher.
Radars will also be able to return detected missile coords and such as long as it is powered by electricity.

getMissiles() - Gets all detected missiles from this radar station and returns a table with the coordinates for each of them. Table orders in x, y, z per missile.
getRadars() - Gets all detected radars from this radar station and return a table with the coordinates for each of them. Table orders in x, y, z per radar.
ICBM peripherals need to be controlled in a specific way. You have to first place a computer next to an ICBM peripheral. Then type in the command:

p = peripheral.wrap("left")
Leo Verto #4
Posted 05 November 2012 - 07:47 AM
Nice script, but you could've used a for loop for the countdown.
BigSHinyToys #5
Posted 05 November 2012 - 08:04 AM
How do you use these


ComputerCraft
Missile launchers (both cruise and conventional) can be controlled with a ComputerCraft computer. Functions avaliable are:

launch() - Launchs the missile to the target.
getTarget() - Returns a table with the 3 value of the coord.
setTarget(x, y, z) - Sets the target to the specific coord.
setFrequency(frequency) - Sets the frequency of the launcher of it if it is tier three.
getFrequency() - Gets the frequency of the launcher.
Radars will also be able to return detected missile coords and such as long as it is powered by electricity.

getMissiles() - Gets all detected missiles from this radar station and returns a table with the coordinates for each of them. Table orders in x, y, z per missile.
getRadars() - Gets all detected radars from this radar station and return a table with the coordinates for each of them. Table orders in x, y, z per radar.
ICBM peripherals need to be controlled in a specific way. You have to first place a computer next to an ICBM peripheral. Then type in the command:

p = peripheral.wrap("left")

first you wrap the devices controls to a variable so you can call them then you use them like any other function example
example

local launcher = peripheral.wrap("left") -- launcher on left side
launcher.launch() -- fires missile.

I have not tried this yet but it should work like that.
Leo Verto #6
Posted 05 November 2012 - 08:32 AM
first you wrap the devices controls to a variable so you can call them then you use them like any other function example
example

local launcher = peripheral.wrap("left") -- launcher on left side
launcher.launch() -- fires missile.

I have not tried this yet but it should work like that.
It's fixed, he posted this on another thread, turned out he used an old ICBM version without CC integration.
KillaVanilla #7
Posted 06 November 2012 - 03:08 PM
Nice script, but you could've used a for loop for the countdown.

This is from the olden days where I was new to Lua.
Then again, I had used C++ before and used for loops, but I have no idea why I didn't do so here…
Oh well. There's a new type of control system that's much better.