User File #58177909671900143

Upload All User Files

#58177909671900143 - Desert Bus Bot (BizHawk)

DesertBus-BizHawk.lua
423 downloads
Uploaded 9/25/2019 12:59 AM by Dacicus (see all 26)
Inspired by alden's run, this is a simple bot that should play Desert Bus endlessly. Start it after the bus powers on in-game, then sit back and relax.
memory.usememorydomain("68K RAM")

local addr_drift = 0x6FFA
local bad_drift = 0xA0

local addr_distance = 0x6FDC
local target_distance = 0x09E340

local addr_score_timer = 0x7139

local driving = true
local press_start = false

local function is_drift_bad()
  if memory.readbyte(addr_drift) > bad_drift then
    return true
  end
  
  return false
end

local function reached_target()
  if memory.read_u32_be(addr_distance) == target_distance then
    driving = false
  end
end

local function start_next_trip()
  if memory.readbyte(addr_score_timer) == 1 then
    joypad.set({Start=true}, 1)
    press_start = true
  end

  if press_start and memory.readbyte(addr_score_timer) == 0 then
    joypad.set({Start=true}, 1)
    driving = true
    press_start = false
  end
end

while true do
  if driving then
    if is_drift_bad() then
      joypad.set({A=true, Left=true}, 1)
    else
      joypad.set({A=true, Left=false}, 1)
    end

    reached_target()
  else
    start_next_trip()
  end

  emu.frameadvance()
end