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 change many address with specifics last address?

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

Joined: 09 Aug 2023
Posts: 3

PostPosted: Wed Aug 09, 2023 4:18 am    Post subject: How to change many address with specifics last address? Reply with quote

How to change many address with specifics last address?.

Example : I have address XXXXXDEC, XXXXXBAC, XXXXX2AC, XXXXX1EC, etc.
With 5 same address in the beginnning and 3 different last address.

My questions is how can i change the XXXXX to YYYYY in the same time without change the 3 last address, i think its more efficients. Surprised
Back to top
View user's profile Send private message Send e-mail
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Wed Aug 09, 2023 4:46 am    Post subject: Reply with quote

What I think you mean is to change the XXXXX but not the last 3 characters of each address. This will give you an idea of how you can achieve this; there may be many ways of achieving it, but this is just one way albeit perhaps not the most efficient:
Code:

local address = 'XXXXXDEC'

local function extractSections(s)
        if s == nil or s == '' then error('Invalid argument passed.') end
        local first_part = s:sub(1,#s-3)
        local second_part = s:sub(6,#s)
        return first_part, second_part
      end

local function replaceSection(str, from, to)
        if from == nil or to == nil then error('Nothing to replace.') end
        return string.gsub(str, from, to)
      end

local from,section = extractSections(address)
print(string.format('First: %s\nSecond: %s', from, section))

local new = replaceSection(address, from, 'YYYYY')
print('After replacement: ' .. new)
Back to top
View user's profile Send private message
YoucefHam
Cheater
Reputation: 5

Joined: 19 Mar 2015
Posts: 39
Location: Algeria

PostPosted: Wed Aug 09, 2023 9:54 am    Post subject: Re: How to change many address with specifics last address? Reply with quote

Yunhan wrote:
How to change many address with specifics last address?.
.........


Hi, here is an other solution, copy the code and paste in cheat engine.
Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>0</ID>
      <Description>"XXXXX000"</Description>
      <ShowAsSigned>0</ShowAsSigned>
      <VariableType>4 Bytes</VariableType>
      <Address>XXXXX000</Address>
      <CheatEntries>
        <CheatEntry>
          <ID>1</ID>
          <Description>"DEC"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>+DEC</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>2</ID>
          <Description>"BAC"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>+BAC</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>3</ID>
          <Description>"2AC"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>+2AC</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>4</ID>
          <Description>"1EC"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>+1EC</Address>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
Back to top
View user's profile Send private message Send e-mail
Yunhan
How do I cheat?
Reputation: 0

Joined: 09 Aug 2023
Posts: 3

PostPosted: Thu Aug 10, 2023 1:32 am    Post subject: Re: How to change many address with specifics last address? Reply with quote

Yunhan wrote:
How to change many address with specifics last address?.

Example : I have address XXXXXDEC, XXXXXBAC, XXXXX2AC, XXXXX1EC, etc.
With 5 same address in the beginnning and 3 different last address.

My questions is how can i change the XXXXX to YYYYY in the same time without change the 3 last address, i think its more efficients. Surprised


Hi! Thanks for all help to my question, actually i don't really expert with this (cheat engine) how to apply the code and don't understand Lua language. From your answer i get some idea, so i made this :
1. Have VSCode
2. Use Python language
3. Copy paste code from cheat engine
Code:

# Input your code from Cheat Engine

xml_content = """
      Your code
"""

import re

def replace_address(match):
    original_address = match.group(0)
    new_address = "<Address>YYYYY" + original_address[14:] #CHANGE ADDRESS 5 DIGIT
    return new_address

pattern = r'<Address>[0-9A-F]+</Address>'
modified_xml_content = re.sub(pattern, replace_address, xml_content)

print(modified_xml_content)

- Done and Run it -
I hope this can be usefull for newbie like me Very Happy , once again thank you for who answered me! you're a kind person. Embarassed
Back to top
View user's profile Send private message Send e-mail
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Thu Aug 10, 2023 1:45 am    Post subject: Reply with quote

There are two ways to access the Lua engine. Memory Viewer > Tools (menu) > Lua Engine, or from the main window press:
Quote:

Ctrl, Alt, Shift + L


From there you can execute Lua code. You can also use an Auto Assembler script and paste the Lua code between a directive:
Code:

[ENABLE]
{$LUA}
if syntaxcheck then return end -- To prevent immediate execution when adding to the table
-- Lua code here
{$ASM}
[DISABLE]
Back to top
View user's profile Send private message
Yunhan
How do I cheat?
Reputation: 0

Joined: 09 Aug 2023
Posts: 3

PostPosted: Sat Aug 12, 2023 3:13 am    Post subject: Reply with quote

LeFiXER wrote:
There are two ways to access the Lua engine. Memory Viewer > Tools (menu) > Lua Engine, or from the main window press:
Quote:

Ctrl, Alt, Shift + L


From there you can execute Lua code. You can also use an Auto Assembler script and paste the Lua code between a directive:
Code:

[ENABLE]
{$LUA}
if syntaxcheck then return end -- To prevent immediate execution when adding to the table
-- Lua code here
{$ASM}
[DISABLE]


Thank you for the explain and your guide master Very Happy that's help me a lot Cool
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials 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