User File #68710985146983959

Upload All User Files

#68710985146983959 - Castle of Illusion Lua script

Castle of Illusion SMS Lua Script.lua
402 downloads
Uploaded 1/11/2021 9:38 AM by The8bitbeast (see all 37)
oldxPos = 0
oldyPos = 0


function doStuff()
    screenXBig = mainmemory.readbyte(0x0071)
    screenX = mainmemory.readbyte(0x0070)
    screenXSub = mainmemory.readbyte(0x006F)
    realScreenX = screenXBig * 256 + screenX + screenXSub / 256
    
    
    mickeyX = mainmemory.readbyte(0x020D)
    mickeyXSub = mainmemory.readbyte(0x020C)
    
    realMickeyX = mickeyX + mickeyXSub / 256
    
    xPos = realScreenX + realMickeyX
    xSpeed = mainmemory.read_s16_le(0x0210) / 256
    
    dx = xPos - oldxPos
    oldxPos = xPos
    
    gui.text(20,300,"xPos: "..xPos)
    gui.text(20,320,"xSpd: "..xSpeed)
    gui.text(20,340,"  dx: "..dx)
    
    mickeyY = mainmemory.readbyte(0x020B)
    mickeyYSub = mainmemory.readbyte(0x020A)
    
    yPos = mickeyY + mickeyYSub / 256
    ySpeed = mainmemory.read_s16_le(0x020E) / 256
    
    dy = yPos - oldyPos
    oldyPos = yPos
    gui.text(20,380,"yPos: "..yPos)
    gui.text(20,400,"ySpd: "..ySpeed)
    gui.text(20,420,"  dy: "..dy)
    
end

event.onframeend(doStuff)