XylianLP

Autospawner Computer

Aug 29th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local modem = peripheral.wrap("back")
  2. local mtop = peripheral.wrap("top")
  3. local mleft = peripheral.wrap("left")
  4. status = 0
  5. channel = 1
  6. replyChannel = 2
  7. modem.open(1)
  8.  
  9. function cls()
  10. term.clear()
  11.   term.setCursorPos(1,1)
  12.   print("Autospawner Computer")
  13.   if(status == 0) then
  14.   print("Autospawner: ACTIVE")
  15.   else
  16.   print("Autospawner: deactivated")
  17.   end
  18.   print(" ")
  19. end
  20.  
  21. function definemob(mob)
  22. nmob = tonumber(mob)
  23. if nmob == 1 then
  24. return "pig"
  25. else
  26. return "ERROR"
  27. end
  28. end
  29.  
  30. redstone.setOutput("bottom", true)
  31. cls()
  32.  
  33. while true do
  34. print(" ")
  35. write(": ")
  36. text = io.read()
  37. text_number = tonumber(text)
  38.  
  39. if text_number == nil then
  40.   if text == "on" then
  41.   redstone.setOutput("bottom", true)
  42.   status = 0
  43.   cls()
  44.   else if text == "off" then
  45.   redstone.setOutput("bottom", false)
  46.   status = 1
  47.   cls()
  48.   else if text == "clear" then
  49.   cls()
  50.   else
  51.   print("invalid input")
  52.   print(" ")
  53.   end
  54.   end
  55.   end
  56. else if text_number >= 1 then
  57.   if text_number <= 16 then
  58.     modem.transmit(channel, replyChannel, text)  -- modem.transmit(number channel, number replyChannel, any message)
  59.     print("Spawner changed to: ", definemob(text))
  60.     mtop.print("Spawner changed to: ", definemob(text))
  61.   end
  62.   end
  63. end
  64.  
  65.  
  66. sleep(1)
  67. end
Advertisement
Add Comment
Please, Sign In to add comment