Poor quality, first time lua, etc.
Currently serves as a glorified ram watch (with some colors) and as a hitbox viewer for Yoh.
-- GBA Shaman King - Master of Spirits, TASing script
-- Simple script; glorified ram watch, with flexibility for future things
-- if need be wrote
-- Warning: shit quality!
-- Written by xy2_
-- Globals --------------------------------------------------------------------
-- Opaque colors
local OColor={
[0]=0xFF00FF00, -- Green
0xFFFFFF00, -- Yellow
0xFFFF0000, -- Red
0xFFBA8E7D, -- Brown
0xFF0000FF, -- Blue
0xFF665046 -- Dark brown
}
-- Transparent colors
local TColor={
[0]=0x8800FF00, -- Green
0x88FFFF00, -- Yellow
0x88FF0000, -- Red
0x88BA8E7D, -- Brown
0x880000FF, -- Blue
0x88665046 -- Dark brown
}
-- Display stuff on screen with gui.pixelText
-- Also contains some logic for when values reach a threshold
-------------------------------------------------------------------------------
local function DisplayHud()
-------------------------------------------------------------------------------
-- Furyoku
local frk= memory.read_u16_le(0x22BE, "IWRAM")
gui.pixelText (0, 0, string.format("%4d", frk), 0xFFFFFFFF, TColor[4])
-- Furyoku refill
local frefill= memory.read_u16_le(0x22CA, "IWRAM")
if frefill == 0 then
gui.pixelText(0, 7, string.format("%4d", frefill), 0xFFFFFFFF, TColor[0])
else
gui.pixelText(0, 7, string.format("%4d", frefill), 0xFFFFFFFF, TColor[2])
end
-- Health
local health= memory.read_u16_le(0x3636, "IWRAM")
gui.pixelText (18, 0, string.format("%4d", health), OColor[1])
-- In-game time (current area)
local igtframearea= memory.read_u32_le(0x3629, "IWRAM")
gui.pixelText(180, 0, string.format("%8d", igtframearea), 0xFFFFFFFF, TColor[3])
-- In-game time (global)
local igtframe= memory.read_u32_le(0x1DD8, "IWRAM")
gui.pixelText(180, 7, string.format("%8d", igtframe), 0xFFFFFFFF, TColor[5])
-- Global timer
local globalframe= memory.read_u32_le(0x1DD4, "IWRAM")
gui.pixelText(180, 14, string.format("%8d", globalframe))
-- Speed
for i= 0,1 do
local addr= 0x3650 + 0x4*i
gui.pixelText(215 , 7*i, string.format("%6d",memory.read_s32_le(addr,"IWRAM")))
end
-- Timer
local timer= memory.read_u16_le(0x362D,"IWRAM")
if timer == 0 then
gui.pixelText(219, 14, string.format("%5d", timer), 0xFFFFFFFF, TColor[0])
else
gui.pixelText(219, 14, string.format("%5d", timer), OColor[3])
end
-- Ground/air? Displays G on ground, A on air
local grorair= memory.read_u8(0x3614, "IWRAM")
if grorair == 1 then
gui.pixelText(215, 14, "G", 0xFFFFFFFF, TColor[4])
else
gui.pixelText(215, 14, "A", 0xFFFFFFFF, TColor[1])
end
-- Buffered down input timer to backdash
local downbuffer= memory.read_u8(0x25C3, "IWRAM")
if downbuffer >= 1 then
gui.pixelText(219, 21, "V" .. string.format("%4d", downbuffer), 0xFFFFFFFF, TColor[0])
else
gui.pixelText(219, 21, string.format("%5d", downbuffer), 0xFFFFFFFF, TColor[5])
end
-- X and Y position
for i= 0,1 do
local addr= 0x3648 + 0x4*i
gui.pixelText(203, 35+7*i, string.format("%9d",memory.read_s32_le(addr,"IWRAM")), 0xFFFFFFFF, TColor[5])
end
end
-- Draws some hitboxes, and then some things on top
-------------------------------------------------------------------------------
local function DrawHitbox()
-------------------------------------------------------------------------------
-- Yoh's hitbox
-- Figure out appropriate pixel values
local cameraX, cameraY= memory.read_s32_le(0x1E50, "IWRAM")/256, memory.read_s32_le(0x1E54, "IWRAM")/256
local yohX1, yohX2= memory.read_s32_le(0x3664, "IWRAM")/256, memory.read_s32_le(0x3668, "IWRAM")/256
local yohY1, yohY2= memory.read_s32_le(0x366C, "IWRAM")/256, memory.read_s32_le(0x3670, "IWRAM")/256
local yohpixelX1, yohpixelX2= yohX1-cameraX+120, yohX2-cameraX+120
local yohpixelY1, yohpixelY2= cameraY-yohY1+80, cameraY-yohY2+80
local invicibility= memory.read_u16_le(0x3630, "IWRAM")
-- Add invicibility counter if Yoh is invicible
if invicibility >= 1 then
gui.drawBox (yohpixelX1, yohpixelY1, yohpixelX2, yohpixelY2, OColor[1], TColor[1])
gui.pixelText (yohpixelX1, yohpixelY1, invicibility, 0xFFFFFFFF, TColor[1])
else
gui.drawBox (yohpixelX1, yohpixelY1, yohpixelX2, yohpixelY2, 0xFFC64A00, 0x55C64A00)
end
-- Yoh's facing direction
local fdirection= memory.read_u8(0x3634, "IWRAM")
if fdirection == 1 then
gui.pixelText (yohpixelX1, yohpixelY2 - 8, "<")
else
gui.pixelText (yohpixelX1, yohpixelY2 - 8, ">")
end
-- Yoh's raw damage output
local rawdmg= memory.read_u8(0x3638, "IWRAM")
gui.pixelText (yohpixelX1 + 8, yohpixelY2 - 8, rawdmg, 0xFFFFFFFF, TColor[2])
end
-------------------------------------------------------------------------------
-- Main loop
-------------------------------------------------------------------------------
while true do
DisplayHud()
DrawHitbox()
emu.frameadvance()
end