Creeper9207

ENDI

May 19th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.60 KB | None | 0 0
  1. xc,yc = term.getCursorPos()
  2. back = colors.black
  3. args = {...}
  4. function dfb(x1,x2,y1,y2, c)
  5.   paintutils.drawFilledBox(x1,x2,y1,y2,c)
  6. end
  7. function hKK(c0,c1,c2,c3,c4)
  8. c0=tonumber(c0)
  9. c1=tonumber(c1)
  10. c2=tonumber(c2)
  11. c3=tonumber(c3)
  12.  if c4 == "white" then
  13.        dfb(c0,c1,c2,c3,colors.white)
  14.      elseif c4 == "magenta" then
  15.        dfb(c0,c1,c2,c3,colors.magenta)
  16.    elseif c4 == "light_blue" then
  17.        dfb(c0,c1,c2,c3,colors.lightBlue)
  18.    elseif c4 == "yellow" then
  19.        dfb(c0,c1,c2,c3,colors.yellow)
  20.    elseif c4 == "lime" then
  21.        dfb(c0,c1,c2,c3,colors.lime)
  22.    elseif c4 == "pink" then
  23.        dfb(c0,c1,c2,c3,colors.pink)
  24.    elseif c4 == "gray" then
  25.        dfb(c0,c1,c2,c3,colors.gray)
  26.    elseif c4 == "light_gray" then
  27.        dfb(c0,c1,c2,c3,colors.lightGray)
  28.    elseif c4 == "cyan" then
  29.        dfb(c0,c1,c2,c3,colors.cyan)
  30.    elseif c4 == "purple" then
  31.        dfb(c0,c1,c2,c3,colors.purple)
  32.    elseif c4 == "blue" then
  33.        dfb(c0,c1,c2,c3,colors.blue)
  34.    elseif c4 == "brown" then
  35.        dfb(c0,c1,c2,c3,colors.brown)
  36.    elseif c4 == "green" then
  37.        dfb(c0,c1,c2,c3,colors.green)
  38.    elseif c4 == "red" then
  39.        dfb(c0,c1,c2,c3,colors.red)
  40.    elseif c4 == "black" then
  41.        dfb(c0,c1,c2,c3,colors.black)
  42.    elseif c4 == "orange" then
  43.        dfb(c0,c1,c2,c3,colors.orange)
  44.      end
  45.  
  46. end
  47. f = fs.open(args[1], "r")
  48. for line in f.readLine do
  49.   term.setBackgroundColor(back)
  50.   if line:find("sleep:") then
  51.   parse = line:gsub("sleep:", "")
  52.   sleep(tonumber(parse))
  53.   end
  54.   if line:find("background=") then
  55.    parse = line:gsub("background=", "")
  56.    w, h = term.getSize()
  57.    if parse == "white" then
  58.        dfb(1,1,w,h,colors.white)
  59.    elseif parse == "magenta" then
  60.        dfb(1,1,w,h,colors.magenta)
  61.    elseif parse == "light_blue" then
  62.        dfb(1,1,w,h,colors.lightBlue)
  63.    elseif parse == "yellow" then
  64.        dfb(1,1,w,h,colors.yellow)
  65.    elseif parse == "lime" then
  66.        dfb(1,1,w,h,colors.lime)
  67.    elseif parse == "pink" then
  68.        dfb(1,1,w,h,colors.pink)
  69.    elseif parse == "gray" then
  70.        dfb(1,1,w,h,colors.gray)
  71.    elseif parse == "light_gray" then
  72.        dfb(1,1,w,h,colors.lightGray)
  73.    elseif parse == "cyan" then
  74.        dfb(1,1,w,h,colors.cyan)
  75.    elseif parse == "purple" then
  76.        dfb(1,1,w,h,colors.purple)
  77.    elseif parse == "blue" then
  78.        dfb(1,1,w,h,colors.blue)
  79.    elseif parse == "brown" then
  80.        dfb(1,1,w,h,colors.brown)
  81.    elseif parse == "green" then
  82.        dfb(1,1,w,h,colors.green)
  83.    elseif parse == "red" then
  84.        dfb(1,1,w,h,colors.red)
  85.    elseif parse == "black" then
  86.        dfb(1,1,w,h,colors.black)
  87.    elseif parse == "orange" then
  88.        dfb(1,1,w,h,colors.orange)
  89.      end
  90.    end
  91.    if line:find("background_color=") then
  92.    parse = line:gsub("background_color=", "")
  93.    term.setCursorPos(9,9)
  94.    if parse == "white" then
  95.        term.setBackgroundColor(colors.white)
  96.        back=colors.white
  97.    elseif parse == "magenta" then
  98.        term.setBackgroundColor(colors.magenta)
  99.         back=colors.magenta
  100.    elseif parse == "light_blue" then
  101.        term.setBackgroundColor(colors.lightBlue)
  102.         back=colors.lightBlue
  103.    elseif parse == "yellow" then
  104.        term.setBackgroundColor(colors.yellow)
  105.         back=colors.yellow
  106.    elseif parse == "lime" then
  107.        term.setBackgroundColor(colors.lime)
  108.         back=colors.lime
  109.    elseif parse == "pink" then
  110.        term.setBackgroundColor(colors.pink)
  111.         back=colors.pink
  112.    elseif parse == "gray" then
  113.        term.setBackgroundColor(colors.gray)
  114.         back=colors.gray
  115.    elseif parse == "light_gray" then
  116.        term.setBackgroundColor(colors.lightGray)
  117.         back=colors.lightGray
  118.    elseif parse == "cyan" then
  119.        term.setBackgroundColor(colors.cyan)
  120.         back=colors.cyan
  121.    elseif parse == "purple" then
  122.        term.setBackgroundColor(colors.purple)
  123.         back=colors.purple
  124.    elseif parse == "blue" then
  125.        term.setBackgroundColor(colors.blue)
  126.         back=colors.blue
  127.    elseif parse == "brown" then
  128.        term.setBackgroundColor(colors.brown)
  129.         back=colors.brown
  130.    elseif parse == "green" then
  131.        term.setBackgroundColor(colors.green)
  132.         back=colors.green
  133.    elseif parse == "red" then
  134.        term.setBackgroundColor(colors.red)
  135.         back=colors.red
  136.    elseif parse == "black" then
  137.        term.setBackgroundColor(colors.black)
  138.         back=colors.black
  139.    elseif parse == "orange" then
  140.        term.setBackgroundColor(colors.orange)
  141.         back=colors.orange
  142.      end
  143.    end
  144.    if line:find("box=") then
  145.      parse = line:gsub("box=", "") .. " "
  146.      c = {}
  147.      c2 = 0
  148.      c[c2] = ""
  149.      for i7 = 1, #parse do
  150.      local char = parse:sub(i7,i7)
  151.      -- do something with c
  152.      if char == " " then
  153.       d = c[c2]:gsub(' ', '')
  154.       c2 = c2 + 1
  155.       c[c2] = ""
  156.     end
  157.     c[c2] = c[c2] .. char
  158.    end
  159.     c21 = tostring(c[0]):gsub(' ', '')
  160.     c22 = tostring(c[1]):gsub(' ', '')
  161.     c23 = tostring(c[2]):gsub(' ', '')
  162.     c24 = tostring(c[3]):gsub(' ', '')
  163.     c25 = tostring(c[4]):gsub(' ', '')
  164.     hKK(c21,c22,c23,c24,c25)
  165.    end
  166.    if line:find("text=") then
  167.     parse = line:gsub("text=", "") .. " "
  168.     c = {}
  169.      c2 = 0
  170.      c[c2] = ""
  171.      for i7 = 1, #parse do
  172.      local char = parse:sub(i7,i7)
  173.      -- do something with c
  174.      if char == " " then
  175.       d = c[c2]:gsub(' ', '')
  176.       c2 = c2 + 1
  177.       c[c2] = ""
  178.     end
  179.     c[c2] = c[c2] .. char
  180.    end
  181.     term.setCursorPos(tonumber(c[0]), tonumber(c[1]))
  182.    
  183.     if c[3] == "white" then
  184.        term.setTextColor(colors.white)
  185.    elseif c[3] == "magenta" then
  186.        term.setTextColor(colors.magenta)
  187.    elseif c[3] == "light_blue" then
  188.        term.setTextColor(colors.lightBlue)
  189.    elseif c[3] == "yellow" then
  190.        term.setTextColor(colors.yellow)
  191.    elseif c[3] == "lime" then
  192.        term.setTextColor(colors.lime)
  193.    elseif c[3] == "pink" then
  194.        term.setTextColor(colors.pink)
  195.    elseif c[3] == "gray" then
  196.        term.setTextColor(colors.gray)
  197.    elseif c[3] == "light_gray" then
  198.        term.setTextColor(colors.lightGray)
  199.    elseif c[3] == "cyan" then
  200.        term.setTextColor(colors.cyan)
  201.    elseif c[3] == "purple" then
  202.        term.setTextColor(colors.purple)
  203.    elseif c[3] == "blue" then
  204.        term.setTextColor(colors.blue)
  205.    elseif c[3] == "brown" then
  206.        term.setTextColor(colors.brown)
  207.    elseif c[3] == "green" then
  208.        term.setTextColor(colors.green)
  209.    elseif c[3] == "red" then
  210.        term.setTextColor(colors.red)
  211.    elseif c[3] == "black" then
  212.        term.setTextColor(colors.black)
  213.    elseif c[3] == "orange" then
  214.        term.setTextColor(colors.orange)
  215.      end
  216.     term.write(c[2])
  217.     end
  218.    
  219.    
  220. end
  221. f.close()
  222. term.setCursorPos(xc,yc)
Advertisement
Add Comment
Please, Sign In to add comment