Advertisement
guitarplayer616

Cook UI

May 29th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.38 KB | None | 0 0
  1. local w, h = term.getSize()
  2. term.setBackgroundColor(colors.black)
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. turtle.select(1)
  6. local d,f = 1,1
  7.  
  8. if not fs.exists("flame.nfp") then
  9.   shell.run("pastebin get uZVN5U2Y flame.nfp")
  10. end
  11.  
  12. function words(string, x, y, txtcol, bakcol)
  13.   if txtcol then
  14.     term.setTextColor(txtcol)
  15.   end
  16.   if bakcol then
  17.     term.setBackgroundColor(bakcol)
  18.   end
  19.   if not tonumber(x) and x then
  20.     if string.sub(x, 0, 1) == "l" then
  21.       if x == "l" or x == "left" then
  22.         term.setCursorPos(1, y)
  23.       elseif string.sub(x, 3, 3) == "+" or string.sub(x, 6, 6) == "+" then
  24.         offset = tonumber(string.sub(x, 5, 5)) or tonumber(string.sub(x, 8, 8))
  25.         term.setCursorPos(1 + offset, y)
  26.       end
  27.     elseif string.sub(x, 0, 1) == "c" then
  28.       if x == "center" or x == "c" then
  29.         term.setCursorPos(w / 2 - #string / 2 + 1, y)
  30.       elseif string.sub(x, 3, 3) == "+" or string.sub(x, 8, 8) == "+" then
  31.         offset = tonumber(string.sub(x, 5, 5)) or tonumber(string.sub(x, 10, 10))
  32.         term.setCursorPos(w / 2 - #string / 2 + 1 + offset, y)
  33.       elseif string.sub(x, 3, 3) == "-" or string.sub(x, 8, 8) == "-" then
  34.         offset = tonumber(string.sub(x, 5, 5)) or tonumber(string.sub(x, 10, 10))
  35.         term.setCursorPos(w / 2 - #string / 2 + 1 - offset, y)
  36.       end
  37.     elseif string.sub(x, 0, 1) == "r" then
  38.       if x == "right" or x == "r" then
  39.         term.setCursorPos(w - #string + 1, y)
  40.       elseif string.sub(x, 3, 3) == "-" or string.sub(x, 7, 7) == "-" then
  41.         offset = tonumber(string.sub(x, 5, 5)) or tonumber(string.sub(x, 9, 9))
  42.         term.setCursorPos(w - #string + 1 - offset, y)
  43.       end
  44.     end
  45.   else
  46.     term.setCursorPos(x, y)
  47.   end
  48.   term.write(string)
  49. end
  50.  
  51. local flameImg = paintutils.loadImage("flame.nfp")
  52. if not fs.exists("*crafting") then
  53.   oTemp = fs.open("*crafting", "w")
  54.   oTemp.writeLine("c7cccccc7c")
  55.   oTemp.writeLine("700c00c007")
  56.   oTemp.writeLine("c00c00c00c")
  57.   oTemp.writeLine("cccccccccc")
  58.   oTemp.writeLine("c00c00c00c")
  59.   oTemp.writeLine("c00c00c00c")
  60.   oTemp.writeLine("cccccccccc")
  61.   oTemp.writeLine("c00c00c00c")
  62.   oTemp.writeLine("700c00c007")
  63.   oTemp.writeLine("c7cccccc7c")
  64.   oTemp.flush()
  65.   oTemp.close()
  66. end
  67. if not fs.exists("*smelting") then
  68.   oTemp = fs.open("*smelting", "w")
  69.   oTemp.writeLine("7777777777")
  70.   oTemp.writeLine("77ffffff77")
  71.   oTemp.writeLine("7ffffffff7")
  72.   oTemp.writeLine("7ffffffff7")
  73.   oTemp.writeLine("7777777777")
  74.   oTemp.writeLine("8888888888")
  75.   oTemp.writeLine("88ee4e1e88")
  76.   oTemp.writeLine("81e41ee4e8")
  77.   oTemp.writeLine("8ee1e4e148")
  78.   oTemp.writeLine("8888888888")
  79.   oTemp.flush()
  80.   oTemp.close()
  81. end
  82. local craftImg = paintutils.loadImage("*crafting")
  83. local smeltImg = paintutils.loadImage("*smelting")
  84.  
  85. while true do
  86.   term.setBackgroundColor(colors.black)
  87.   term.clear()
  88.   paintutils.drawImage(flameImg,d,f)
  89.   paintutils.drawImage(craftImg, 1, 1)
  90.   paintutils.drawImage(smeltImg, w - 9, 1)
  91.   local e = {os.pullEvent()}
  92.   if e[1] == "key" and e[2] == 203 then
  93.     d = d - 1
  94.   elseif e[1] == "key" and e[2] == 205 then
  95.     d = d + 1
  96.   elseif e[1] == "key" and e[2] == 200 then
  97.     f = f - 1
  98.   elseif e[1] == "key" and e[2] == 208 then
  99.     f = f + 1
  100.   elseif e[1] == "key" and e[2] == 56 then
  101.     shell.run("pastebin run X30igzdu")
  102.   elseif e[1] == "key" and e[2] == 28 then
  103.     write(d.." "..f)
  104.     sleep(1)
  105.   end
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement