|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
SS 4K Newbie cheater Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Fri Dec 10, 2021 8:14 pm Post subject: help converting this script to write big endian value |
|
|
Hey everyone
i use this script to write float value before now im dealing with emulator and idk how modfiy it
i need to write float big endian or 4 byte big endian
Code: |
{$lua}
if syntaxcheck then return end
[ENABLE]
DoneState = false
local addr = 0x1b7F5410C
local val = 1
local function timer_tick(timer)
writeFloat(addr, val + readFloat(addr))
-- writeFloat(addr, val + readFloat(addr))
if DoneState == true then
timer.destroy()
end
end
local someTimer = createTimer(MainForm)
someTimer.Interval = 500
someTimer.OnTimer = timer_tick
[DISABLE]
DoneState = true
|
i really appreciate the help
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sat Dec 11, 2021 1:34 am Post subject: |
|
|
use something like: (untested, on my phone)
Code: |
function writeBigEndianFloat(address, number)
local bt=floatToByteTable(number)
local newbt={}
for i=1,4 do
newbt[5-i]=bt[i]
end
writeByteTable(address, newbt)
end
function readBigEndianFloat(address)
local bbt=readBytes(address,4, true)
local newbt={}
for i=1,4 do
newbt[5-i]=bbt[i]
end
return byteTableToFloat(newbt)
end
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
Last edited by Dark Byte on Sun Dec 12, 2021 3:30 pm; edited 1 time in total |
|
Back to top |
|
|
SS 4K Newbie cheater Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sat Dec 11, 2021 4:52 am Post subject: |
|
|
Dark Byte wrote: | use something like: (untested, on my phone)
Code: |
function writeBigEndianFloat(address, number)
local bt=floatToByteTable(number)
local newbt={}
for i=1,4 do
newbt[5-i]=bt[i]
end
writeByteTable(address, newbt)
end
function readBigEndianFloat(address)
local bbt=readBytes(address,4)
local newbt={}
for i=1,4 do
newbt[5-i]=bbt[i]
end
return byteTableToFloat(newbt)
end
|
|
thanks for response
sorry im not knowledge with reading scripts and what they mean
i just put it with my script and it write normal float valve
i know im doing it wrong , please tell me where i put the address 0x2C7F7F244 and the value 1 like my original script
Code: |
{$lua}
if syntaxcheck then return end
[ENABLE]
DoneState = false
local addr = 0x2C7F7F244
local val = 1
local function timer_tick(timer)
writeFloat(addr, val + readFloat(addr))
-- writeFloat(addr, val + readFloat(addr))
if DoneState == true then
timer.destroy()
end
end
function writeBigEndianFloat(address, number)
local bt=floatToByteTable(number)
local newbt={}
for i=1,4 do
newbt[5-i]=bt[i]
end
writeByteTable(address, newbt)
end
function readBigEndianFloat(address)
local bbt=readBytes(address,4)
local newbt={}
for i=1,4 do
newbt[5-i]=bbt[i]
end
return byteTableToFloat(newbt)
end
local someTimer = createTimer(MainForm)
someTimer.Interval = 500
someTimer.OnTimer = timer_tick
[DISABLE]
DoneState = true
|
appreciate your time
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sat Dec 11, 2021 6:04 am Post subject: |
|
|
You will want to use the writeBigEndianFloat function instead of writeFloat, so instead of:
Code: |
writeFloat(addr, val + readFloat(addr))
|
use this:
Code: |
writeBigEndianFloat(addr, val + readFloat(addr))
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sat Dec 11, 2021 6:13 am Post subject: |
|
|
and put the functions before your writeFloat code, not after
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
SS 4K Newbie cheater Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sat Dec 11, 2021 10:45 am Post subject: |
|
|
LeFiXER wrote: | You will want to use the writeBigEndianFloat function instead of writeFloat, so instead of:
Code: |
writeFloat(addr, val + readFloat(addr))
|
use this:
Code: |
writeBigEndianFloat(addr, val + readFloat(addr))
|
|
Dark Byte wrote: | and put the functions before your writeFloat code, not after |
ok this how i put it and gave me error
Code: |
{$lua}
if syntaxcheck then return end
[ENABLE]
function writeBigEndianFloat(address, number)
local bt=floatToByteTable(number)
local newbt={}
for i=1,4 do
newbt[5-i]=bt[i]
end
writeByteTable(address, newbt)
end
function readBigEndianFloat(address)
local bbt=readBytes(address,4)
local newbt={}
for i=1,4 do
newbt[5-i]=bbt[i]
end
return byteTableToFloat(newbt)
end
DoneState = false
local addr = 0x2C7F7F244
local val = 1
local function timer_tick(timer)
writeBigEndianFloat(addr, val + readFloat(addr))
-- writeFloat(addr, val + readFloat(addr))
if DoneState == true then
timer.destroy()
end
end
local someTimer = createTimer(MainForm)
someTimer.Interval = 500
someTimer.OnTimer = timer_tick
[DISABLE]
DoneState = true
|
Description: |
|
Filesize: |
15.08 KB |
Viewed: |
2399 Time(s) |
|
Description: |
|
Filesize: |
81.22 KB |
Viewed: |
2399 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sat Dec 11, 2021 11:24 am Post subject: |
|
|
replace writeByteTable with writeBytes(address,bytetable,true)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sat Dec 11, 2021 11:25 am Post subject: |
|
|
I believe line 11 should be:
Code: |
writeBytes(address, newbt)
|
|
|
Back to top |
|
|
SS 4K Newbie cheater Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sat Dec 11, 2021 2:04 pm Post subject: |
|
|
Dark Byte wrote: | replace writeByteTable with writeBytes(address,bytetable,true) |
no error this time but now script just keep set in the value to 0 instead of adding 1 overtime
LeFiXER wrote: | I believe line 11 should be:
Code: |
writeBytes(address, newbt)
|
|
value now not increasing with your code just keeping it 1
my goal is to make the script keep adding 1 value not to set it 1
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Sat Dec 11, 2021 5:03 pm Post subject: |
|
|
Another perspective..
Code: | function writeBigEndianFloat(address, number, format)
local bt="" --floatToByteTable(number)
if format == true then
bt=floatToByteTable(number)
end
if format == false then
bt={floatToByteTable(number)}
end
local newbt={}
for i=1,4 do
if format == true then
newbt[5-i]=bt[i] end
if format == false then
newbt[i]=bt[i]
--print(bt[i])
end
end
return writeBytes(address, newbt)
end
function readBigEndianFloat(address,format)
local bbt={readBytes(address,4)}
--for i,k in ipairs(bbt) do
--print("bbt:"..k) end
local newbt1={}
if format == true then
for i=1,4 do
newbt1[5-i]=bbt[i]
end
end
if format == false then
for i=1,4 do
newbt1[i]=bbt[i]
end
end
return byteTableToFloat(newbt1)
end
print("wf-f: "..writeBigEndianFloat(0x1E2EDFE4C0, 1200, false))
print("rf-f: "..readBigEndianFloat(0x1E2EDFE4C0, false))
print("wf-t: "..writeBigEndianFloat(0x1E2EDFE4C0, 1200, true))
print("rf-t: "..readBigEndianFloat(0x1E2EDFE4C0, true)) |
_________________
|
|
Back to top |
|
|
SS 4K Newbie cheater Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sat Dec 11, 2021 7:03 pm Post subject: |
|
|
AylinCE wrote: | Another perspective..
Code: | function writeBigEndianFloat(address, number, format)
local bt="" --floatToByteTable(number)
if format == true then
bt=floatToByteTable(number)
end
if format == false then
bt={floatToByteTable(number)}
end
local newbt={}
for i=1,4 do
if format == true then
newbt[5-i]=bt[i] end
if format == false then
newbt[i]=bt[i]
--print(bt[i])
end
end
return writeBytes(address, newbt)
end
function readBigEndianFloat(address,format)
local bbt={readBytes(address,4)}
--for i,k in ipairs(bbt) do
--print("bbt:"..k) end
local newbt1={}
if format == true then
for i=1,4 do
newbt1[5-i]=bbt[i]
end
end
if format == false then
for i=1,4 do
newbt1[i]=bbt[i]
end
end
return byteTableToFloat(newbt1)
end
print("wf-f: "..writeBigEndianFloat(0x1E2EDFE4C0, 1200, false))
print("rf-f: "..readBigEndianFloat(0x1E2EDFE4C0, false))
print("wf-t: "..writeBigEndianFloat(0x1E2EDFE4C0, 1200, true))
print("rf-t: "..readBigEndianFloat(0x1E2EDFE4C0, true)) |
|
i tried it and write normal float just like my original script
Code: |
{$lua}
if syntaxcheck then return end
[ENABLE]
function writeBigEndianFloat(address, number, format)
local bt="" --floatToByteTable(number)
if format == true then
bt=floatToByteTable(number)
end
if format == false then
bt={floatToByteTable(number)}
end
local newbt={}
for i=1,4 do
if format == true then
newbt[5-i]=bt[i] end
if format == false then
newbt[i]=bt[i]
--print(bt[i])
end
end
return writeBytes(address, newbt)
end
function readBigEndianFloat(address,format)
local bbt={readBytes(address,4)}
--for i,k in ipairs(bbt) do
--print("bbt:"..k) end
local newbt1={}
if format == true then
for i=1,4 do
newbt1[5-i]=bbt[i]
end
end
if format == false then
for i=1,4 do
newbt1[i]=bbt[i]
end
end
return byteTableToFloat(newbt1)
end
print("wf-f: "..writeBigEndianFloat(0x1E2EDFE4C0, 1200, false))
print("rf-f: "..readBigEndianFloat(0x1E2EDFE4C0, false))
print("wf-t: "..writeBigEndianFloat(0x1E2EDFE4C0, 1200, true))
print("rf-t: "..readBigEndianFloat(0x1E2EDFE4C0, true))
DoneState = false
local addr = 0x2C7F7F244
local val = -1
local function timer_tick(timer)
writeFloat(addr, val + readFloat(addr))
-- writeFloat(addr, val + readFloat(addr))
if DoneState == true then
timer.destroy()
end
end
local someTimer = createTimer(MainForm)
someTimer.Interval = 500
someTimer.OnTimer = timer_tick
[DISABLE]
DoneState = true
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Dec 12, 2021 2:25 am Post subject: |
|
|
you're not using the functions
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
SS 4K Newbie cheater Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sun Dec 12, 2021 3:18 am Post subject: |
|
|
Dark Byte wrote: | you're not using the functions |
can you please correct it and post the full script , so i don't have to adjust something that I don't know
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Dec 12, 2021 2:22 pm Post subject: |
|
|
replace writeFloat AND readFloat with the bigendian versions
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Sun Dec 12, 2021 3:07 pm Post subject: |
|
|
Code: | local addr = 0x2C7F7F244
local val = -1
local function timer_tick(timer)
local result = writeBigEndianFloat(addr, val + readBigEndianFloat(addr))
--print("res: ".. result)
-- writeFloat(addr, val + readFloat(addr))
if DoneState == true then
timer.destroy()
end
return result
end
local someTimer = createTimer(MainForm)
someTimer.Interval = 500
someTimer.OnTimer = timer_tick
|
_________________
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|