Updated Crash HA lua - 2.1-beta script with real speed math.
The math is unused.
-- Crash Huge Adventure lua v2.1-beta Virtual Boy Advance
-- This is Community Work Please Help
-- Join in add updates of your own and add your name
-- Values found by: Spikestuff, Got4n, Dica
-- Script Edited by: Spikestuff, Ilari, Dica, TASEditor, RGamma, Warepire
auto = 0
x_pos = 0
y_pos = 0
x_pos_bonus = 0
y_pos_bonus = 0
while true do
area = memory.readbyte(0x3001644)
areab = memory.readbyte(0x200000E)
mask = memory.readbyte(0x200009C)
lvl = memory.readbyte(0x200000E)
ex = memory.readbyte(0x2003AB8)
x_pos_prev = x_pos
y_pos_prev = y_pos
x_pos = memory.readword(0x2010A15)
y_pos = memory.readword(0x2010A19)
x_speed = x_pos - x_pos_prev
y_speed = y_pos - y_pos_prev
real_speed = math.sqrt(x_speed*x_speed + y_speed*y_speed) -- do not trust during jumps!
x_pos_prev_bonus = x_pos_bonus
y_pos_prev_bonus = y_pos_bonus
x_pos_bonus = memory.readword(0x2010E2D)
y_pos_bonus = memory.readword(0x2010E31)
x_speed_bonus = x_pos_bonus - x_pos_prev_bonus
y_speed_bonus = y_pos_bonus - y_pos_prev_bonus
real_speed_bonus = math.sqrt(x_speed_bonus*x_speed_bonus + y_speed_bonus*y_speed_bonus) -- do not trust during jumps!
if ex > 0 and ex <= 3 or area == 1 or area == 5 or area == 8 or area == 9 or area == 11 or area == 13 or area == 14 or area == 15 or area == 16 or area == 17 then
auto = 0
else
if input.get()["i"] or input.get()["I"] then
auto = 1
else if input.get()["o"] or input.get()["O"] then
auto = 0
end end end
if auto == 1 then -- Automatic Slide Spin Script. Still needs to be worked on.
if area ~= 6 then -- Normal
gui.text(2,24,"Automatic Mode","yellow")
if memory.readwordsigned(0x2010A74) >= 100 and memory.readwordsigned(0x2010DDC) == 0 and memory.readwordsigned(0x2010A78) == 0 then
joypad.set(1,{right = true, R = true})
end
if memory.readwordsigned(0x2010A74) < 800 and memory.readwordsigned(0x2010A74) > 700 then
joypad.set(1,{right = true, B = true});
end
if memory.readwordsigned(0x2010A74) <= -100 and memory.readwordsigned(0x2010DDC) == 0 and memory.readwordsigned(0x2010A78) == 0 then
joypad.set(1,{left = true, R = true})
end
if memory.readwordsigned(0x2010A74) > -800 and memory.readwordsigned(0x2010A74) < -700 then
joypad.set(1,{left = true, B = true});
end
else -- Bonus Round
gui.text(2,24,"Automatic Mode","orange")
if memory.readwordsigned(0x2010E8C) >= 100 and memory.readwordsigned(0x20111F4) == 0 and memory.readwordsigned(0x2010E90) == 0 then
joypad.set(1,{right = true, R = true})
end
if memory.readwordsigned(0x2010E8C) < 800 and memory.readwordsigned(0x2010E8C) > 700 then
joypad.set(1,{right = true, B = true});
end
if memory.readwordsigned(0x2010E8C) <= -100 and memory.readwordsigned(0x20111F4) == 0 and memory.readwordsigned(0x2010E90) == 0 then
joypad.set(1,{left = true, R = true})
end
if memory.readwordsigned(0x2010E8C) > -800 and memory.readwordsigned(0x2010E8C) < -700 then
joypad.set(1,{left = true, B = true});
end end
end
if area == 11 or area == 13 or area == 14 or area == 15 or area == 16 or area == 17 then else
if area == 5 or area == 9 then
gui.text(2,32,memory.readwordsigned(0x3003F34),"orange")
else
if area == 2 and areab == 3 or area == 18 then
gui.text(2,120,memory.readwordsigned(0x3001404),"yellow")
else
gui.text(2,120,memory.readwordsigned(0x300082C),"yellow")
end end end
if area == 9 then -- N.Gin Fight
bhealth = memory.readbyte(0x3004130)
thealth = memory.readbyte(0x30040B0)
lhealth = memory.readshort(0x30041B0)
rhealth = memory.readshort(0x3004230)
if bhealth == 255 or bhealth == -1 then else
gui.text(18,48,"Bomb: " .. (bhealth+1)/2) end
if lhealth == 0 and rhealth == 0 then else
gui.text(6,56,"Rockets: " .. (lhealth/2) .. "/" .. (rhealth/2)) end
if thealth == 255 or thealth == -1 then else
gui.text(10,64,"Turret: " .. (thealth+1)/2) end
end
if area == 8 then -- Dingodile Fight
dshi = memory.readbyte(0x2003EFC)
gui.text(2,24,"Shield: " .. ((dshi == 1) and "ON" or "OFF")); else
end
if area == 16 then
slide_count = 0
aku = memory.readbyte(0x200009C)
gui.text(2,9,"Mask Level: " .. aku,"yellow") else
end
if area == 2 and areab == 3 or area == 18 then else
if area == 11 or area == 13 or area == 14 or area == 15 or area == 16 or area == 17 then else
if area == 6 then --Bonus
gui.text(2,32,"Pixel X: " .. memory.readword(0x2010E2D))
gui.text(2,40,"Pixel Y: " .. memory.readword(0x2010E31))
gui.text(2,48,"Speed X: " .. memory.readwordsigned(0x2010E8C))
gui.text(2,56,"Speed Y: " .. memory.readwordsigned(0x2010E90))
gui.text(2,128,"Slide Time: 22/" .. memory.readwordsigned(0x20111F4),"orange")
gui.text(2,136," Spin Time: 23/" .. memory.readwordsigned(0x20111F4),"orange")
else
if area == 5 or area == 9 then -- Flying Cooldown
cdwn = memory.readbyte(0x30014E0)-1
if cdwn ~= -1 then
gui.text(2,40,"Cooldown: " .. cdwn)
end
else
if area == 10 then -- Neo Cortex and Mega Mix
gui.box(0,142,240,160,"black")
gui.text(188,143,"Pixel X: " .. memory.readword(0x2010A15))
gui.text(188,151,"Pixel Y: " .. memory.readword(0x2010A19))
gui.text(124,143,"Speed X: " .. memory.readwordsigned(0x2010A74))
gui.text(124,151,"Speed Y: " .. memory.readwordsigned(0x2010A78))
gui.text(132,134,"Slide: 22| " .. memory.readwordsigned(0x2010DDC).. " |23 :Spin","yellow")
else -- Normal
gui.text(2,32,"Pixel X: " .. memory.readword(0x2010A15))
gui.text(2,40,"Pixel Y: " .. memory.readword(0x2010A19))
gui.text(2,48,"Speed X: " .. memory.readwordsigned(0x2010A74))
gui.text(2,56,"Speed Y: " .. memory.readwordsigned(0x2010A78))
if area == 1 or area == 8 then
gui.text(2,136," Spin Dur.: 24/" .. memory.readwordsigned(0x2010DDC),"green")
else
gui.text(2,128,"Slide Time: 22/" .. memory.readwordsigned(0x2010DDC),"yellow")
gui.text(2,136," Spin Time: 23/" .. memory.readwordsigned(0x2010DDC),"yellow") end
end end end end end
if movie.active()==false then
gui.drawbox(0,0,78,8, "red")
gui.text(2,1, "MOVIE NOT RECORDING")
else gui.text(2,1,"RR: " .. movie.rerecordcount())
end
vba.frameadvance() end