 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
moro How do I cheat?
Reputation: 0
Joined: 07 Jul 2016 Posts: 4 Location: Russia
|
Posted: Thu Jul 07, 2016 11:18 pm Post subject: Script dont work when reload mission |
|
|
newmem:
mov ecx,[ecx+eax*4+1C]
mov eax,ecx
mov [[[game.exe+417C00]+4]+20],0
i add this pointer here and it works, next i reload mission, pointer change new adress and it no works, i switch off-on script and it again works, how make script for it works always?
|
|
Back to top |
|
 |
cooleko Grandmaster Cheater
Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Fri Jul 08, 2016 3:04 am Post subject: |
|
|
switch to lua, put it on a timer.
|
|
Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Fri Jul 08, 2016 5:20 am Post subject: |
|
|
Or write your pointer in a normal manner, because the pointer expression only gets parsed by CE when activating the script, not when it gets executed.
Try this:
Code: | newmem:
push ecx
mov ecx,["game.exe"+417c00]
test ecx,ecx
jz ifThePointerIsInvalid
mov ecx,[ecx+04]
test ecx,ecx
jz ifThePointerIsInvalid
mov ecx,[ecx+20]
test ecx,ecx
jz ifThePointerIsInvalid
mov dword ptr [ecx],00
ifThePointerIsInvalid:
pop ecx
mov ecx,[ecx+eax*4+1C]
mov eax,ecx |
|
|
Back to top |
|
 |
cooleko Grandmaster Cheater
Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Fri Jul 08, 2016 5:43 am Post subject: |
|
|
Wont your script only work if memory is cleaned/set to zero? If it is simply left alone, and a new section allocated, the script will need to be run again manually.
|
|
Back to top |
|
 |
hhhuut Grandmaster Cheater
Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Fri Jul 08, 2016 7:14 am Post subject: |
|
|
I'm not sure I get what you mean but let me try to explain the difference.
When you hit the "active" checkbox of a script CE processes the script in two steps.
First a parser handles all the allocs, labels, registersymbols, etc. and saves them for later use (symbols for use in addresses, labels for use in jump calculations, and so on).
Afterwards it passes all the actual assemblerlines to CE's assembler, which translates the instructions to bytes that can be written into the RAM.
Only now, CE writes all the code and stuff into the memory.
The line "mov [[[game.exe+417C00]+4]+20],0" is handled by the assembler itself.
Once it encounters a pointer expression like that as an address specifier, it follows the pointer and replaces the line with an absolute address like "mov [12345600],00".
This then is what gets written into the memory.
When you reload the mission and the address changes (i.e. to "23456700"), the original instruction ("mov [12345600],00") is still in the memory and uses a now deprecated address, but how is CE to determine that?
If you now disable and re-enable the script, CE parses the pointer expression ("mov [[[game.exe+417C00]+4]+20],0") once more and retrieves the updated address ("23456700").
Until you reload the mission once more of course.
The solution from my script now always reads the pointer whenever the code gets executed.
The advantage is that if the address changes (from "12345600" to "23456700"), the pointer changes too in order to point to the correct new address, so when the code gets executed the next time, it follows the pointer and is able to retrieve the updated/new address instead of using the old address. So you don't need to re-activate the script all the time.
Btw: I'd also recommend you to code your scripts without using pointer as address specifier
And if I may also recite the source, you get an impression what Dark Byte thinks of it:
Quote: | //looks like a pointer in an address specifier (idiot user detected...) |
|
|
Back to top |
|
 |
cooleko Grandmaster Cheater
Reputation: 11
Joined: 04 May 2016 Posts: 717
|
Posted: Fri Jul 08, 2016 8:30 am Post subject: |
|
|
That is what i get commenting before going to bed. I was confusing an aobscan with this pointer, somehow.
|
|
Back to top |
|
 |
moro How do I cheat?
Reputation: 0
Joined: 07 Jul 2016 Posts: 4 Location: Russia
|
Posted: Sat Jul 09, 2016 5:47 am Post subject: |
|
|
thank you hhhuut, i do
newmem:
mov ecx,[ecx+eax*4+1C]
mov eax,ecx
mov eax,[game.exe+417C00]
mov eax,[eax+4]
mov [eax+20],0
and it works when i reload mission or load other mission
|
|
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
|
|