This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
houseofkraft's profile picture

Animation not playing, does nothing.

Started by houseofkraft, 15 March 2017 - 02:09 PM
houseofkraft #1
Posted 15 March 2017 - 03:09 PM
I have made an animation player that follows a specific format. I made the animation file and the syntax is correct but when I play it in the player nothing happens.

Code

-- Animation Player
-- By: houseofkraft

local nPos = 1
local tArgs = { ... }

local function save( tTable, sFile )
  local tHandle = fs.open( sFile, "w" )
  for k,v in pairs(tmpImg) do
    tHandle.writeLine(v)
  end
  tHandle.close()
end

if #tArgs < 1 then
  printError("Usage: play <file>")
  return
end

local tFile = fs.open( tArgs[1], "r" )
local isEnd = false

for i = 1, 1024 do
  fs.delete(".tmp")
  tmpImg = {}
  for index, sLine in tFile.readLine do
    if sLine == "NEXT" then
      nPos = index + 1 
      break
    elseif sLine == "END" then
      isEnd = true
      break
    else
      table.insert(tmpImg, sLine)
    end
  end
  if isEnd then
    break
  end
  save(tmpImg, ".tmp")
  img = paintutils.loadImage( ".tmp" )
  paintutils.drawImage( img, 1,1 )
  os.sleep(0.1)
  --end
end

Please help!

Thanks!
Lupus590 #2
Posted 15 March 2017 - 05:59 PM
try running your code through this: http://www.computercraft.info/forums2/index.php?/topic/25284-ingame-step-by-step-debugger/

I suspect that your display part is not getting called as you break at the end of your file and not (where I think) your frame dividers are