03-Aug-2015, 9:51 AM
I encountered similar problems. After I did some testing, I came to the conclusion, that after pressing a key for more than 4.2 seconds, the replay does not preserve the information of the key being active any more.
Here is a simple program, to reproduce the behavior, instead of going right 25 tiles as the character should, it just moves 21 tiles in the replay. To avoid this, you have to release the key, and press it again, as in the loop, where the replay shows the correct amount of movement to the left:
Here is a simple program, to reproduce the behavior, instead of going right 25 tiles as the character should, it just moves 21 tiles in the replay. To avoid this, you have to release the key, and press it again, as in the loop, where the replay shows the correct amount of movement to the left:
Code:
local ffi = require "ffi"
local socket = require "socket"
ffi.cdef [[
void keybd_event(unsigned char, unsigned char, unsigned long, unsigned long); ]]
local s = socket.sleep
local a = {r=39,l=37,u=38,d=40}
function p(x)
ffi.C.keybd_event(x,1,0,0) end
function r(x)
ffi.C.keybd_event(x,1,2,0) end
s(4)
p(a["r"])
s(5)
r(a["r"])
s(0.1)
for i=1,25 do
p(a["l"])
s(0.1)
r(a["l"])
s(0.1) end