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 


need help for a script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
oyyzj
Cheater
Reputation: 0

Joined: 21 May 2011
Posts: 46

PostPosted: Fri Jul 01, 2016 10:39 am    Post subject: need help for a script Reply with quote

Hi as the topic says I need help for a script.

I have this OP-Code

sub [ecx+eax*2],dx // contains sub ammo and everything else

now I normally go to Memory Viewer manually and change edx to 01 or 00

Now I want to ask is how to write a correct script so that I don't have to open Memory Viewer and change it manually everytime.


Thank you in advance. Exclamation
Back to top
View user's profile Send private message
oyyzj
Cheater
Reputation: 0

Joined: 21 May 2011
Posts: 46

PostPosted: Sun Jul 03, 2016 10:47 am    Post subject: Reply with quote

*bump*
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jul 03, 2016 11:07 am    Post subject: Reply with quote

Memory Viewer > Tools > Auto Assemble > Template > AOB Injection
Back to top
View user's profile Send private message
oyyzj
Cheater
Reputation: 0

Joined: 21 May 2011
Posts: 46

PostPosted: Wed Jul 06, 2016 11:01 am    Post subject: Reply with quote

Zanzer wrote:
Memory Viewer > Tools > Auto Assemble > Template > AOB Injection


It seems you didn't even understand what I want.

I need help to write few working line of additional OP-codes that do what I manually input everytime. I tried for example like following

aobscan(INJECT,66 29 54 41) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
sub [ecx+eax*2],dx
mov edx,01
jmp return

INJECT:
jmp code
return:
registersymbol(INJECT)

but it doesn't do anything.
Back to top
View user's profile Send private message
Cake-san
Grandmaster Cheater
Reputation: 8

Joined: 18 Dec 2014
Posts: 541
Location: Semenanjung

PostPosted: Wed Jul 06, 2016 11:54 am    Post subject: Reply with quote

if all's well, File -> Assign to current cheat table -> activate your script.
_________________
...
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jul 06, 2016 2:16 pm    Post subject: Reply with quote

oyyzj wrote:
Zanzer wrote:
Memory Viewer > Tools > Auto Assemble > Template > AOB Injection
It seems you didn't even understand what I want.
-Zanzer understands...you do not.
Back to top
View user's profile Send private message
oyyzj
Cheater
Reputation: 0

Joined: 21 May 2011
Posts: 46

PostPosted: Wed Jul 06, 2016 4:41 pm    Post subject: Reply with quote

Cake-san wrote:
if all's well, File -> Assign to current cheat table -> activate your script.


nah the game crashes.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Wed Jul 06, 2016 6:43 pm    Post subject: Reply with quote

bad code, post it and we may help
Back to top
View user's profile Send private message
oyyzj
Cheater
Reputation: 0

Joined: 21 May 2011
Posts: 46

PostPosted: Thu Jul 07, 2016 10:02 am    Post subject: Reply with quote

cooleko wrote:
bad code, post it and we may help


This is what I get when I use Aobinjection from template

[ENABLE]

aobscan(INJECT,66 29 54 41) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
sub [ecx+eax*2],dx
jmp return

INJECT:
jmp code
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
db 66 29 54 41

unregistersymbol(INJECT)
dealloc(newmem)


Now.. how do I write additional correct OP-code to change dx to 01 ?? that is what I want to know.

I tried to add a simple line mov dx,01 but game crashed.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Jul 07, 2016 10:57 am    Post subject: Reply with quote

You didn't seem to post the whole thing... there should've been two instructions it copied over.
Not just "sub [ecx+eax*2],dx"

If that literally was the whole script CE gave you, then select the whole chunk of code around that instruction within memory viewer and press CTRL-C to copy it. Paste that here so Dark Byte can see if there is some bug within CE.

But, this should work for you...
Code:
[ENABLE]
aobscan(INJECT,66 29 54 41)
INJECT:
dec word ptr [ecx+eax*2]
registersymbol(INJECT)

[DISABLE]
INJECT:
db 66 29 54 41
unregistersymbol(INJECT)
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Thu Jul 07, 2016 2:38 pm    Post subject: Reply with quote

The reason we believe an error occured is because a jmp code requires 5 bytes, the code you showed us acted on 4 bytes, something is wrong. If you write 5 byte of code onto 4 byte of memory, memory will be off by 1 byte and will crash on the next jump, branch, or return that is in any memory higher than the injected code.
Back to top
View user's profile Send private message
oyyzj
Cheater
Reputation: 0

Joined: 21 May 2011
Posts: 46

PostPosted: Fri Jul 08, 2016 8:54 am    Post subject: Reply with quote

Zanzer wrote:
You didn't seem to post the whole thing... there should've been two instructions it copied over.
Not just "sub [ecx+eax*2],dx"

If that literally was the whole script CE gave you, then select the whole chunk of code around that instruction within memory viewer and press CTRL-C to copy it. Paste that here so Dark Byte can see if there is some bug within CE.

But, this should work for you...
Code:
[ENABLE]
aobscan(INJECT,66 29 54 41)
INJECT:
dec word ptr [ecx+eax*2]
registersymbol(INJECT)

[DISABLE]
INJECT:
db 66 29 54 41
unregistersymbol(INJECT)




dec word ptr [ecx+eax*2],01 // didn't work, compiler doesn't understand this instruction

I changed sub word ptr [ecx+eax*2],01 // Works fine. Thanks for this idea.
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Fri Jul 08, 2016 9:08 am    Post subject: Reply with quote

dec, or decrement, subtracts 1 automatically.

You dont need to provide the ,1 to dec because it is built into the instruction.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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