User File #19475041526918621

Upload All User Files

#19475041526918621 - TearRing Saga RNG display script

rng_script.lua
798 downloads
Uploaded 12/17/2014 1:06 AM by lapogne36 (see all 25)
With french commentaries, how lucky you are.
rngvalues={
{1;8;10;12;13;14;15;16};
{17;18;19;20;21;21;22;23};
{24;24;25;25;26;27;28;29};
{30;30;31;32;33;34;35;35};
{36;37;38;39;40;40;41;42};
{43;44;45;45;46;47;48;49};
{50;50;51;52;53;54;55;55};
{56;57;58;59;60;60;61;62};
{63;64;65;65;66;67;68;69};
{70;70;71;72;73;74;75;75};
{76;77;77;78;79;80;80;81};
{82;83;84;85;86;87;88;89};
{91;93;95;98;255;255;255;255};
{255;255;255;255;255;255;255;255};
{255;255;255;255;255;255;255;255};
{255;255;255;255;255;255;255;255}
}

while true do

State1 = savestate.create();

rng=memory.readword(0x000CC270)
ref=rng

predict={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}


for i=rng-3,math.min(624,rng+16) do

byte1=memory.readbytesigned(0x000E9848+i*0x00000004)
byte2=memory.readbytesigned(0x000E9848+i*0x00000004+0x00000001)
byte3=memory.readbytesigned(0x000E9848+i*0x00000004+0x00000002)
byte4=memory.readbytesigned(0x000E9848+i*0x00000004+0x00000003)


line=1
col=1
pol=0

-------------------------------------------------------------byte1 col

if byte1 % 64 > 31 then
	col=col+4
end

if byte1 % 16 > 7 then
	pol=pol+1
end

-------------------------------------------------------------byte1 line

D=1

--if byte2 % 128 > 63 then
--	D=-D
--end

--if byte3 % 8 > 3 then
--	D=-D
--end

--if byte4 % 64 > 31 then
--	D=-D
--end

--if byte4 % 4 > 1 then
--	D=-D
--end

if byte1 % 256 > 127 then
	line=line+2*D			
end

-------------------------------------------------------------byte2 col

C=2*math.floor((byte2 % 32)/8)
D=1

col=col+D*C	--peut aussi aller en diminuant // corrig�

if byte2 % 8 > 3 then
	pol=pol+1
end

if byte2 % 128 > 63 then
	pol=pol+1
end

-------------------------------------------------------------byte2 line

line=((line-1) % 16) + 1
F=line

G=2*math.floor(byte2/64)

--if byte4 % 4 > 1 then
--	G=-G
--end

--if byte4 % 64 > 31 then
--	G=-G
--end

--if byte3 % 8 > 3 then
--	G=-G
--end

if byte1 % 256 > 127 then
	G=-G
end


line=line+G		--peut aller en diminuant // corrig�

if (line-1) % 16 > 7 then
	if (F-1) % 16 < 8 then
		line=line+8
	end
	else if (F-1) % 16 > 7 then
		line=line+8
	end
end


-------------------------------------------------------------byte3



if byte3 % 2 == 1 then
	line=line+8
	col=col+4
end



if byte3 % 8 > 3 then
	F=2
--	if byte4 % 4 > 1 then
--		F=-1
--	end
--	if byte4 % 64 > 31 then
--		F=-1
--	end
	if byte2 % 128 > 63 then
		F=-F
	end
	if byte1 % 256 > 127 then
		F=-F
	end
	line=line+F				--peut aussi aller en augmentant // corrig�
end




if byte3 % 64 > 31 then
	if line % 2 == 1 then 
		line=line+1
		else line=line-1
	end
	pol=pol+1
end

A=2*math.floor((byte3 % 32)/8)

if byte2 % 16 > 7 then
	A=-A
end

if byte3 % 128 > 63 then
	A=-A
end

col=col+A

Q=2*math.floor(byte3/64)

if byte2 % 16 > 7 then
	Q=-Q
end

col=col+Q

-------------------------------------------------------------byte4 col

M=2*math.floor(byte4/64)



A=2*math.floor(byte4/4) 

if byte4 % 128 > 63 then
	A=-A
end

if byte2 % 16 > 7 then
	A=-A
	M=-M
end

if byte3 % 16 > 7 then
	A=-A
	M=-M
end

if byte3 % 128 > 63 then
	A=-A
	M=-M
end

col=col+A+M		-- corrig� ?

if byte4 % 4 > 1 then
	pol=pol+1
end

-------------------------------------------------------------byte4 line

if byte4 % 2 == 1 then
	line=line+8
end

J=2*math.floor(byte4/32)

if byte3 % 8 > 3 then
	J=-J
end

if byte2 % 128 > 63 then
	J=-J
end

if byte1 % 256 > 127 then
	J=-J
end

if byte4 % 32 > 15 then
	if line % 2 == 1 then
		line=line+1
	else line=line-1
	end
end

line=line+J

K=2*math.floor(byte4/2)

if byte3 % 8 > 3 then
	K=-K
end

if byte2 % 128 > 63 then
	K=-K
end

if byte1 % 256 > 127 then
	K=-K
end

if byte4 % 64 > 31 then
	K=-K
end

line=line+K

L=1

if byte4 % 64 > 31 then
	L=-L
end

if byte4 % 128 > 63 then
	L=-L
end

if byte3 % 8 > 3 then
	L=-L
end

if byte2 % 256 > 127 then
	L=-L
end

if byte2 % 128 > 63 then
	L=-L
end

if byte1 % 256 > 127 then
	L=-L
end

if (L==-1) and byte4 % 8 > 3 then
	line=line+8
end

N=1

if byte1 % 256 > 127 then
	N=-N
end

if byte2 % 256 > 127 then
	N=-N
end

if byte2 % 128 > 63 then
	N=-N
end

if byte3 % 8 > 3 then
	N=-N
end

if N==-1 and (byte4 % 128 > 63) then
	line=line+8
end

------------------------------------------------------------- fin

pol=pol % 2

if pol == 1 then
	col=col+1
end

line=((line-1) % 16)+1
col=((col-1) % 8)+1

predict[i-rng+4]=rngvalues[line][col]

end





while rng==ref do
	gui.text(300,21,predict[1])
	gui.text(300,31,predict[2])
	gui.text(300,41,predict[3])
	gui.text(300,51,predict[4])
	gui.text(300,61,predict[5])
	gui.text(300,71,predict[6])
	gui.text(300,81,predict[7])
	gui.text(300,91,predict[8])
	gui.text(300,101,predict[9])
	gui.text(300,111,predict[10])
	gui.text(300,121,predict[11])
	gui.text(300,131,predict[12])
	gui.text(300,141,predict[13])
	gui.text(300,151,predict[14])
	gui.text(300,161,predict[15])
	gui.text(300,171,predict[16])
	gui.text(300,181,predict[17])
	gui.text(300,191,predict[18])
	gui.text(300,201,predict[19])
	gui.text(300,211,predict[20])
	gui.text(290,51,"->")
	gui.text(280,21,rng)
	gui.text(280,31,memory.readbyte(0x000E984C))
	emu.frameadvance();
	rng=memory.readword(0x000CC270)
end

end