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 


A script that copies static value A to B, C, D, E..

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
koenji
How do I cheat?
Reputation: 0

Joined: 15 Oct 2018
Posts: 3

PostPosted: Sat Aug 03, 2019 8:37 am    Post subject: A script that copies static value A to B, C, D, E.. Reply with quote

Just as a topic says. I feel like this would be something easy to do as i can set this up with the group config option, but actually having this in a script..
I don't know how to write it. I've done a few scripts and been looking at other people's scripts and haven't seen what I wanted to help create this.

(Was going to put an image of the memory view of what i'm explaining, I put it as an attachment instead) Laughing

In short, I'm basically trying to make a script that copies whatever's in Address 1427608F0 in Tekken 7 (Which is the menu video marked as CS_00) to 3 other addresses, these 3 other addresses are different videos (respectively marked CS_01, CS_02, CS_03), The plan is to make the script check Value A which is also linked to the dropdown menu as long as the script is active and change these other video values so you get to "select" a video to play on the main menu.

The problem is i don't know how to structure the script to do that and then "clean up" after itself when it's done. (Revert the values back to their old ones) these videos as well never change which makes it more easier but i don't know how would i go about writing this, so i'd really appreciate and love some help on this! it's something i could apply to other tables i make as well.



rgVdIxH.png
 Description:
 Filesize:  14.62 KB
 Viewed:  2370 Time(s)

rgVdIxH.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 153

Joined: 06 Jul 2014
Posts: 4734

PostPosted: Sat Aug 03, 2019 9:52 am    Post subject: Reply with quote

If that's all constant static data, just change it with an AA script:
Code:
[enable]
foo.dll+904:
  db 30
foo.dll+914:
  db 30
foo.dll+924:
  db 30

[disable]
foo.dll+904:
  db 31
foo.dll+914:
  db 32
foo.dll+924:
  db 33

You could do the same in Lua using writeBytes if you really wanted to:
Code:
writeBytes('foo.dll+904',0x30)
...

_________________
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
koenji
How do I cheat?
Reputation: 0

Joined: 15 Oct 2018
Posts: 3

PostPosted: Sat Aug 03, 2019 4:53 pm    Post subject: Reply with quote

I notice in the lua script you use foo.dll, apologise my noobiness but what exactly is foo.dll?

And I see the script as well is to change everything to address 30 on activation, which is solves the problem. but this will be linked to a dropdown menu, and it won't always be uh 30. That dropdown menu option will write to those addresses. sometimes it could be "Gallery_loop" (which is also a video file) which the drop down menu has.

Hoping this makes more sense, the main thing is what is foo.dll Shocked
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Aug 03, 2019 7:26 pm    Post subject: Reply with quote

Quote:
what exactly is foo.dll?
whatever you need it to be. It's a placeholder for whatever module your address is in eg. Tekken7.exe or tekkenstuff.dll etc.
_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 153

Joined: 06 Jul 2014
Posts: 4734

PostPosted: Sat Aug 03, 2019 7:34 pm    Post subject: Reply with quote

"foo.dll" is in arbitrary module loaded in the process's address space. Those addresses are green, so I'm assuming it's in an exe or dll file. It's generally better to refer to those addresses as module+offset as opposed to a linear address.

koenji wrote:
That dropdown menu option will write to those addresses.
Are you sure? That region looks read-only from your picture. Regardless, allocate some memory and backup the old values there:
Code:
[enable]
alloc(backup,1024)
label(value1)
label(value2)
...
registersymbol(value1)
registersymbol(value2)
...
backup:
value1:
  readmem(address1,1)  // reads 1 byte from address1
value2:
  readmem(address2,1)  // reads 1 byte from address2
...

address1:
  db 30
address2:
  db 30
...
[disable]
dealloc(backup)

unregistersymbol(value1)
unregistersymbol(value2)
...

address1:
  readmem(value1,1)
address2:
  readmem(value2,1)
...

If you really want to use Lua, you can save those values in a global variable to pass it between the enable and disable sections. (you should still put the Lua in an AA script via a {$lua} tag since it's easier to enable/disable)

_________________
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 -> Cheat Engine Lua Scripting 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