| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| CheatEngEnthusiast How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 25 Oct 2024
 Posts: 5
 
 
 | 
			
				|  Posted: Fri Oct 25, 2024 5:27 am    Post subject: [help] If value under X, set to Y |   |  
				| 
 |  
				| Hello, I'm a complete noob at scripting on CE, but I need help about scripting this action: 
 Info:
 I have the pointer(s) for the adress.
 The value is in float.
 
 Script:
 "If the value of the adress in float that this POINTER points to is less than X(x is 2.0) then set the value to Y (y is 10)
 
 Additional Info:
 I did the find out what writes to this adress thing but when I changed it to NOP then the game froze, Id rather just use the pointer and a script.
 The minimum of X is 0 automatically.
 I do this because freezing the adress crashes the game during cutscenes.
 
 Help would be appreciated thank you!
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| LeFiXER Grandmaster Cheater Supreme
 
 ![]() Reputation: 20 
 Joined: 02 Sep 2011
 Posts: 1069
 Location: 0x90
 
 | 
			
				|  Posted: Fri Oct 25, 2024 6:47 am    Post subject: |   |  
				| 
 |  
				| Say you have X and Y pointers within the Cheat Table with the description X pointer and Y pointer respectively, then you can do this: 
  	  | Code: |  	  | [ENABLE]
 {$LUA}
 if syntaxcheck then return end
 local x = AddressList['X Pointer']
 local y = AddressList['Y Pointer']
 if x == nil or y == nil then error('Unable to find X/Y Pointer entries in the address list') end
 if x.Value < 2.0 then
 y.setValue(10)
 end
 {$ASM}
 [DISABLE]
 
 | 
 
 It should be noted that comparing float values can be inaccurate.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| MDon How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 20 Dec 2024
 Posts: 4
 
 
 | 
			
				|  Posted: Fri Dec 20, 2024 8:10 am    Post subject: Re: [help] If value under X, set to Y |   |  
				| 
 |  
				| x = math.max(0,x) |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |