| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Yunhan How do I cheat?
  Reputation: 0
  Joined: 09 Aug 2023 Posts: 3
 
  | 
		
			
				 Posted: Wed Aug 09, 2023 4:18 am    Post subject: How to change many address with specifics last address? | 
				       | 
			 
			
				
  | 
			 
			
				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.   
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		LeFiXER Grandmaster Cheater Supreme
  Reputation: 20
  Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
  | 
		
			
				 Posted: Wed Aug 09, 2023 4:46 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				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 | 
		 | 
	
	
		  | 
	
	
		YoucefHam Cheater
  Reputation: 5
  Joined: 19 Mar 2015 Posts: 39 Location: Algeria
  | 
		
			
				 Posted: Wed Aug 09, 2023 9:54 am    Post subject: Re: How to change many address with specifics last address? | 
				       | 
			 
			
				
  | 
			 
			
				 	  | 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 | 
		 | 
	
	
		  | 
	
	
		Yunhan How do I cheat?
  Reputation: 0
  Joined: 09 Aug 2023 Posts: 3
 
  | 
		
			
				 Posted: Thu Aug 10, 2023 1:32 am    Post subject: Re: How to change many address with specifics last address? | 
				       | 
			 
			
				
  | 
			 
			
				 	  | 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.    | 	  
 
 
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    , once again thank you for who answered me! you're a kind person.  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		LeFiXER Grandmaster Cheater Supreme
  Reputation: 20
  Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
  | 
		
			
				 Posted: Thu Aug 10, 2023 1:45 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				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 | 
		 | 
	
	
		  | 
	
	
		Yunhan How do I cheat?
  Reputation: 0
  Joined: 09 Aug 2023 Posts: 3
 
  | 
		
			
				 Posted: Sat Aug 12, 2023 3:13 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | 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   that's help me a lot  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |