Advertisement
purplemonday

Untitled

Feb 24th, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. function drawbox (obj,color,posx,posy,sizex,sizey)
  2. for x=0,sizex do
  3. for y=0,sizey do
  4. obj.setCursorPos(posx+x,posy+y)
  5. obj.setBackgroundColour(color)
  6. obj.write(" ")
  7. end
  8. end
  9. end
  10. function visual_temp(obj,label,c1,c2,value,scale,posx,posy,sizex,sizey,units)
  11.  
  12. if sizey > sizex then
  13. else
  14. print ("room of bar "..sizex)
  15. howmuch = value/scale
  16. print (howmuch)
  17. bstr=""
  18. howmuch = math.ceil(howmuch * sizex)
  19. text = label.." "..value..units
  20. printamount = howmuch
  21. if string.len(text) > howmuch then
  22. printamount = string.len(text)
  23. end
  24. for a= 0,printamount do
  25. if howmuch > a then
  26. obj.setBackgroundColor(c2)
  27. obj.setTextColor(c1)
  28. else
  29. obj.setBackgroundColor(c1)
  30. obj.setTextColor(c2)
  31. end
  32.  
  33. obj.setCursorPos(posx+a,posy)
  34. if a < string.len(text) then
  35. obj.write(string.sub(text,a,a))
  36. else
  37. obj.write(" ")
  38. end
  39.  
  40. end
  41. obj.setCursorPos(posx,posy)
  42. end
  43. end
  44.  
  45.  
  46. function show_side(obj,array,c1,c2)
  47.  
  48. msx, msy = obj.getSize()
  49. for a= 1, table.getn(array) do
  50. if type(array[a]) =="table" then
  51. g = array[a]
  52. print (g[1].." "..g[2].." "..g[3])
  53. visual_temp(obj,g[1],c1,c2,g[2],g[3],1,msy-a,msx,o,g[4])
  54. elseif type(array[a]) =="string" then
  55. obj.write(array[a])
  56. end
  57. end
  58. end
  59. fakeobj ={"reactor",{"case",200,2000,"C"},
  60. {"feul",300,2000,"C"},
  61. {"steam/t",2222,1600,"mb/t"},
  62. "turbine",{"rpm",1800,2000,"Rpm"},
  63. {"energy",404030,1000000,"RF"},
  64. {"valve",1500,2000,"mb"}
  65. }
  66.  
  67. monitor = peripheral.wrap("left")
  68. monitor.setTextScale(0.5)
  69. monitor.setBackgroundColor(colors.black)
  70. monitor.setTextColor(colors.white)
  71. monitor.clear()
  72. monx,mony = monitor.getSize()
  73. show_side(monitor,fakeobj,colors.white,colors.black)
  74. --lors.black,colors.white,100*a,2000,1,mony-a,monx,0,"C")
  75. --drawbox (monitor,colors.red,4,4,10,10)
  76. --drawbox (term,colors.red,4,4,10,10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement