Dessyreqt icon

Super Metroid Info Script

Dessyreqt | PRO | 02/26/12 04:54:57 AM UTC | 0 ⭐ | 770 👁️ | Never ⏰ | []
Lua |

24.47 KB

|

None

|

0 👍

/

0 👎

runningTimerSpeed = 3
 
--Game-specific RAM addresses
RAM = {
    words = {
        hour = 0x7e09e0,
        min = 0x7e09de,
        sec = 0x7e09dc,
        mil = 0x7e09da,
        missiles = 0x7e09c8,
        superMissiles = 0x7e09cc,
        powerBombs = 0x7e09d0,
        energyTanks = 0x7e09c4,
        reserveTanks = 0x7e09d4,
        items = 0x7e09a4,
        weapons = 0x7e09a8,
        health = 0x7e09c2,
        reserve = 0x7e09d6,
        roomNumber = 0x7e079c,
        enemyHealth1 = 0x7e0f8c,
        enemyHealth2 = 0x7e0fcc
    },
    bytes = {
        finalBossState = 0x7e0e4b,
        runningAnimation = 0x7e0aca,
        items1 = 0x7ed870,
        items2 = 0x7ed871,
        items3 = 0x7ed872,
        items4 = 0x7ed873,
        items5 = 0x7ed874,
        items6 = 0x7ed875,
        items7 = 0x7ed876,
        items8 = 0x7ed877,
        items9 = 0x7ed878,
        items10 = 0x7ed879,
        items11 = 0x7ed87a,
        items12 = 0x7ed880,
        items13 = 0x7ed881,
        items14 = 0x7ed882,
        items15 = 0x7ed883,
        beamCharge = 0x7e0dc2
    }
}
 
--Locations to output text
output = {
    x = 0,
    y = 210,
    yOffset = 0,
    boxX = 0,
    boxY = 0
}
 
showOptions = {
    time = true,
    pct = true,
    bossHealth = true,
    shortCharge = true,
    beamCharge = true,
    forgotItems = false,
    forgotMode = 0
}
 
whiteBox = false
 
function OutputTime(outOffset)
    --set in-game time
    local hour = memory.readword(RAM.words.hour)
    local minute = memory.readword(RAM.words.min)
    local sec = memory.readword(RAM.words.sec)
    local mil = math.floor(memory.readword(RAM.words.mil) * 100 / 60)
 
    gui.text(output.x, output.y - output.yOffset, "(T) Time: " .. hour .. ":" .. string.format("%02d",minute) .. ":" .. string.format("%02d",sec) .. "." .. string.format("%02d",mil))
    output.yOffset = output.yOffset + 10
end
 
function OutputPct(outOffset)
    local missiles = math.floor(memory.readbyte(RAM.words.missiles) / 5)
    local superMissiles = math.floor(memory.readbyte(RAM.words.superMissiles) / 5)
    local powerBombs = math.floor(memory.readbyte(RAM.words.powerBombs) / 5)
    local energyTanks = math.floor((memory.readword(RAM.words.energyTanks) - 99) / 100)
    local reserveTanks = math.floor(memory.readword(RAM.words.reserveTanks) / 100)
 
    local items = memory.readword(RAM.words.items)
    local variaSuit = items % 2
    local springBall = math.floor((items % 4) / 2)
    local morphBall = math.floor((items % 8) / 4)
    local screwAttack = math.floor((items % 16) / 8)
    local gravitySuit = math.floor((items % 64) / 32)
    local hiJumpBoots = math.floor((items % 512) / 256)
    local spaceJump = math.floor((items % 1024) / 512)
    local bomb = math.floor((items % 8192) / 4096)
    local speedBooster = math.floor((items % 16384) / 8192)
    local grappleBeam = math.floor((items % 32768) / 16384)
    local xRayScope = math.floor(items / 32768)
 
    local weapons = memory.readword(RAM.words.weapons)
    local waveBeam = weapons % 2
    local iceBeam = math.floor((weapons % 4) / 2)
    local spazerBeam = math.floor((weapons % 8) / 4)
    local plasmaBeam = math.floor((weapons % 16) / 8)
    local chargeBeam = math.floor((weapons % 8192) / 4096)
 
    local pct = missiles + superMissiles + powerBombs + energyTanks + reserveTanks + variaSuit + springBall + morphBall + screwAttack + gravitySuit + hiJumpBoots + spaceJump + bomb + speedBooster + grappleBeam + xRayScope + waveBeam + iceBeam + spazerBeam + plasmaBeam + chargeBeam
 
    gui.text(output.x, output.y - output.yOffset, "(P) Pct: " .. pct .. "%")
    output.yOffset = output.yOffset + 10
end
 
function OutputBossHealth()
    local roomNumber = memory.readword(RAM.words.roomNumber)
    local bossRoom = false
    local finalBoss = false
    local maxHealth = 0
    local boxX = output.x + 90
    local boxY = output.y - output.yOffset - 2 
    
    if roomNumber == 13017 then --Botwoon
        bossRoom = true
        maxHealth = 3000
    end
    
    if roomNumber == 5528 then --Chozo
        bossRoom = true
        maxHealth = 800
    end
 
    if roomNumber == 2729 then --Crocomire
        bossRoom = true
    end
 
    if roomNumber == 14298 then --Draygon
        bossRoom = true
        maxHealth = 6000
    end
    
    if roomNumber == 14258 then --Golden Torizo
        bossRoom = true
        maxHealth = 13500
    end
 
    if roomNumber == 12197 then --Kraid
        bossRoom = true
        maxHealth = 1000
    end
    
    if roomNumber == 2781 then --Mother Brain
        finalBoss = true
        local finalBossState = memory.readbyte(RAM.bytes.finalBossState)
        
        if finalBossState == 3 then
            maxHealth = 3000
        elseif finalBossState == 1 then
            maxHealth = 18000
        elseif finalBossState == 0 then
            maxHealth = 36000
        end
    end
    
    if roomNumber == 2765 then --Phantoon
        bossRoom = true
        maxHealth = 2500
    end
 
    if roomNumber == 1504 then --Ridley (Ceres)
        bossRoom = true
    end
    
    if roomNumber == 15027 then --Ridley
        bossRoom = true
        maxHealth = 18000
    end
    
    if roomNumber == 2973 then --Spore Spawn
        bossRoom = true
        maxHealth = 960
    end
    
    if bossRoom then
        local bossHealth = memory.readword(RAM.words.enemyHealth1)
        local bossPct = 100
        local boxPct = 100
        
        if bossHealth == 32767 then
            gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: Infinite")
        else            
            if maxHealth ~= 0 then
                bossPct = math.floor(bossHealth / maxHealth * 100)
                boxPct = math.floor(bossHealth / maxHealth * 100)
            end
            
            gui.box(boxX, boxY, boxX + 100, boxY + 10, "#00000080")
            if bossHealth > 0 then
                gui.box(boxX, boxY, boxX + boxPct, boxY + 10, "#80000080")
            end
            
            gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: " .. bossHealth)
            gui.text(boxX + 2, boxY+ 2, bossPct .. "%")
        end
    elseif finalBoss then
        local bossHealth = memory.readword(RAM.words.enemyHealth2)
    
        if maxHealth ~= 0 then
            bossPct = math.floor(bossHealth / maxHealth * 100)
            boxPct = math.floor(bossHealth / maxHealth * 100)
        end
        
        gui.box(boxX, boxY, boxX + 100, boxY + 10, "#00000080")
        if bossHealth > 0 then
            gui.box(boxX, boxY, boxX + boxPct, boxY + 10, "#80000080")
        end
        
        gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: " .. bossHealth)
        gui.text(boxX + 2, boxY+ 2, bossPct .. "%")
    else
        gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: --No Boss--")
    end 
    output.yOffset = output.yOffset + 10
end
 
function OutputShortCharge()
    local runningAnimation = memory.readbyte(RAM.bytes.runningAnimation)
    local boxX = output.x + 95
    local boxY = output.y - output.yOffset 
 
    gui.box(boxX + runningTimerSpeed * 9, boxY, boxX + runningTimerSpeed * 11, boxY + 6, "#00808080")
    
    if runningAnimation == 227 or runningAnimation == 245 then
        gui.box(boxX + runningTimerSpeed, boxY, boxX + runningTimerSpeed, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 11, boxY, boxX + runningTimerSpeed * 11, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 228 or runningAnimation == 244 then
        gui.box(boxX + runningTimerSpeed * 2, boxY, boxX + runningTimerSpeed * 2, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 12, boxY, boxX + runningTimerSpeed * 12, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 229 or runningAnimation == 243 then
        gui.box(boxX + runningTimerSpeed * 3, boxY, boxX + runningTimerSpeed * 3, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 13, boxY, boxX + runningTimerSpeed * 13, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 230 or runningAnimation == 242 then
        gui.box(boxX + runningTimerSpeed * 4, boxY, boxX + runningTimerSpeed * 4, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 14, boxY, boxX + runningTimerSpeed * 14, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 231 or runningAnimation == 241 then
        gui.box(boxX + runningTimerSpeed * 5, boxY, boxX + runningTimerSpeed * 5, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 15, boxY, boxX + runningTimerSpeed * 15, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 232 or runningAnimation == 240 then
        gui.box(boxX + runningTimerSpeed * 6, boxY, boxX + runningTimerSpeed * 6, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 16, boxY, boxX + runningTimerSpeed * 16, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 233 or runningAnimation == 239 then
        gui.box(boxX + runningTimerSpeed * 7, boxY, boxX + runningTimerSpeed * 7, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 17, boxY, boxX + runningTimerSpeed * 17, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 234 or runningAnimation == 238 then
        gui.box(boxX + runningTimerSpeed * 8, boxY, boxX + runningTimerSpeed * 8, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 18, boxY, boxX + runningTimerSpeed * 18, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 235 or runningAnimation == 237 then
        gui.box(boxX + runningTimerSpeed * 9, boxY, boxX + runningTimerSpeed * 9, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 19, boxY, boxX + runningTimerSpeed * 19, boxY + 6, "#FFFFFF80")
    elseif runningAnimation == 236 or runningAnimation == 246 then
        gui.box(boxX + runningTimerSpeed * 10, boxY, boxX + runningTimerSpeed * 10, boxY + 6, "#FFFFFF80")
    else
        gui.box(boxX, boxY, boxX, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 10, boxY, boxX + runningTimerSpeed * 10, boxY + 6, "#FFFFFF80")
        gui.box(boxX + runningTimerSpeed * 20, boxY, boxX + runningTimerSpeed * 20, boxY + 6, "#FFFFFF80")
    end
        gui.text(output.x, output.y - output.yOffset, "(S) Short Charge Timer:")
 
    output.yOffset = output.yOffset + 10
end
 
function OutputBeamCharge()
    local boxX = output.x + 90
    local boxY = output.y - output.yOffset - 2 
    local beamCharge = math.min(memory.readbyte(RAM.bytes.beamCharge), 60)
    
    gui.box(boxX, boxY, boxX + 60, boxY + 10, "#00000080")
 
    if beamCharge > 0 then
        if beamCharge < 60 or not whiteBox then
            gui.box(boxX, boxY, boxX + beamCharge, boxY + 10, "#80800080")
            whiteBox = true
        else
            gui.box(boxX, boxY, boxX + beamCharge, boxY + 10, "#ffffff80")
            whiteBox = false
        end
    end
            
    gui.text(output.x, output.y - output.yOffset, "(B) Beam Charge: " .. beamCharge)
    output.yOffset = output.yOffset + 10
end
 
 
function ContainsBit(number, bit)
    return math.floor((number % (bit * 2)) / bit) == 1
end
 
function values(t)
    local i = 0
    return function() i = i + 1; return t[i] end
end
 
function GetCrateriaItems()
    local retVal = {}
    local items1 = memory.readbyte(RAM.bytes.items1)
    local items2 = memory.readbyte(RAM.bytes.items2)
    local i = 1
    
    if not ContainsBit(items1,128) then
        retVal[i] = "Bomb"
        i = i + 1
    end
    if not ContainsBit(items1,64) then
        retVal[i] = "Missile (Crateria bottom)"
        i = i + 1
    end
    if not ContainsBit(items1,32) then
        retVal[i] = "Energy Tank (Crateria gauntlet)"
        i = i + 1
    end
    if not ContainsBit(items1,16) then
        retVal[i] = "Missile (Crateria moat)"
        i = i + 1
    end
    if not ContainsBit(items1,8) then
        retVal[i] = "Missile (outside Wrecked Ship middle)"
        i = i + 1
    end
    if not ContainsBit(items1,4) then
        retVal[i] = "Missile (outside Wrecked Ship top)"
        i = i + 1
    end
    if not ContainsBit(items1,2) then
        retVal[i] = "Missile (outside Wrecked Ship bottom)"
        i = i + 1
    end
    if not ContainsBit(items1,1) then
        retVal[i] = "Power Bomb (Crateria surface)"
        i = i + 1
    end
    if not ContainsBit(items2,16) then
        retVal[i] = "Missile (Crateria middle)"
        i = i + 1
    end
    if not ContainsBit(items2,8) then
        retVal[i] = "Super Missile (Crateria middle)"
        i = i + 1
    end
    if not ContainsBit(items2,4) then
        retVal[i] = "Missile (Crateria gauntlet left)"
        i = i + 1
    end
    if not ContainsBit(items2,2) then
        retVal[i] = "Missile (Crateria guantlet right)"
        i = i + 1
    end
 
    return retVal
end
 
function GetBrinstarItems()
    local retVal = {}
    local items2 = memory.readbyte(RAM.bytes.items2)
    local items3 = memory.readbyte(RAM.bytes.items3)
    local items4 = memory.readbyte(RAM.bytes.items4)
    local items5 = memory.readbyte(RAM.bytes.items5)
    local items6 = memory.readbyte(RAM.bytes.items6)
    local items7 = memory.readbyte(RAM.bytes.items7)
    local i = 1
    
    if not ContainsBit(items2,128) then
        retVal[i] = "Missile (green Brinstar below super missile) "
        i = i + 1
    end
    if not ContainsBit(items2,64) then
        retVal[i] = "Super Missile (pink Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items2,32) then
        retVal[i] = "Power Bomb (green Brinstar bottom)"
        i = i + 1
    end
    if not ContainsBit(items2,1) then
        retVal[i] = "Energy Tank (tunnel to Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items3,128) then
        retVal[i] = "Charge Beam "
        i = i + 1
    end
    if not ContainsBit(items3,64) then
        retVal[i] = "Missile (pink Brinstar bottom)"
        i = i + 1
    end
    if not ContainsBit(items3,32) then
        retVal[i] = "Missile (pink Brinstar top)"
        i = i + 1
    end
    if not ContainsBit(items3,8) then
        retVal[i] = "Missile (green Brinstar behind reserve tank) "
        i = i + 1
    end
    if not ContainsBit(items3,4) then
        retVal[i] = "Missile (green Brinstar behind missile)"
        i = i + 1
    end
    if not ContainsBit(items3,2) then
        retVal[i] = "Reserve Tank (green Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items3,1) then
        retVal[i] = "Super Missile (green Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items4,128) then
        retVal[i] = "Super Missile (green Brinstar bottom)"
        i = i + 1
    end
    if not ContainsBit(items4,64) then
        retVal[i] = "Energy Tank (green Brinstar bottom)"
        i = i + 1
    end
    if not ContainsBit(items4,32) then
        retVal[i] = "Energy Tank (blue Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items4,16) then
        retVal[i] = "Missile (blue Brinstar middle)"
        i = i + 1
    end
    if not ContainsBit(items4,8) then
        retVal[i] = "Power Bomb (blue Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items4,4) then
        retVal[i] = "Morphing Ball"
        i = i + 1
    end
    if not ContainsBit(items4,2) then
        retVal[i] = "Missile (green Brinstar pipe)"
        i = i + 1
    end
    if not ContainsBit(items4,1) then
        retVal[i] = "Power Bomb (pink Brinstar)"
        i = i + 1
    end
    if not ContainsBit(items5,128) then
        retVal[i] = "Power Bomb (red Brinstar sidehopper room)"
        i = i + 1
    end
    if not ContainsBit(items5,64) then
        retVal[i] = "X-Ray Scope"
        i = i + 1
    end
    if not ContainsBit(items5,32) then
        retVal[i] = "Missile (blue Brinstar behind missile)"
        i = i + 1
    end
    if not ContainsBit(items5,16) then
        retVal[i] = "Missile (blue Brinstar top)"
        i = i + 1
    end
    if not ContainsBit(items5,8) then
        retVal[i] = "Energy Tank (pink Brinstar top)"
        i = i + 1
    end
    if not ContainsBit(items5,4) then
        retVal[i] = "Missile (blue Brinstar bottom) "
        i = i + 1
    end
    if not ContainsBit(items5,2) then
        retVal[i] = "Energy Tank (pink Brinstar bottom)"
        i = i + 1
    end
    if not ContainsBit(items6,16) then
        retVal[i] = "Missile (Kraid)"
        i = i + 1
    end
    if not ContainsBit(items6,8) then
        retVal[i] = "Energy Tank (Kraid)"
        i = i + 1
    end
    if not ContainsBit(items6,4) then
        retVal[i] = "Spazer"
        i = i + 1
    end
    if not ContainsBit(items6,2) then
        retVal[i] = "Missile (red Brinstar spike room)"
        i = i + 1
    end
    if not ContainsBit(items6,1) then
        retVal[i] = "Power Bomb (red Brinstar spike room)"
        i = i + 1
    end
    if not ContainsBit(items7,1) then
        retVal[i] = "Varia Suit"
        i = i + 1
    end
 
    return retVal
end
 
function GetNorfairItems()
    local retVal = {}
    local items7 = memory.readbyte(RAM.bytes.items7)
    local items8 = memory.readbyte(RAM.bytes.items8)
    local items9 = memory.readbyte(RAM.bytes.items9)
    local items10 = memory.readbyte(RAM.bytes.items10)
    local items11 = memory.readbyte(RAM.bytes.items11)
    local i = 1
 
    if not ContainsBit(items7,128) then
        retVal[i] = "Missile (Hi-Jump Boots)"
        i = i + 1
    end
    if not ContainsBit(items7,64) then
        retVal[i] = "Missile (above Crocomire)"
        i = i + 1
    end
    if not ContainsBit(items7,32) then
        retVal[i] = "Hi-Jump Boots"
        i = i + 1
    end
    if not ContainsBit(items7,16) then
        retVal[i] = "Energy Tank (Crocomire)"
        i = i + 1
    end
    if not ContainsBit(items7,8) then
        retVal[i] = "Missile (below Ice Beam)"
        i = i + 1
    end
    if not ContainsBit(items7,4) then
        retVal[i] = "Ice Beam "
        i = i + 1
    end
    if not ContainsBit(items7,2) then
        retVal[i] = "Missile (lava room)"
        i = i + 1
    end
    if not ContainsBit(items8,128) then
        retVal[i] = "Missile (bubble Norfair green door)"
        i = i + 1
    end
    if not ContainsBit(items8,64) then
        retVal[i] = "Missile (Norfair reserve tank)"
        i = i + 1
    end
    if not ContainsBit(items8,32) then
        retVal[i] = "Reserve Tank (Norfair)"
        i = i + 1
    end
    if not ContainsBit(items8,16) then
        retVal[i] = "Grapple Beam"
        i = i + 1
    end
    if not ContainsBit(items8,8) then
        retVal[i] = "Missile (Grapple Beam)"
        i = i + 1
    end
    if not ContainsBit(items8,4) then
        retVal[i] = "Missile (below Crocomire)"
        i = i + 1
    end
    if not ContainsBit(items8,2) then
        retVal[i] = "Power Bomb (Crocomire)"
        i = i + 1
    end
    if not ContainsBit(items8,1) then
        retVal[i] = "Energy Tank (Hi-Jump Boots)"
        i = i + 1
    end
    if not ContainsBit(items9,128) then
        retVal[i] = "Super Missile (Gold Torizo)"
        i = i + 1
    end
    if not ContainsBit(items9,64) then
        retVal[i] = "Missile (Gold Torizo)"
        i = i + 1
    end
    if not ContainsBit(items9,16) then
        retVal[i] = "Wave Beam"
        i = i + 1
    end
    if not ContainsBit(items9,8) then
        retVal[i] = "Missile (Wave Beam)"
        i = i + 1
    end
    if not ContainsBit(items9,4) then
        retVal[i] = "Speed Booster "
        i = i + 1
    end
    if not ContainsBit(items9,2) then
        retVal[i] = "Missile (Speed Booster)"
        i = i + 1
    end
    if not ContainsBit(items9,1) then
        retVal[i] = "Missile (bubble Norfair)"
        i = i + 1
    end
    if not ContainsBit(items10,128) then
        retVal[i] = "Screw Attack"
        i = i + 1
    end
    if not ContainsBit(items10,64) then
        retVal[i] = "Energy Tank (Ridley)"
        i = i + 1
    end
    if not ContainsBit(items10,32) then
        retVal[i] = "Missile (lower Norfair near Wave Beam)"
        i = i + 1
    end
    if not ContainsBit(items10,16) then
        retVal[i] = "Power Bomb (above Ridley)"
        i = i + 1
    end
    if not ContainsBit(items10,8) then
        retVal[i] = "Power Bomb (lower Norfair above fire flea room)"
        i = i + 1
    end
    if not ContainsBit(items10,4) then
        retVal[i] = "Missile (lower Norfair above fire flea room)"
        i = i + 1
    end
    if not ContainsBit(items10,2) then
        retVal[i] = "Missile (Mickey Mouse room)"
        i = i + 1
    end
    if not ContainsBit(items11,1) then
        retVal[i] = "Energy Tank (lower Norfair fire flea room)"
        i = i + 1
    end
    
 
    return retVal
end
 
function GetWreckedShipItems()
    local retVal = {}
    local items12 = memory.readbyte(RAM.bytes.items12)
    local i = 1
    
    if not ContainsBit(items12,128) then
        retVal[i] = "Gravity Suit"
        i = i + 1
    end
    if not ContainsBit(items12,64) then
        retVal[i] = "Super Missile (Wrecked Ship right)"
        i = i + 1
    end
    if not ContainsBit(items12,32) then
        retVal[i] = "Super Missile (Wrecked Ship left)"
        i = i + 1
    end
    if not ContainsBit(items12,16) then
        retVal[i] = "Energy Tank (Wrecked Ship)"
        i = i + 1
    end
    if not ContainsBit(items12,8) then
        retVal[i] = "Missile (Wrecked Ship top)"
        i = i + 1
    end
    if not ContainsBit(items12,4) then
        retVal[i] = "Missile (Gravity Suit)"
        i = i + 1
    end
    if not ContainsBit(items12,2) then
        retVal[i] = "Reserve Tank (Wrecked Ship)"
        i = i + 1
    end
    if not ContainsBit(items12,1) then
        retVal[i] = "Missile (Wrecked Ship middle)"
        i = i + 1
    end
    
    return retVal
end
 
function GetMaridiaItems()
    local retVal = {}
    local items13 = memory.readbyte(RAM.bytes.items13)
    local items14 = memory.readbyte(RAM.bytes.items14)
    local items15 = memory.readbyte(RAM.bytes.items15)
    local i = 1
    
    if not ContainsBit(items13,128) then
        retVal[i] = "Plasma Beam"
        i = i + 1
    end
    if not ContainsBit(items13,64) then
        retVal[i] = "Missile (yellow Maridia false wall)"
        i = i + 1
    end
    if not ContainsBit(items13,32) then
        retVal[i] = "Missile (yellow Maridia super missile)"
        i = i + 1
    end
    if not ContainsBit(items13,16) then
        retVal[i] = "Super Missile (yellow Maridia)"
        i = i + 1
    end
    if not ContainsBit(items13,8) then
        retVal[i] = "Missile (green Maridia turtle room)"
        i = i + 1
    end
    if not ContainsBit(items13,4) then
        retVal[i] = "Energy Tank (green Maridia)"
        i = i + 1
    end
    if not ContainsBit(items13,2) then
        retVal[i] = "Super Missile (green Maridia)"
        i = i + 1
    end
    if not ContainsBit(items13,1) then
        retVal[i] = "Missile (green Maridia Shinespark)"
        i = i + 1
    end
    if not ContainsBit(items14,128) then
        retVal[i] = "Missile (Draygon)"
        i = i + 1
    end
    if not ContainsBit(items14,64) then
        retVal[i] = "Spring Ball"
        i = i + 1
    end
    if not ContainsBit(items14,32) then
        retVal[i] = "Super Missile (pink Maridia)"
        i = i + 1
    end
    if not ContainsBit(items14,16) then
        retVal[i] = "Missile (pink Maridia)"
        i = i + 1
    end
    if not ContainsBit(items14,8) then
        retVal[i] = "Power Bomb (right Maridia sand pit room)"
        i = i + 1
    end
    if not ContainsBit(items14,4) then
        retVal[i] = "Missile (right Maridia sand pit room)"
        i = i + 1
    end
    if not ContainsBit(items14,2) then
        retVal[i] = "Reserve Tank (Maridia)"
        i = i + 1
    end
    if not ContainsBit(items14,1) then
        retVal[i] = "Missile (left Maridia sand pit room)"
        i = i + 1
    end
    if not ContainsBit(items15,4) then
        retVal[i] = "Space Jump"
        i = i + 1
    end
    if not ContainsBit(items15,1) then
        retVal[i] = "Energy tank (Botwoon)"
        i = i + 1
    end
 
    return retVal
end
 
 
function OutputForgotItems()
    if not showOptions.forgotItems then
        gui.text(output.x + 188, output.y, "(F) Forgot Items?") 
    else
        gui.text(output.x + 188, output.y - 60, "(C) Crateria") 
        gui.text(output.x + 188, output.y - 50, "(B) Brinstar") 
        gui.text(output.x + 188, output.y - 40, "(N) Norfair")  
        gui.text(output.x + 188, output.y - 30, "(W) Wrecked Ship") 
        gui.text(output.x + 188, output.y - 20, "(M) Maridia")  
        gui.text(output.x + 188, output.y, "(F) Found Them!")   
    
        if showOptions.forgotMode == 0 then 
            local crateriaItems = GetCrateriaItems()
            OutputList(0, 0, crateriaItems, "Crateria\n-----\n")
        end
        if showOptions.forgotMode == 1 then 
            local brinstarItems = GetBrinstarItems()
            OutputList(0, 0, brinstarItems, "Brinstar\n-----\n")
        end
        if showOptions.forgotMode == 2 then 
            local norfairItems = GetNorfairItems()
            OutputList(0, 0, norfairItems, "Norfair\n-----\n")
        end
        if showOptions.forgotMode == 3 then 
            local wreckedShipItems = GetWreckedShipItems()
            OutputList(0, 0, wreckedShipItems, "Wrecked Ship\n-----\n")
        end
        if showOptions.forgotMode == 4 then 
            local maridiaItems = GetMaridiaItems()
            OutputList(0, 0, maridiaItems, "Maridia\n-----\n")
        end
    end
end
 
function OutputList(xPos, yPos, list, prefix)
    local output = prefix
    local firstPass = true
    
    for item in values(list) do
        if not firstPass then
            output = output .. "\n"
        end
        
        output = output .. item
        firstPass = false
    end
    
    gui.text(xPos, yPos, output)
end
 
--Outputs relevant game information
function OutputGameInfo()
    output.yOffset = 0
    
    OutputForgotItems()
    
    if not showOptions.forgotItems then
        if showOptions.time then
            OutputTime()
        end
 
        if showOptions.pct then
            OutputPct()
        end
 
        if showOptions.bossHealth then
            OutputBossHealth()
        end
 
        if showOptions.shortCharge then
            OutputShortCharge()
        end
        
        if showOptions.beamCharge then
            OutputBeamCharge()
        end
    end
end
 
--Handles all the hotkey stuff
function HandleKeys()
    keys = input.get()
 
    if press('F') then
        showOptions.forgotItems = not showOptions.forgotItems
    end
    
    if not showOptions.forgotItems then
        if press('T') then
            showOptions.time = not showOptions.time
        end
        
        if press('P') then
            showOptions.pct = not showOptions.pct
        end
        
        if press('H') then
            showOptions.bossHealth = not showOptions.bossHealth
        end
        
        if press('S') then
            showOptions.shortCharge = not showOptions.shortCharge
        end
 
        if press('B') then
            showOptions.beamCharge = not showOptions.beamCharge
        end
    else
        if press('C') then
            showOptions.forgotMode = 0
        end
        if press('B') then
            showOptions.forgotMode = 1
        end
        if press('N') then
            showOptions.forgotMode = 2
        end
        if press('W') then
            showOptions.forgotMode = 3
        end
        if press('M') then
            showOptions.forgotMode = 4
        end
    end
    
    last_keys = keys                                              
end
 
function press(button)
    if keys[button] and not last_keys[button] then
        return true
    end
    return false
end
    
while true do
    OutputGameInfo()
    HandleKeys()
    snes9x.frameadvance()
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎