| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| dinkleberg How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 03 May 2012
 Posts: 1
 
 
 | 
			
				|  Posted: Thu May 03, 2012 11:34 am    Post subject: Adding x to a value by pressing a button with Lua Scripting |   |  
				| 
 |  
				| Hello, I used the Cheat Engine Trainer Maker and added some buttons, now I want to add an x amount to a certain value when I press the button, and also subtract an x amount to a certain value when I press another button. 
 I prefer buttons above hotkeys, but buttons won´t let me do it easily I have to write a function.
 
 function CEButton1Click(sender)
 
 end
 
 
 So what is the function to add an x amount to y value ? Googling didn't really help, only big tutorials where I would have to learn all the basics first, really just want this line..
 
 Thanks!
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Thu May 03, 2012 9:36 pm    Post subject: |   |  
				| 
 |  
				| easiest method: 
  	  | Code: |  	  | writeInteger(address,readInteger(address)+xxx)
 
 | 
 
 for a more complex but more robust, you could make use of memoryrecord_setValue
 _________________
 
 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 |  | 
	
		|  | 
	
		|  |