Read File Function
------------------------------------------------
-- BY TOXIC WOLF
------------------------------------------------
function WriteFile(sText, sPath, nLineNum)
local tFile = {}
local hHandle = fs.open(sPath, "r")
repeat
local sLine = hHandle:readLine()
table.insert(tFile, sLine)
until not sLine
hHandle:close()
tFile[nLineNum] = sText
local hHandle = fs.open(sPath, "w")
for tNum = 1, #tFile do
hHandle.writeLine(tFile[tNum])
end
hHandle:close()
return
end
function ReadFile(sPath, nLineNum)
local tFile = {}
local hHandle = fs.open(sPath, "r")
repeat
local sLine = hHandle:readLine()
table.insert(tFile, sLine)
until not sLine
hHandle:close()
return tFile[nLineNum]
end
My Program
MapToLoad = "test"
shell.run("X_F/GUI/GUI.exe")
x = 1
y = 1
LineNumber = 0
ChangeFromOrginialPostion = 0
MaxiumLineNumber = 0
MaxiumLineNumber = 19 + ChangeFromOrginialPostion
MaxiumLineNumber = MaxiumLineNumber * 51
DoLoop = true
while DoLoop do
LineNumber = y + ChangeFromOrginialPostion
LineNumber = LineNumber - 1
LineNumber = LineNumber * 51
LineNumber = LineNumber + x
LineString = ReadFile(MapToLoad , LineNumber)
if LineString == "w" then
col = colors.white
elseif LineString == "o" then
col = colors.orange
elseif LineString == "m" then
col = colors.magenta
elseif LineString == "lbl" then
col = colors.lightBlue
elseif LineString == "y" then
col = colors.yellow
elseif LineString == "l" then
col = colors.lime
elseif LineString == "p" then
col = colors.pink
elseif LineString == "g" then
col = colors.gray
elseif LineString == "lg" then
col = colors.lightGray
elseif LineString == "c" then
col = colors.cyan
elseif LineString == "p" then
col = colors.purple
elseif LineString == "bl" then
col = colors.blue
elseif LineString == "br" then
col = colors.brown
elseif LineString == "g" then
col = colors.green
elseif LineString == "r" then
col = colors.red
elseif LineString == "b" then
col = colors.black
end
paintutils.drawPixel(x,y,col)
x = x + 1
if x == 51 then
y = y + 1
x = 1
end
if LineNumber == MaxiumLineNumber then
DoLoop = false
end
end












