User File #638723764524161960

Upload All User Files

#638723764524161960 - c64 flooder manipulation script

floodermanip.lua
Game: Flooder ( C64, see all files )
5 downloads
Uploaded 4 days ago by Cephla (see all 24)
Script that randomly produces inputs to change the configuration of the board
local filePath = "manipframes.txt"
local file = io.open(filePath, "r")

if not file then
    error("Could not open file " .. filePath)
end

local fileContent = file:read("*all")
file:close()

-- Convert the comma-separated string into a table of numbers
local framesToPressUp = {}
for frame in string.gmatch(fileContent, "%d+") do
    table.insert(framesToPressUp, tonumber(frame))
end

-- Function to check if a value exists in a table
function table.contains(table, element)
    for _, value in pairs(table) do
        if value == element then
            return true
        end
    end
    return false
end

-- Function to press UP for player 1
local function pressUp()
    joypad.set({["Key Left Arrow"]=true})
end

-- Main loop
while true do
    local frameNumber = emu.framecount()

    -- Check if the current frame is in the list of frames to press UP
    if table.contains(framesToPressUp, frameNumber) then
        pressUp()
    end

    emu.frameadvance()
end