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 


How to transfer value to script?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Wed Feb 18, 2015 6:25 pm    Post subject: How to transfer value to script? Reply with quote

So, I hope the image explains things, cause I donno how to explain it...[/img]
Basically, how do I make it so that whenever I change the value it uses it in the "sub" opcode? So I don't have to keep going to the script and changing it, or when the value changes by-itself it updates it in the script.



How to.png
 Description:
 Filesize:  29.99 KB
 Viewed:  4812 Time(s)

How to.png


Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Wed Feb 18, 2015 8:10 pm    Post subject: Reply with quote

Not sure if this is the best way but this should work.
Add this script
Code:
[Enable]
alloc(Cave,128)
registersymbol(Cave)

Cave+8:
mov [Cave+4],ecx
mov ecx,[Cave]//<- Value of Cave
sub [ebx+00000480],ecx
mov ecx,[Cave+4]
jmp Tutorial-i386.exe+25001


Tutorial-i386.exe+24FFB:
jmp Cave+8
db 90

[Disable]
Tutorial-i386.exe+24FFB:
sub [ebx+00000480],eax

unregistersymbol(Cave)
dealloc(Cave)


Now manually add an address and call if Cave
Whatever value you change the address, the instruction will sub that.

If you change this line in the script
Code:
mov ecx,[Cave]

to something like
Code:
mov ecx,[Whatever Address You Want]

The value of that address will be subbed.

_________________
Back to top
View user's profile Send private message
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Thu Feb 19, 2015 11:24 am    Post subject: Reply with quote

Pingo wrote:
Not sure if this is the best way but this should work.
Add this script
Code:
[Enable]
alloc(Cave,128)
registersymbol(Cave)

Cave+8:
mov [Cave+4],ecx
mov ecx,[Cave]//<- Value of Cave
sub [ebx+00000480],ecx
mov ecx,[Cave+4]
jmp Tutorial-i386.exe+25001


Tutorial-i386.exe+24FFB:
jmp Cave+8
db 90

[Disable]
Tutorial-i386.exe+24FFB:
sub [ebx+00000480],eax

unregistersymbol(Cave)
dealloc(Cave)


Now manually add an address and call if Cave
Whatever value you change the address, the instruction will sub that.

If you change this line in the script
Code:
mov ecx,[Cave]

to something like
Code:
mov ecx,[Whatever Address You Want]

The value of that address will be subbed.

Isn't there a simpler way? I just want a value from the cheat table to be used in my script.
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 Feb 19, 2015 2:05 pm    Post subject: Reply with quote

His code is relatively simple. A few things I would've done differently, but that's the beauty of programming. There is no one right answer!

I'll start with CE's generated code to try to help you see what's going on.

Code:
[ENABLE]
// create a custom variable
alloc(myvar,4)
registersymbol(myvar)
myvar: // initialize it to zero
db 00 00 00 00

alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:

originalcode:
push ecx // save the value incase it is needed later
mov ecx,[myvar] // get our custom variable
sub [ebx+00000480],ecx // subtract our value from the address
pop ecx // restore the value we previously pushed

exit:
jmp returnhere

Tutorial-i386.exe+24FFB:
jmp newmem
nop
returnhere:

[DISABLE]
unregistersymbol(myvar)
dealloc(myvar)
// other generated code


Then create a custom variable in the table as he said and set the address to myvar.
Back to top
View user's profile Send private message
deama1234
Master Cheater
Reputation: 3

Joined: 20 Dec 2014
Posts: 328

PostPosted: Thu Feb 19, 2015 3:24 pm    Post subject: Reply with quote

Zanzer wrote:
His code is relatively simple. A few things I would've done differently, but that's the beauty of programming. There is no one right answer!

I'll start with CE's generated code to try to help you see what's going on.

Code:
[ENABLE]
// create a custom variable
alloc(myvar,4)
registersymbol(myvar)
myvar: // initialize it to zero
db 00 00 00 00

alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:

originalcode:
push ecx // save the value incase it is needed later
mov ecx,[myvar] // get our custom variable
sub [ebx+00000480],ecx // subtract our value from the address
pop ecx // restore the value we previously pushed

exit:
jmp returnhere

Tutorial-i386.exe+24FFB:
jmp newmem
nop
returnhere:

[DISABLE]
unregistersymbol(myvar)
dealloc(myvar)
// other generated code


Then create a custom variable in the table as he said and set the address to myvar.

How do I make "myvar" point to an adress? Like say if I got an adress on my table that has a value of 59, how do I point "myvar" to it?
EDIT: Nvm, I figured it out, thanks for the help guys!
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Thu Feb 19, 2015 7:10 pm    Post subject: Reply with quote

@Zanzer
Your way is much better i'd say.
I never really did much ASM coding.

_________________
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 Gamehacking 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