Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x1 = 0
- x2 = 0
- z1 = 0
- z2 = 0
- t1 = 0
- t2 = 0
- rp = 0x022077CC --room pointer address (E: 0x0220A264)
- srp = 0x0232E7CC --subroom pointer address
- ctrl = 1 --0 for adults, 1 for babies
- in_a_subroom = 1
- --TODO: find addresses for these
- if in_a_subroom == 1 then rp = srp ctrl = 0 end
- destx = 215 --destination x-coordinate
- destz = 256 --destination z-coordinate
- local xv,zv,dt,parity
- function fn()
- parity = memory.readbyte(0x023FFC3C)%2
- offset = ctrl*0x3100+0x00F4
- xa = memory.readdword(rp)+offset
- za = xa+4
- x = memory.readdword(xa)/0x1000
- z = memory.readdword(za)/0x1000
- if parity == 0 then
- x1 = x
- xv = x1-x2
- z1 = z
- zv = z1-z2
- end
- if parity == 1 then
- x2 = x
- xv = x2-x1
- z2 = z
- zv = z2-z1
- end
- --x = string.format("%x", x)
- --z = string.format("%x", z)
- gui.text(0,0,"Velocity:")
- gui.text(10,0,"X")
- gui.text(20,0,"Z")
- gui.text(40,0,"Position")
- gui.text(0,40,x)
- gui.text(0,50,z)
- --gui.text(0,60,z-x)
- if math.abs(xv) < 30 then
- gui.text(10,0,xv)
- else
- gui.text(10,0,"??")
- end
- if math.abs(zv) < 14 then
- gui.text(0,10,zv)
- else
- gui.text(0,10,"??")
- end
- end
- function fcn()
- parity = memory.readbyte(0x023FFC3C)%2
- offset = ctrl*0x3100+0x00F4
- xa = memory.readdword(rp)+offset
- --xa = 0x02315FE8
- za = xa+4
- x = memory.readdword(xa)/0x1000
- z = memory.readdword(za)/0x1000
- t = Time(x, z, destx, destz)
- if parity == 0 then
- t1 = t
- dt = t1-t2
- end
- if parity == 1 then
- t2 = t
- dt = t2-t1
- end
- gui.text(0,0,-dt)
- gui.text(0,20,t)
- end
- function Time(xi,zi,xf,zf)
- x = math.abs(xf-xi)
- z = math.abs(zf-zi)
- output = x/1.5
- if x > z then
- output = x/2 + z/6
- end
- if x < z then
- output = x/6 + z/2
- end
- return output
- end
- gui.register(fn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement