Update: Fixed a bug
A lua script to watch position, velocity and measured position change. Made for my TAS tutorial: https://youtu.be/m-Ar0fv17Vk?list=PLlJzD6wWmoXmihK13itZJ-mzjK3SD1EaM
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)