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

Missile Control Program (Edit the print/writes for a redstone control)

Started by Kadecamz, 15 August 2012 - 05:29 PM
Kadecamz #1
Posted 15 August 2012 - 07:29 PM
This is a code I made to launch missiles with the ICBM mod.


local code = "1337"
term.clear()
sleep(0.1)
term.setCursorPos(1,1)
print "Enter the code! Be sure the silo is powered."
write "CODE: " -- This is where code will be entered.
input = read()
if input == "1337" then
function success()
write "Accessing mainframe"
sleep (2)
write "."
sleep (2)
write "."
sleep(1)
write "."
sleep (1)
term.clear()
sleep(0.1)
term.setCursorPos(1,1)
print "Success! The missiles are firing in"
write "3"
sleep(1)
term.clearLine()
term.setCursorPos(1,2)
write "2"
sleep(1)
term.clearLine()
term.setCursorPos(1,2)
write "1"
sleep(1)
textutils.slowPrint ".....FIRING!!!!"
sleep(0.3)
rs.setOutput ("right", true)
print "Action complete"
sleep(2)
os.shutdown()
end
function fail()
term.clear()
term.setCursorPos(1,1)
sleep(0.1)
write "Failure has accoured."
sleep(3)
os.shutdown()
end
chance = math.random (1,5)
if chance == 1 then
success()
elseif chance == 2 then
success()
elseif chance == 3 then
success()
elseif chance == 4 then
fail()
elseif chance == 5 then
success()
end
elseif input == "modify" then
print "You may now modify the mainframe"
sleep(1)
elseif input == "abort" then
write "Aborting Files"
sleep(1)
write "."
sleep(1)
write "."
sleep(1)
write "."
sleep(0.5)
term.setCursorPos(1,5)
print "Successfully Aborted!"
sleep(3)
os.shutdown()
else
write "Accessing mainframe"
sleep(1)
write "."
sleep(1)
write "."
sleep(1)
write "."
term.clearLine()
term.setCursorPos(1,4)
print "Wrong code!"
sleep(3)
os.shutdown()
end





The code is '1337'
To edit it enter 'modify'
To abort (Just for coolness) enter 'abort'

I still need to know how to add paths, so that you'll get a certain question if you answer the first one correctly.
When I tried it always glitched for me.

I also used the wireless redstone mod to make it easier.
I can do a map upload, but you'll have to install forge, computercraft, wireless redstone, a furniture mod (Forgot who lol sorry), ICBM mod, universal electricity (Required for ICBM).
I would upload the world, but I believe that its over 500K.
I'll upload the file containing the script now. (Open with notepad)
Sorry if this post is a bit cluttered.
Sammich Lord #2
Posted 16 August 2012 - 02:43 AM
If you want to make it so you can have paths you can do this:

input = read()
while true do
  if input == "options"  then
    print("Please type: Changepass or cancel")
      if input == "changepass" then
        print("What would you like your new pass to be?")
        write("Newpass: ")
        file = io.open(".pass", "w")
        print("Password has been changed!")
      elseif input == "cancel" then
         break
      else
         print("Incorrect input.")
     end
  elseif input == "cancel" then
     break
  end
end
This is un-tested but this should work.