 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
ND_JOHN How do I cheat?
Reputation: 0
Joined: 25 Jul 2018 Posts: 4
|
Posted: Fri Sep 07, 2018 1:43 pm Post subject: changing how fast the float value increases by |
|
|
DoneState = true
local addr = 0x10BC9C400 - insert address add a 0x because of float
local val = -1
local function timer_tick(timer)
local v = readFloat(addr) -- read value
if v < 0 then -- check value
writeFloat(addr, val + v) -- write value
else
DoneState = true -- this stops the timer, if value if > 100
end
if DoneState == true then
timer.destroy()
end
end
Hi I wanted to know if there is a way to to increase and decrease values several times over a different period of time during the same script.
For example The value of all the addresses in the picture I have linked is currently at 0, I would like the script to change all the values to 150 after 3 seconds, then the values change again to 60 after 1 second.
Also I would like the change in values to be gradual rather than instant, for example if the values are 0 and they are changing to 150 I would like it to go 0,1,2,3,4,5,6,7,8 all the way to 150 within the given time frame.
Thank you.
| Description: |
|
| Filesize: |
209.12 KB |
| Viewed: |
2175 Time(s) |

|
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Fri Sep 07, 2018 5:33 pm Post subject: |
|
|
hm, maybe something like this... it feels like there should be a better approach though.
| Code: | function change(addresses, delta, time, readFunc, writeFunc)
if delta > time then error('change was written to change values by 1 at a time, but delta is greater than milliseconds given to work change in', 2) end
readFunc = readFunc or readFloat
writeFunc = writeFunc or writeFloat
local t = createTimer()
local add = delta > 0
delta = abs(delta)
t.Interval = floor(time / delta)
t.OnTimer = function(t)
for addr in addresses do
local val = readFunc(addr)
if add then val = val + 1 else val = val -1 end
writeFunc(addr, val)
end
delta = delta - 1
if delta <= 0 then t.destroy() end
end
return t
end
function delay(time, f)
local t = createTimer()
t.Interval = time
t.OnTimer = function(t)
if not f(t) then t.destroy() end
end
return t
end
local address = {}
for i=0,AddressList.Count-1 do
addresses[#addresses+1] = AddressList[i].CurrentAddress
end
change(addresses, 150, 3000)
delay(3000, function() change(addresses, 60-150, 1000) end) |
_________________
|
|
| Back to top |
|
 |
ND_JOHN How do I cheat?
Reputation: 0
Joined: 25 Jul 2018 Posts: 4
|
Posted: Sun Sep 09, 2018 6:31 am Post subject: |
|
|
| FreeER wrote: | hm, maybe something like this... it feels like there should be a better approach though.
| Code: | function change(addresses, delta, time, readFunc, writeFunc)
if delta > time then error('change was written to change values by 1 at a time, but delta is greater than milliseconds given to work change in', 2) end
readFunc = readFunc or readFloat
writeFunc = writeFunc or writeFloat
local t = createTimer()
local add = delta > 0
delta = abs(delta)
t.Interval = floor(time / delta)
t.OnTimer = function(t)
for addr in addresses do
local val = readFunc(addr)
if add then val = val + 1 else val = val -1 end
writeFunc(addr, val)
end
delta = delta - 1
if delta <= 0 then t.destroy() end
end
return t
end
function delay(time, f)
local t = createTimer()
t.Interval = time
t.OnTimer = function(t)
if not f(t) then t.destroy() end
end
return t
end
local address = {}
for i=0,AddressList.Count-1 do
addresses[#addresses+1] = AddressList[i].CurrentAddress
end
change(addresses, 150, 3000)
delay(3000, function() change(addresses, 60-150, 1000) end) |
|
I tried the code and i got a error
| Description: |
|
| Filesize: |
259.36 KB |
| Viewed: |
2115 Time(s) |

|
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Sep 09, 2018 10:38 am Post subject: |
|
|
hm, apparently I typoed creating the table as "address" instead of "addresses"
_________________
|
|
| 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
|
|