Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


2 Identical scripts. Only 1 works

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
prosportal1
Newbie cheater
Reputation: 0

Joined: 21 May 2015
Posts: 17

PostPosted: Sat Nov 17, 2018 9:55 pm    Post subject: 2 Identical scripts. Only 1 works Reply with quote

I have an AoB script that moves a value into EAX on the array below. If I close and re-open the game, the script won't activate. However, if I find the instruction again (which is using the exact same array of bytes) and create a new identical script, it works just fine.

Both scripts are using exactly this code. The script that doesn't work was saved in the table prior to re-opening the game.

Code:
aobscan(INJECT,89 41 1C 33 C9 85) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
  mov eax,(int)4 //added instruction
  mov [ecx+1C],eax
  xor ecx,ecx
  jmp return

INJECT:
  jmp newmem
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 89 41 1C 33 C9
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sat Nov 17, 2018 10:13 pm    Post subject: Reply with quote

Were you attached to the correct process the first time?
Are any other scripts using the same registered symbol (i.e. INJECT)?
Are you absolutely certain that code existed when you first tried (e.g. JIT compilation)?
Did you restart CE or disable all scripts when you restarted the game?

Probably unrelated, but you should unregister the symbol in the disable section.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
prosportal1
Newbie cheater
Reputation: 0

Joined: 21 May 2015
Posts: 17

PostPosted: Sun Nov 18, 2018 12:58 pm    Post subject: Reply with quote

Were you attached to the correct process the first time? Yes

Are any other scripts using the same registered symbol (i.e. INJECT)? No, they have different registered symbols.

Are you absolutely certain that code existed when you first tried (e.g. JIT compilation)? Yes, I was able to use the script before closing the game and saving the table.

Did you restart CE or disable all scripts when you restarted the game? Yes. I've restarted both game and CE but after the game closed down, the script no longer worked.

Probably unrelated, but you should unregister the symbol in the disable section. The symbol did get unregistered, I just didn't copy that part of the code. I'm using the AOB template in CE.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sun Nov 18, 2018 2:34 pm    Post subject: Reply with quote

prosportal1 wrote:
Yes, I was able to use the script before closing the game and saving the table.
The context of my question was ambiguous- my bad.

The machine code at the injection point doesn't have to exist as soon as you start the game. It doesn't even have to exist while the game is running. If it doesn't exist, the script can't find it, and it will fail to activate. In the case of JIT compilation, you need to do enough actions to get the generic bytecode to compile to machine code. Once that happens, you can find the code just fine.

What I'm asking you to do is copy the AoB pattern in the script and search for it in the main CE window. Set the value type to Array of byte and search through all memory (right click near writable/executable/CoW checkboxes). If nothing shows up, then that code doesn't exist, and the script won't work. If something does show up, then the script should activate just fine.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
prosportal1
Newbie cheater
Reputation: 0

Joined: 21 May 2015
Posts: 17

PostPosted: Sun Nov 18, 2018 10:47 pm    Post subject: Reply with quote

So you're basically saying that, for instance, a script that modifies the number of bullets in a magazine may not activate because the instruction may not be registered in the game until I have fired the gun or possibly even reloaded?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sun Nov 18, 2018 11:05 pm    Post subject: Reply with quote

Pretty much. I would use "compiled" instead of "registered," but besides that, you're correct.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites