Script that displays on screen the real speed for X, Y, Z, XY, and XYZ.
Now does also show the direction Harry is facing.
--PSX Harry Potter and the Sorcerer Stone - speeed hud script v1.1 by ThunderAxe31
local addr_masterpointer = 0x06C6E0
local addr_offset_a = 0x28
local addr_offset_x = 0x34
local addr_offset_y = 0x3C
local addr_offset_z = 0x38
local x_pos_old = 0
local y_pos_old = 0
local z_pos_old = 0
local framecount = -1
if memory.usememorydomain("MainRAM") then
while true do
local masterpointer = memory.read_u32_le(addr_masterpointer)
local angle = memory.read_s32_le(masterpointer + addr_offset_a)
local x_pos = memory.read_s32_le(masterpointer + addr_offset_x)
local y_pos = memory.read_s32_le(masterpointer + addr_offset_y)
local z_pos = memory.read_s32_le(masterpointer + addr_offset_z)
local speed_x = x_pos - x_pos_old
local speed_y = y_pos - y_pos_old
local speed_z = z_pos - z_pos_old
local speed_xy = (speed_x^2+speed_y^2)^0.5
local speed_xyz = (speed_x^2+speed_y^2+speed_z^2)^0.5
if speed_x > 0 then speed_x = "+" .. speed_x end
if speed_y > 0 then speed_y = "+" .. speed_y end
if speed_z > 0 then speed_z = "+" .. speed_z end
if speed_xy > 0 then speed_xy = "+" .. speed_xy end
if speed_xyz > 0 then speed_xyz = "+" .. speed_xyz end
if framecount == emu.framecount()-1 then
gui.text(0, 132, "Angle: " .. string.format("%8s", angle) .. "\nX: " .. string.format("%5s", speed_x) .. "\nY: " .. string.format("%5s", speed_y) .. "\nZ: " .. string.format("%5s", speed_z) .. "\nXY: " .. string.format("%8s", string.sub(speed_xy, 1, 8)) .. "\nXYZ: " .. string.format("%8s", string.sub(speed_xyz, 1, 8)))
end
x_pos_old = x_pos
y_pos_old = y_pos
z_pos_old = z_pos
framecount = emu.framecount()
emu.frameadvance()
end
end