| 
			
				|  | Cheat Engine The Official Site of Cheat Engine
 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Sat Jun 18, 2011 7:57 am    Post subject: Hotkey and DLL inject problem |   |  
				| 
 |  
				| Hey, i have 2 problems with CE 
 First, in LUA script code i have function, for example
 
 function setSpeed2(bla)
 speedhack_setSpeed(2.00)
 timer_setEnabled(t,false)
 end
 
 and
 
 function setSpeed5(bla)
 speedhack_setSpeed(5.00)
 timer_setEnabled(t,false)
 end
 
 Im making standalone EXE trainer and i dont know how i can add hotkey to this functions, whats the right command for LUA code ?
 
 Adding Hotkeys in generator dont works because its not Table Address
 
 And second, is there a way to make dll injection for already specified EXE,and build this dll into final EXE by Add File in generator ?
 
 Thx
 |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Sat Jun 18, 2011 8:41 am    Post subject: |   |  
				| 
 |  
				| first off, remove the timer_setEnabled lines, that is only needed if you run it from a timer (and that is only needed if you start using the onOpenProcess method, or if you want to use a timer to gradually adjust speed) 
 then to add a hotkey for that function specifically just use createHotkey
 
 example a ctrl+f1 and ctrl+f2 hotkey would be:
 
 
  	  | Code: |  	  | createHotkey(setSpeed2, VK_CONTROL, VK_F1)
 createHotkey(setSpeed5, VK_CONTROL, VK_F2)
 
 | 
 
 check defines.lua in the ce folder for more VK_ codes
 
 as for dll injection:
 Yes, if you use add file in the exe generator part that file will be placed in the base Cheat Engine folder (or a specified subfolder if you choose to)
 
 just basic injectDll(filename) in auto assembler and/or lua script will work, but if you want to be sure, you can make use of "getCheatEngineDir" to get the full path to the folder the trainer is running in
 _________________
 
 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 |  |  
		|  |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Sat Jun 18, 2011 8:51 am    Post subject: |   |  
				| 
 |  
				| Thanks you so much, i didn't know there is sth like defines file with commands,will check it   |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Sat Jun 18, 2011 9:10 am    Post subject: |   |  
				| 
 |  
				| I also recommend checking main.lua for other command (or the scripting section in the helpfile) _________________
 
 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 |  |  
		|  |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Sat Jun 18, 2011 9:12 am    Post subject: |   |  
				| 
 |  
				| Hey, i have one more fast question, if i want to set a key from numpad for my hotkey, what should write instead of 1,2,3... ? 
 I mean i dont want to bound default numbers on my keyboard for hotkeys, but that ones on numpad
   |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Sat Jun 18, 2011 9:18 am    Post subject: |   |  
				| 
 |  
				| when numlock is on: 
  	  | Code: |  	  | VK_NUMPAD0 = 96
 VK_NUMPAD1 = 97
 VK_NUMPAD2 = 98
 VK_NUMPAD3 = 99
 VK_NUMPAD4 = 100
 VK_NUMPAD5 = 101
 VK_NUMPAD6 = 102
 VK_NUMPAD7 = 103
 VK_NUMPAD8 = 104
 VK_NUMPAD9 = 105
 VK_MULTIPLY = 106
 VK_ADD = 107
 VK_SEPARATOR = 108
 VK_SUBTRACT = 109
 VK_DECIMAL = 110
 VK_DIVIDE = 111
 
 | 
 
 when numlock is off it's
 VK_UP, VK_DOWN, VK_NEXT, etc... (numpads can be tricky)
 _________________
 
 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 |  |  
		|  |  
		| atom0s Moderator
 
  Reputation: 205 
 Joined: 25 Jan 2006
 Posts: 8587
 Location: 127.0.0.1
 
 |  |  
		| Back to top |  |  
		|  |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Sun Jun 19, 2011 11:11 am    Post subject: |   |  
				| 
 |  
				| I still doing something wrong. The most important part of my code is 
 
  	  | Code: |  	  | strings_add(getAutoAttachList(), "UT3.exe") 
 function setSpeed2(bla)
 speedhack_setSpeed(2.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed5(bla)
 speedhack_setSpeed(5.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed10(bla)
 speedhack_setSpeed(10.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed20(bla)
 speedhack_setSpeed(20.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed50(bla)
 speedhack_setSpeed(50.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed100(bla)
 speedhack_setSpeed(100.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed200(bla)
 speedhack_setSpeed(200.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed500(bla)
 speedhack_setSpeed(500.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 
 end
 
 strings_add(getAutoAttachList(), "UT3.exe")
 
 function setSpeed1(bla)
 speedhack_setSpeed(1.00)
 timer_setEnabled(t,false)
 end
 
 function onOpenProcess(pid)
 t=createTimer(nil)
 timer_onTimer(t, setSpeed)
 timer_setInterval(t,1)
 timer_setEnabled(t, true)
 | 
 
 I know there shouldnt be so many strings add and timers, but it all have worked when i assined those functions to each buttons in Generator and if i run it in game with Alt tab to generated trainer and choose one of those speeds ( cllicking on button), it works in game
 
 But i still cant bind hotkeys to them
 
 i add that code at the end of script :
 
  	  | Code: |  	  | createHotkey(setSpeed2, VK_CONTROL, VK_F1) | 
 
 But it dont work in game
 
 Later i deleted timer code, it doesnt work too, then i changed (bla) from setSpeed2(bla) to (), and it doesnt work anyway.
 
 I tried also
 to bind Speed2 to 1 on my numpad but it also failed, 	  | Code: |  	  | CreateHotkey(setSpeed2, 97) | 
 
 I really dont know what i am doing wrong
   |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Sun Jun 19, 2011 12:11 pm    Post subject: |   |  
				| 
 |  
				| tip: Do not blindly copy paste scripts without knowing how they work 
 1: Get rid of all your timer commands as you're not using a timer but hotkeys
 
 2: You have defined 9 onOpenProcess function may only have 1
 
 3: You are adding ut3.exe 9 times to the auto attach list, you only need 1
 
 4: createHotkey, not CreateHotkey
 _________________
 
 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 |  |  
		|  |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Sun Jun 19, 2011 12:36 pm    Post subject: |   |  
				| 
 |  
				| So finnaly looks like 
  	  | Code: |  	  | strings_add(getAutoAttachList(), "UT3.exe") 
 function setSpeed2(bla)
 speedhack_setSpeed(2.00)
 end
 
 function onOpenProcess(pid)
 
 
 end
 
 
 function setSpeed5(bla)
 speedhack_setSpeed(5.00)
 end
 
 
 
 
 
 function setSpeed10(bla)
 speedhack_setSpeed(10.00)
 end
 
 
 
 
 
 function setSpeed20(bla)
 speedhack_setSpeed(20.00)
 end
 
 
 
 function setSpeed50(bla)
 speedhack_setSpeed(50.00)
 end
 
 
 
 
 function setSpeed100(bla)
 speedhack_setSpeed(100.00)
 end
 
 
 
 function setSpeed200(bla)
 speedhack_setSpeed(200.00)
 
 end
 
 
 function setSpeed500(bla)
 speedhack_setSpeed(500.00)
 end
 
 
 
 
 function setSpeed1(bla)
 speedhack_setSpeed(1.00)
 end
 
 createHotkey(setSpeed2, VK_CONTROL, VK_F1)
 
 | 
 
 But id dont works, even if i replace last part with
 or 	  | Code: |  	  | createHotkey(VK_CONTROL, VK_F2, setSpeed5) 
 | 
 
  	  | Code: |  	  | createHotkey(setSpeed10, 116) | 
 
 Nevermind, it can be trainer without hotkeys at the end
   |  |  
		| Back to top |  |  
		|  |  
		| GH*master Expert Cheater
 
  Reputation: 8 
 Joined: 10 Jan 2008
 Posts: 159
 
 
 | 
			
				|  Posted: Sun Jun 19, 2011 11:16 pm    Post subject: |   |  
				| 
 |  
				| Sc00rpY, try this my Lua code: 
 
  	  | Code: |  	  | speed = 1.0
 
 function IncSpeed(hotkey)
 speed = speed + 1
 speedhack_setSpeed(speed)
 end
 
 function DecSpeed(hotkey)
 speed = speed - 1
 speedhack_setSpeed(speed)
 end
 
 function ResetSpeed(hotkey)
 speed = 1.0
 speedhack_setSpeed(1.0)
 end
 
 
 function SetHotKey(func, hotkey)
 local objectHotKey =  createHotkey(func, hotkey)
 generichotkey_setKeys(objectHotKey, hotkey)
 generichotkey_onHotkey(objectHotKey, func)
 end
 
 
 function onOpenProcess(processid)
 SetHotKey(IncSpeed, VK_F2)
 SetHotKey(DecSpeed, VK_F3)
 SetHotKey(ResetSpeed, VK_F4)
 end
 
 local aalist = getAutoAttachList()
 stringlist_add(aalist, "UT3.exe")
 | 
 |  |  
		| Back to top |  |  
		|  |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Mon Jun 20, 2011 9:57 am    Post subject: |   |  
				| 
 |  
				| Your script worls perfectly, thanks ! 
 Now i can modifty it to my speeds
   
 There is one disadvantage in this code - if you reduce game speed too much, the game will freeze ( speed under 0 )
 
 I think there is no way to block set game speed as 0 ?
 
 THX !
 |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Jun 20, 2011 10:11 am    Post subject: |   |  
				| 
 |  
				| Guess there's a problem with createhotkey init I'll look into it for nextversion. 
 as for the speed 0 thing try this:
 
  	  | Code: |  	  | function DecSpeed(hotkey)
 if (speed - 1) > 0 then
 speed = speed - 1
 speedhack_setSpeed(speed)
 end
 end
 
 | 
 in short: If the new speed is bigger than 0 then decrease the speed, else do nothing
 _________________
 
 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 |  |  
		|  |  
		| Sc00rpY How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 18 Jun 2011
 Posts: 6
 
 
 | 
			
				|  Posted: Mon Jun 20, 2011 11:36 am    Post subject: |   |  
				| 
 |  
				| Will check if it works, thx ! |  |  
		| Back to top |  |  
		|  |  
		| Dark Byte Site Admin
 
  Reputation: 470 
 Joined: 09 May 2003
 Posts: 25807
 Location: The netherlands
 
 | 
			
				|  Posted: Mon Jun 20, 2011 12:40 pm    Post subject: |   |  
				| 
 |  
				| tip: you can also decrease in steps of 0.5, and 0.1 so if you want to go lower than 1 (slow motion) just decrease with 0.5 for half speed, and 0.1 for 1/10th speed
 (0 is obviously freeze, and negative will make the time go backwards, not many games support that though)
 _________________
 
 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 |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |  |