Advertisement
Guest User

smeltcontrol

a guest
Oct 13th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. rednet.open("back")
  2. local option = {"drain - Start draining", "amount - Amount smeltery", "clear - Clear screen"}
  3.  
  4. while true do
  5.   local uinput = nil
  6.   print("What to do?")
  7.   uinput = read()
  8.  
  9.   if uinput == "options" then
  10.     print("Your current options are: ")
  11.     for k,v in pairs(option) do
  12.       print(v)
  13.     end
  14.   end
  15.  
  16.   if uinput == "clear" then
  17.     term.clear()
  18.     term.setCursorPos(1,1)
  19.   end
  20.  
  21.   if uinput == "drain" then
  22.     rednet.send(3,"drain")
  23.     print("Start the draining!")
  24.     local senderId, message = rednet.receive()
  25.     if message == "starting" then
  26.       while true do
  27.         sleep(1)
  28.         print("Waiting...")
  29.         event, senderId, message = os.pullEvent("rednet_message")
  30.         if message == "done" then
  31.           print("Done with draining")
  32.           sleep(2)
  33.           break
  34.         end
  35.       end
  36.     end
  37.     term.clear()
  38.     term.setCursorPos(1,1)
  39.   end
  40.  
  41.   if uinput == "amount" then
  42.     info = { }
  43.     print("Waiting for information")
  44.     print("-----------------------")
  45.     rednet.send(3,"amounts")
  46.     local senderId, message = rednet.receive()
  47.     info = textutils.unserialize(message)
  48.     for i=1, #info do    
  49.       print(info[i])
  50.     end
  51.   end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement