args = {...}
function dfb(x1,x2,y1,y2, c)
paintutils.drawFilledBox(x1,x2,y1,y2,c)
end
f = fs.open(args[1], "r")
for line in f.readLine do
if line:gmatch("sleep:") then
parse = line:gsub("sleep:", "")
sleep(tonumber(parse))
end
if line:gmatch("background=") then
parse = line:gsub("background=", "")
w, h = term.getSize()
if parse == "white" then
dfb(1,1,w,h,colors.white)
elseif parse == "magenta" then
dfb(1,1,w,h,colors.magenta)
elseif parse == "light_blue" then
dfb(1,1,w,h,colors.lightBlue)
elseif parse == "yellow" then
dfb(1,1,w,h,colors.yellow)
elseif parse == "lime" then
dfb(1,1,w,h,colors.lime)
elseif parse == "pink" then
dfb(1,1,w,h,colors.pink)
elseif parse == "gray" then
dfb(1,1,w,h,colors.gray)
elseif parse == "light_gray" then
dfb(1,1,w,h,colors.lightGray)
elseif parse == "cyan" then
dfb(1,1,w,h,colors.cyan)
elseif parse == "purple" then
dfb(1,1,w,h,colors.purple)
elseif parse == "blue" then
dfb(1,1,w,h,colors.blue)
elseif parse == "brown" then
dfb(1,1,w,h,colors.brown)
elseif parse == "green" then
dfb(1,1,w,h,colors.green)
elseif parse == "red" then
dfb(1,1,w,h,colors.red)
elseif parse == "black" then
dfb(1,1,w,h,colors.black)
elseif parse == "orange" then
dfb(1,1,w,h,colors.orange)
end
end
if line:gmatch("box=") then
parse = line:gsub("box=", "")
c = {}
c2 = 0
c[c2] = ""
for i7 = 1, #parse do
local char = parse:sub(i7,i7)
-- do something with c
if char == " " then
c2 = c2 + 1
c[c2] = ""
end
c[c2] = c[c2] .. char
end
print(c[0])
--for k, v in pairs(c) do
-- print(v)
--end
if parse == "white" then
dfb(1,1,w,h,colors.white)
elseif parse == "magenta" then
dfb(1,1,w,h,colors.magenta)
elseif parse == "light_blue" then
dfb(1,1,w,h,colors.lightBlue)
elseif parse == "yellow" then
dfb(1,1,w,h,colors.yellow)
elseif parse == "lime" then
dfb(1,1,w,h,colors.lime)
elseif parse == "pink" then
dfb(1,1,w,h,colors.pink)
elseif parse == "gray" then
dfb(1,1,w,h,colors.gray)
elseif parse == "light_gray" then
dfb(1,1,w,h,colors.lightGray)
elseif parse == "cyan" then
dfb(1,1,w,h,colors.cyan)
elseif parse == "purple" then
dfb(1,1,w,h,colors.purple)
elseif parse == "blue" then
dfb(1,1,w,h,colors.blue)
elseif parse == "brown" then
dfb(1,1,w,h,colors.brown)
elseif parse == "green" then
dfb(1,1,w,h,colors.green)
elseif parse == "red" then
dfb(1,1,w,h,colors.red)
elseif parse == "black" then
dfb(1,1,w,h,colors.black)
elseif parse == "orange" then
dfb(1,1,w,h,colors.orange)
end
end
end
f.close()
Read File:
background=orange
sleep:1
background=red
sleep:0.5
box=hello
OK, so this should print "hello", but it prints all the lines of the read file for some reason! please help T_T