User File #66406789831147836

Upload All User Files

#66406789831147836 - Blank input frame finder (BizHawk)

Movie_find_Spike_frames.lua
2 comments, 330 downloads
Uploaded 9/29/2020 3:09 PM by Dacicus (see all 26)
This script analyzes a BizHawk movie file for blank input frames at the end. Removing such frames (AKA "Spiking") should reduce movie length without changing the outcome. Run the script with the movie loaded. I have not tested this with subframe input. I don't expect it to work with analog controls.
Feel free to improve upon this.
--[[
This script analyzes a BizHawk movie file for blank input frames at the end.
Removing such frames (AKA "Spiking") should reduce movie length without
changing the outcome.  Run the script with the movie loaded.  I have not tested
this with subframe input.  I don't expect it to work with analog controls.

Feel free to improve upon this.

Dacicus 2020/09/29
--]]

local frame_curr, input_curr, spike_this_frame
local spike = {false, 0}

local function process_movie()
  for frame_curr = 0, movie.length() - 1 do
    spike_this_frame = true
    input_curr = movie.getinput(frame_curr)
    for k, v in pairs(input_curr) do
      if v ~= false then
        spike_this_frame = false
      end
    end
    if not spike_this_frame then
      spike[1] = false
    else
      if not spike[1] then
        spike = {true, frame_curr}
      end
    end
  end
end

local function print_results()
  if spike[1] then
    console.writeline("Spike movie from frame " .. spike[2] .. ".")
  else
    console.writeline("No blank input frames found at end of movie.")
  end
end

if movie.isloaded() then
  process_movie()
  print_results()
else
  console.writeline("ERROR: Please load a movie.")
end

Spikestuff
on 9/29/2020 3:14 PM
I'm insulted by this. /sarcasm
Also, still not a be all end all with those that mash inputs before people get ahead of themselves saying this "puts me out of a job" or something.
Stares at EZGames69.
This is basically the equivalent to a Light Spike.
Spikestuff
on 9/29/2020 5:00 PM
Quoting DJ Incendration
I don't understand. There's no sarcasm, or anything like that. Sorry for insulting you though.
Your name isn't Dacicus.