|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
tomsolo Newbie cheater Reputation: 1
Joined: 20 Dec 2011 Posts: 18
|
Posted: Fri May 25, 2012 7:07 am Post subject: Execute / trigger a hotkey |
|
|
Hi there.
I tried using the memoryrecordhotkey_doHotkey(hotkey) command when initaliaze the trainer, but this is not working if use a generated/saved exe.
It's a bug or my fault?
Code: | RequiredCEVersion=6.2
if (getCEVersion==nil) or (getCEVersion()<RequiredCEVersion) then
messageDialog('Please install Cheat Engine '..RequiredCEVersion, mtError, mbOK)
closeCE()
end
addresslist=getAddressList()
memrec0=addresslist_getMemoryRecordByID(addresslist,0)
memrec0_hotkey0=memoryrecord_getHotkeyByID(memrec0,0)
function onHotkey0(Hotkey)
cheatcomponent_setActive(CETrainer_CHEAT0, true, 1500)
if gBeepOnAction then
beep()
end
end
memoryrecordhotkey_onHotkey(memrec0_hotkey0,onHotkey0)
memoryrecordhotkey_doHotkey(memrec0_hotkey0)
control_setVisible(CETrainer_SEPERATOR, false)
strings_add(getAutoAttachList(), "firefox.exe")
gBeepOnAction=false
form_show(CETrainer)
function AboutClick()
showMessage(gAboutText)
end
gAboutText=[[This trainer was made by Cheat Engine]]
function CloseClick()
closeCE()
return caFree
end |
Regards
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Fri May 25, 2012 7:35 am Post subject: |
|
|
Does it work if you save it as a .ct and execute the lua code ?
Actually nevermind I see your problem, you are calling memoryrecordhotkey_doHotkey before cheat engine has even attached to the game (it hasn't even been added to the autoattach timer)
use openProcess("firefox.exe"), or use a timer that calls doHotkey after a second, or create the "function onOpenProcess(processid)" that gets called whenever ce opens a process (like the autoattach)
_________________
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 |
|
|
tomsolo Newbie cheater Reputation: 1
Joined: 20 Dec 2011 Posts: 18
|
Posted: Fri May 25, 2012 7:50 am Post subject: |
|
|
The order is indifferent, i tried pasting as last row but the command non executed. (The gui is working, but the address still unchanged.)
Here is the CETRAINER file (the address is a random writeable, maybe need changing).
If lua executed in CE is working, just as standalone no.
Description: |
|
Download |
Filename: |
TEST.CETRAINER |
Filesize: |
2.76 KB |
Downloaded: |
978 Time(s) |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Fri May 25, 2012 7:55 am Post subject: |
|
|
As I said, you're doing the onHotkey command before the process has been opened (registering the process to the autoattach timer doesn't immediately open the process)
I've uploaded a version where it calls openProcess (and while not needed right now, reinitializeSymbolhandler() in case you decide to use aa scripts/modulename+offset addresses later)
Note that if firefox is not loaded it might give an error (not sure, haven't tested that situation)
Description: |
|
Download |
Filename: |
TEST.CETRAINER |
Filesize: |
2.82 KB |
Downloaded: |
957 Time(s) |
_________________
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 |
|
|
tomsolo Newbie cheater Reputation: 1
Joined: 20 Dec 2011 Posts: 18
|
Posted: Fri May 25, 2012 7:58 am Post subject: |
|
|
Gotcha.
Need both this and now working...
Code: |
RequiredCEVersion=6.2
if (getCEVersion==nil) or (getCEVersion()<RequiredCEVersion) then
messageDialog('Please install Cheat Engine '..RequiredCEVersion, mtError, mbOK)
closeCE()
end
addresslist=getAddressList()
memrec0=addresslist_getMemoryRecordByID(addresslist,0)
memrec0_hotkey0=memoryrecord_getHotkeyByID(memrec0,0)
function onHotkey0(Hotkey)
cheatcomponent_setActive(CETrainer_CHEAT0, true, 1500)
if gBeepOnAction then
beep()
end
end
memoryrecordhotkey_onHotkey(memrec0_hotkey0,onHotkey0)
control_setVisible(CETrainer_SEPERATOR, false)
strings_add(getAutoAttachList(), "firefox.exe")
openProcess("firefox.exe")
gBeepOnAction=false
form_show(CETrainer)
function AboutClick()
showMessage(gAboutText)
end
gAboutText=[[This trainer was made by Cheat Engine]]
function CloseClick()
closeCE()
return caFree
end
memoryrecordhotkey_doHotkey(memrec0_hotkey0)
|
Dark Byte wrote: | As I said, you're doing the onHotkey command before the process has been opened (registering the process to the autoattach timer doesn't immediately open the process)
I've uploaded a version where it calls openProcess (and while not needed right now, reinitializeSymbolhandler() in case you decide to use aa scripts/modulename+offset addresses later)
Note that if firefox is not loaded it might give an error (not sure, haven't tested that situation) |
thanks!
|
|
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
|
|