| View previous topic :: View next topic |
| Author |
Message |
SS 4K Newbie cheater
Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sat Aug 03, 2019 2:36 am Post subject: lua timer (AutoWrite value) |
|
|
Hi
i find This script made by Tim(thx) and i want to do some modifications on it
| Code: |
{$lua}
------------------------------ ENABLE ------------------------------
[ENABLE]
DoneState = false
local addr = 0x12345678
local val = 1
local function timer_tick(timer)
local v = readInterer(addr) -- read value
if v < 100 then -- check value
writeInteger(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
if syntaxcheck then return end
local someTimer = createTimer(MainForm)
someTimer.Interval = 3000
someTimer.OnTimer = timer_tick
------------------------------ DISABLE ------------------------------
[DISABLE]
if syntaxcheck then return end
DoneState = true -- this stops the timer, when the script is disabled
|
i don't want the timer to stop at 100 , I want when it reach 100 to set the value to 0 then start again Increasing
i want it loop like this with no stop until i disabled the script
Thanks for your help
Last edited by SS 4K on Sun Aug 04, 2019 6:02 am; edited 2 times in total |
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Aug 03, 2019 7:56 am Post subject: |
|
|
Then change where it sets the DoneState from eg. | Code: | else
DoneState = true -- this stops the timer, if value if > 100 | to | Code: | else
writeInteger(addr, 0) -- write 0 |
_________________
|
|
| Back to top |
|
 |
SS 4K Newbie cheater
Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sun Aug 04, 2019 5:21 am Post subject: |
|
|
| FreeER wrote: | Then change where it sets the DoneState from eg. | Code: | else
DoneState = true -- this stops the timer, if value if > 100 | to | Code: | else
writeInteger(addr, 0) -- write 0 |
|
Ty FreeER
work perfect
One last thing , if only want to check the address value without increasing
I change this
to
is this The proper way ?
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Aug 04, 2019 9:24 am Post subject: |
|
|
well you'd be better off changing it to not call the writeInteger function if you don't want to change it, since lua isn't running as part of the game it is possible for the value to be changed between the time lua reads the value and writes it, which would change it back to the value that was read. This can happen with +1 as well but there's not really a good way around it if you do want to write, but if you don't want to change it then you just don't call anything that could change it.
But yeah, changing val to 0 would basically cause it to add 0 which is a no op and write the same value back to memory.
_________________
|
|
| Back to top |
|
 |
SS 4K Newbie cheater
Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Sun Aug 04, 2019 4:36 pm Post subject: |
|
|
| FreeER wrote: | well you'd be better off changing it to not call the writeInteger function if you don't want to change it, since lua isn't running as part of the game it is possible for the value to be changed between the time lua reads the value and writes it, which would change it back to the value that was read. This can happen with +1 as well but there's not really a good way around it if you do want to write, but if you don't want to change it then you just don't call anything that could change it.
But yeah, changing val to 0 would basically cause it to add 0 which is a no op and write the same value back to memory. |
Ty FreeER
that helpful info
|
|
| Back to top |
|
 |
SS 4K Newbie cheater
Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Mon Aug 05, 2019 7:06 am Post subject: |
|
|
| FreeER wrote: | well you'd be better off changing it to not call the writeInteger function if you don't want to change it, since lua isn't running as part of the game it is possible for the value to be changed between the time lua reads the value and writes it, which would change it back to the value that was read. This can happen with +1 as well but there's not really a good way around it if you do want to write, but if you don't want to change it then you just don't call anything that could change it.
But yeah, changing val to 0 would basically cause it to add 0 which is a no op and write the same value back to memory. |
i know the address required to be in lua format 0x1324567 , but can i use something like this
| Code: | | local addr = [myplayer]+12 |
if not then please modify it or add another script that can do like this
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Mon Aug 05, 2019 8:15 am Post subject: |
|
|
you can use local addr = '[myplayer]+12', lua itself doesn't know anything about reading memory from other programs so can't use pointers but nearly all the functions CE provides works with strings and will accept anything you can put into the address list as an address.
If you want to do math with the address (perhaps an array) then you can use getAddress('[myplayer]+12') to get CE to return the address as a number or getAddressSafe if you're worried about a pointer in the chain being 0 and don't want getAddress to raise an error (but instead return... 0 iirc)
_________________
|
|
| Back to top |
|
 |
SS 4K Newbie cheater
Reputation: 0
Joined: 21 Feb 2019 Posts: 21
|
Posted: Tue Aug 06, 2019 8:55 am Post subject: |
|
|
| FreeER wrote: | you can use local addr = '[myplayer]+12', lua itself doesn't know anything about reading memory from other programs so can't use pointers but nearly all the functions CE provides works with strings and will accept anything you can put into the address list as an address.
If you want to do math with the address (perhaps an array) then you can use getAddress('[myplayer]+12') to get CE to return the address as a number or getAddressSafe if you're worried about a pointer in the chain being 0 and don't want getAddress to raise an error (but instead return... 0 iirc) |
Ty FreeER
I Tested
| Code: | | local addr = '[myplayer]+12' |
| Code: | | getAddress('[myplayer]+12') |
| Code: | | getAddressSafe('[myplayer]+12') |
all them work perfect
also is the < mean Less than ? i see its doing the opposite
|
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Tue Aug 06, 2019 9:42 am Post subject: |
|
|
yeah < means less than, so the code in the if statement would only run if the value of the v variable is less than 100
_________________
|
|
| Back to top |
|
 |
|