| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		sitapea1337 Newbie cheater
  Reputation: 0
  Joined: 29 Mar 2010 Posts: 19
 
  | 
		
			
				 Posted: Thu Aug 16, 2012 6:51 am    Post subject: New to LUA | 
				       | 
			 
			
				
  | 
			 
			
				Hello
 
 
I've been trying to get this script working, but no success.
 
It does print address quite fine (in HEX), but doesn't change value of address to "08".
 
 
 	  | Code: | 	 		  function DEC_HEX(IN)
 
    local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
 
    while IN>0 do
 
        I=I+1
 
        IN,D=math.floor(IN/B),math.mod(IN,B)+1
 
        OUT=string.sub(K,D,D)..OUT
 
    end
 
    return OUT
 
end
 
debugProcess()  -- Attach Debugger to the process.
 
function debugger_onBreakpoint()
 
  HEXADDR=DEC_HEX(ESI+19105885)
 
  print(HEXADDR)
 
  writeInteger(HEXADDR,08)
 
  return 1  --Not Break
 
end
 
 
debug_setBreakpoint(0x005057C2)  -- Address where to set breakpoint | 	  
 
 
Weird thing is that when I print "ESI" value, then it's in dec, not hex.
 
So do I need to convert "ESI+19105885" into HEX or I can simply change that address value while it's in DEC?
 
 
PS: Is it possible to breakpoint address "test.exe+1057C2"?
 
"debug_setBreakpoint(test.exe+0x1057C2)" doesn't work.
 
 
Thanks in advance,
 
Sitapea1337
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		oLaudix Expert Cheater
  Reputation: 3
  Joined: 25 Mar 2010 Posts: 138
 
  | 
		
			
				 Posted: Thu Aug 16, 2012 8:40 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				| Do you want to use ESI as value it stores or [ESI] as address under which the value is stored? I dont know how LUA in cheat engine handle this stuff but when i tried to get addresses they were coming out in string -_-
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Dark Byte Site Admin
  Reputation: 470
  Joined: 09 May 2003 Posts: 25807 Location: The netherlands
  | 
		
			
				 Posted: Thu Aug 16, 2012 8:47 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Use getAddress.
 
getAddress takes a string formatted in ce's symbolhandler and returns the address as a value
 
 
two methods
 
 
1:
 
address=getAddress("test.exe")+0x1057c2
 
 
2:
 
address=getAddress("test.exe+1057c2")
 
 
and then debug_setBreakpoint(address)
 
 
 
 
 
use getAddress to get the
 _________________
 Do not ask me about online cheats. I don't know any and wont help finding them.
 
 
Like my help? Join me on Patreon so i can keep helping  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		sitapea1337 Newbie cheater
  Reputation: 0
  Joined: 29 Mar 2010 Posts: 19
 
  | 
		
			
				 Posted: Thu Aug 16, 2012 8:59 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | oLaudix wrote: | 	 		  | Do you want to use ESI as value it stores or [ESI] as address under which the value is stored? I dont know how LUA in cheat engine handle this stuff but when i tried to get addresses they were coming out in string -_- | 	  
 
Value which ESI stores - not the address of ESI.
 
At the moment print shows ESI value as decimal.
 
 
 	  | Code: | 	 		    HEXADDR=DEC_HEX(ESI+19105885) 
 
  print(HEXADDR)
 
writeInteger(HEXADDR,08) | 	  Shows correct address, but "writeInteger(HEXADDR,0 " part doesn't change the value of address, which HEXADDR contains, to "08".
 
 
 
 	  | Dark Byte wrote: | 	 		  Use getAddress.
 
getAddress takes a string formatted in ce's symbolhandler and returns the address as a value
 
 
two methods
 
 
1:
 
address=getAddress("test.exe")+0x1057c2
 
 
2:
 
address=getAddress("test.exe+1057c2")
 
 
and then debug_setBreakpoint(address)
 
 
use getAddress to get the | 	  Thank you very much - works perfectly  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		oLaudix Expert Cheater
  Reputation: 3
  Joined: 25 Mar 2010 Posts: 138
 
  | 
		
			
				 Posted: Thu Aug 16, 2012 9:34 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				| Oh, now i know what you mean. I dont really know if LUA treats HEXADDR as int in this place. Try $HEXADDR.
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		sitapea1337 Newbie cheater
  Reputation: 0
  Joined: 29 Mar 2010 Posts: 19
 
  | 
		
			
				 Posted: Thu Aug 16, 2012 11:29 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Nope - only gives an error.
 
Print prints HEXADDR correctly - as HEX address-
 
Though "writeInteger" doesn't change that addresses value...
 
 
Is "writeInteger" even the right command for changing memory address value?
 
 
EDIT: It seems like that DEC_HEX function returns string value which cannot be used.
 
Though - "ESI+0x123885D" returns decimal value, it still is correct (tested manually with calculator).
 
 
How can I use that decimal value as address? I'd like to change "ESI+0x123885D" address value to "08".
 
 
Manually, when address is in HEX, using writeInteger works perfectly.
 
I think right now the problem is that "ESI+0x123885D" returns as DEC, not HEX, so I can't use it as an address...
 
 
Could anyone help me out here? It's the only problem that's standing in my way...
 
 
 
EDIT2:
 
I feel a bit stupid... I'm trying to change that addresses value and it does change, but very soon after it gets changed again to normal.
 
Breakpoint hits BEFORE actual ASM code.
 
I set breakpoint to next address and now my code works fine  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |