|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4297
|
Posted: Sun May 06, 2018 4:22 pm Post subject: |
|
|
Sarge411 wrote: | Does lua in CE have any form of syncing primitives? I looked at celua.txt but couldn't find any. | There are critical sections if you need them, but you probably don't.
Why are you looking at celua.txt if you're using CE 6.6? celua.txt was added in CE 6.7.
Sarge411 wrote: | Sometimes the cheat works, sometimes it doesn't. | It's probably because you're not perfectly pressing the hotkey. Hold the key down for more than 150ms, and the script will disable itself right after it just enabled. Hold it down for less than 150ms, and it might not see the keypress.
IMO hotkeys would be far easier. The delayBetweenActivate property would solve that problem.
Sarge411 wrote: | If the newly created thread runs a while loop, what happens to the main thread? | Probably nothing. If the main thread needs to run Lua code, it might be blocked if the other thread is constantly doing work, but that usually isn't a problem.
Sarge411 wrote: | Can it be that if CE doesn't read fast enough from memory before it writes to it, an original value is overwritten? E.g. if the health is read but the read doesn't finish before write is called and 0 (the initial value of healthVal) gets written to memory instead? | If you're referring to the read* and write* functions, no. Function calls can't get reordered like that in Lua. Something like that might happen if more than one thread is accessing the same address concurrently, but not for a single thread.
If you think you have that problem, it's probably because you executed that code more than once without restarting CE. Every time you execute that script, it spawns a new thread. The old threads don't just disappear. Since each new thread runs an infinite loop with no exit condition, there's no good way of getting rid of it besides closing CE.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Sarge411 Newbie cheater Reputation: 0
Joined: 21 Apr 2018 Posts: 21
|
Posted: Thu May 17, 2018 1:21 pm Post subject: |
|
|
ParkourPenguin wrote: |
Why are you looking at celua.txt if you're using CE 6.6? celua.txt was added in CE 6.7.
|
I added functions from CE 6.7 to 6.6 (read(write)SmallInteger).
ParkourPenguin wrote: | It's probably because you're not perfectly pressing the hotkey. Hold the key down for more than 150ms, and the script will disable itself right after it just enabled. Hold it down for less than 150ms, and it might not see the keypress.
IMO hotkeys would be far easier. The delayBetweenActivate property would solve that problem.
|
Something like this?
Code: |
local h = createHotkey(startCheat , VK_NUMPAD0)
h.DelayBetweenActivate = 150
function startCheat()
...
end
|
But how is it different from waiting for the user to press a certain key (the cheat activation key is different from any operation keys)? or is it event based?
ParkourPenguin wrote: | If you're referring to the read* and write* functions, no. Function calls can't get reordered like that in Lua. Something like that might happen if more than one thread is accessing the same address concurrently, but not for a single thread.
If you think you have that problem, it's probably because you executed that code more than once without restarting CE. Every time you execute that script, it spawns a new thread. The old threads don't just disappear. Since each new thread runs an infinite loop with no exit condition, there's no good way of getting rid of it besides closing CE. |
Can CE keep references to threads? (and simply close all started threads?)
I finished but it gets choppy at times (this may be due to specs though) and the camera base needs to be updated (e.g. upon making an 180 degree turn the camera base doesn't rotate (moving forward results in moving backwards)). This can be fixed using:
Code: |
If the ground is the X Y plane, Z points upward, and Camera V angle is 0 when you look at the horizon, you move the camera forward by adding:
Speed*cos(Camera H angle)*cos(Camera V angle) to x
Speed*sin(Camera H angle)*cos(Camera V angle) to y
Speed*sin(Camera V angle) to z
To move to the left side, add:
Speed*sin(Camera H angle) to x
Speed*cos(Camera H angle) to y
For sin/cos calculation, you can use the fsin/fcos/fsincos instructions (warning: they use angles in radians, so one full turn = 2*pi ~= 6.28 ).
|
Can CE monitor a memory area (or ranges) for variations in values? 'm thinking about using heuristics to this end (look for things that change often and remember the address).
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4297
|
Posted: Thu May 17, 2018 3:47 pm Post subject: |
|
|
Sarge411 wrote: | Something like this? | Define the function before you refer to it, destroy old hotkeys from previous script invocations, and make the delayBetweenActivate property greater than the keypoll interval.
Sarge411 wrote: | But how is it different from waiting for the user to press a certain key (the cheat activation key is different from any operation keys)? or is it event based? | The difference is that createHotkey, when used correctly, won't have the bugs your code had.
Sarge411 wrote: | Can CE keep references to threads? (and simply close all started threads?) | That's your responsibility.
Sarge411 wrote: | Can CE monitor a memory area (or ranges) for variations in values? | If it's a specific address you want to monitor, I wrote a Lua extension a year or two ago that did this [topic]. If you want to monitor pages of memory at a time, you could use page exceptions, but that would make most games extremely slow and unplayable.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
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
|
|