Advertisement
ndfjay

block revision

Jan 14th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local w,h = term.getSize()
  2. local function draw()
  3.     term.clear()
  4.     term.setCursorPos(math.floor(w/2) - 11,1)
  5.     print("Welcome to block caller")
  6.     term.setCursorPos(math.floor(w/2) - 6,2)
  7.     print("By AnthonyD98")
  8.     term.setCursorPos(1,4)
  9.     print("Blocks: ")
  10.     print("       - basalt, basalt_cobble, marblebrick")
  11.     print("       - cobblestone, stonebrick, brick, dirt")
  12.     print("       - basaltbrick, sandstone, sand")
  13. end
  14.  
  15. local blocks = {
  16.     "basalt","basalt_cobble","marblebrick","cobblestone","stonebrick","brick","dirt","basaltbrick","sandstone","sand"
  17. }
  18.  
  19. local bColor = {
  20.     512,2048,16348,4,16,2,32,8192,4096,8
  21. }
  22.  
  23. while true do
  24. local cor = 0
  25. draw()
  26. term.setCursorPos(1,10)
  27. write("Please input the block you want >> ")
  28. iBlock = read()
  29.     if iBlock == "exit" then
  30.     term.clear()
  31.     term.setCursorPos(1,1)
  32.     return
  33. end
  34. write("Please input the ammount you want >> ")
  35. number = read()
  36.     if number == "exit" then
  37.         term.clear()
  38.         term.setCursorPos(1,1)
  39.         return
  40.     end
  41. print("Matching input to color")
  42.         for i,v in ipairs(blocks) do
  43.             if iBlock == v then
  44.             local cor = 1
  45.             term.clear()
  46.             term.setCursorPos(1,1)
  47.             print("Block and Color Matched!")
  48.             term.setCursorPos(1,2)
  49.             print("Block = "..iBlock.." and color = "..tostring(bColor[tonumber(i)]))
  50.                 for j = 1,number do
  51.                     rs.setBundledOutput("back", bColor[i])    
  52.                     sleep(0.500)
  53.                     rs.setBundledOutput("back", 0)
  54.                     sleep(0.500)
  55.                     term.setCursorPos(1,3)
  56.                     term.clearLine()
  57.                     print("Pulse: "..j)
  58.                 end
  59.             else
  60.             term.clear()
  61.             term.setCursorPos(1,1)
  62.             print("Matching Block to Cable")
  63.             term.setCursorPos(1,2)
  64.             print("Block = "..tostring(v).." and color = nil")
  65.             sleep(.1)
  66.             end
  67.         end
  68.         if cor == 0 then
  69.         term.clear()
  70.         term.setCursorPos(1,1)
  71.         print("Invalid Block Selection")
  72.         sleep(2)
  73.         end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement