Guest User

control program

a guest
Sep 20th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. local function centerText(text)
  2. local x,y = term.getSize()
  3. local x2,y2 = term.getCursorPos()
  4. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  5. write(text)
  6.  
  7. while true do
  8.  term.clear()
  9.  term.setCursorPos(1,1)
  10.  print("Choose your color!")
  11.  print("Red, Blue, Yellow.")
  12.  input = read()
  13.  print("")
  14.  
  15.  
  16.  term.setCursorPos(1,1)
  17.  
  18.  if input == "red" then
  19.   while true do
  20.    term.clear()
  21.    print("On/Off")
  22.    print("")
  23.    input = read()
  24.    term.setCursorPos(1,1)
  25.    if input == "on" then
  26.     term.clear()
  27.     rs.setBundledOutput("back",colors.red)
  28.     print("Red Activated")
  29.     os.sleep(2)
  30.     term.clear()
  31.     term.setCursorPos(1,1)
  32.    end
  33.    end
  34.    elseif input == "off" then
  35.    term.clear()
  36.     rs.setBundledOutput("back",0)
  37.     print("Red Deactivated")
  38.     os.sleep(2)
  39.     term.clear()
  40.     term.setCursorPos(1,1)
  41.    end
  42.   end
  43.  end
  44.  
  45.  elseif input == "blue" then
  46.   while true do
  47.    term.clear()
  48.    print("On/Off")
  49.    print("")
  50.    input = read()
  51.    term.setCursorPos(1,1)
  52.    if input == "on" then
  53.     term.clear()
  54.     rs.setBundledOutput("back",colors.blue)
  55.     print("Blue Activated")
  56.     os.sleep(2)
  57.     term.clear()
  58.     term.setCursorPos(1,1)
  59.    end
  60.    end
  61.    elseif input == "off" then
  62.    term.clear()
  63.     rs.setBundledOutput("back",0)
  64.     print("Blue Deactivated")
  65.     os.sleep(2)
  66.     term.clear()
  67.     term.setCursorPos(1,1)
  68.    end
  69.   end
  70.  end
  71.  
  72.  elseif input == "yellow" then
  73.  term.clear()
  74.   while true do
  75.    term.clear()
  76.    print("On/Off")
  77.    print("")
  78.    input = read()
  79.    term.setCursorPos(1,1)
  80.    if input == "on" then
  81.     term.clear()
  82.     rs.setBundledOutput("back",colors.yellow)
  83.     print("Yellow Activated")
  84.     os.sleep(2)
  85.     term.clear()
  86.     term.setCursorPos(1,1)
  87.    end
  88.    end
  89.    elseif input == "off" then
  90.    term.clear()
  91.     rs.setBundledOutput("back",0)
  92.     print("Yellow Deactivated")
  93.     os.sleep(2)
  94.     term.clear()
  95.     term.setCursorPos(1,1)
  96.    end
  97.   end
  98.  end
  99.  
  100.  elseif input == "debug" then
  101.   while true do
  102.    term.clear()
  103.    term.setCursorPos(1,1)
  104.    print("Insert Password:")
  105.    term.setCursorPos(17,1)
  106.    input = read ("*")
  107.    if input == "bacon" then
  108.     term.clear()
  109.     term.setCursorPos(1,1)
  110.     print("Password correct!")
  111.     os.sleep(1)
  112.     term.clear()
  113.     break
  114.    else
  115.     term.clear()
  116.     term.setCursorPos(1,1)
  117.     print("Password incorrect!")
  118.     sleep(2)
  119.    end
  120.   end
  121.  end
  122.  
  123.  else print ("DA FUQ?!!?")
  124.  
  125. end
  126.  
  127.   --term.clear()
  128.   --centerText("What the hell are you on about?")
  129.   --os.sleep(2)
  130.  --end
  131. --end
  132. --end
Advertisement
Add Comment
Please, Sign In to add comment