Advertisement
Guest User

monitorBar

a guest
Nov 28th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. tArgs = {...}
  2.  
  3. monitor = peripheral.wrap("left")
  4.  
  5. if(tArgs[1]=="level") then
  6.   level = 15-tonumber(tArgs[2])
  7.  
  8.   for i=0,15 do
  9.     monitor.setCursorPos(2,i+5)
  10.    
  11.     if(level<=i) then
  12.       monitor.setBackgroundColor(colors.red)
  13.     else
  14.       monitor.setBackgroundColor(colors.black)
  15.     end
  16.     monitor.write("             ")
  17.    
  18.   end
  19. elseif(tArgs[1]=="init") then
  20.   monitor.setBackgroundColor(colors.white)
  21.   monitor.clear()
  22.  
  23.   monitor.setTextScale(0.5)
  24.  
  25. -- for i=1,24 do
  26. --   monitor.setCursorPos(1,i)
  27. --   monitor.write("   "..tostring(i))
  28. --   end
  29.  
  30. --  monitor.setBackgroundColor(colors.white)
  31.  
  32. --  monitor.setCursorPos(1,4)
  33. --  monitor.write("               ")
  34.  
  35. --  monitor.setCursorPos(1,21)
  36. --  monitor.write("               ")
  37.      
  38. --  for i=1,16 do
  39. --    monitor.setCursorPos(1,i+4)
  40. --    monitor.write(" ")
  41. --    monitor.setCursorPos(15,i+4)
  42. --    monitor.write(" ")
  43. --  end
  44.  
  45.  
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement