Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hotkeys made with lua not working...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
zix3r
How do I cheat?
Reputation: 0

Joined: 26 Mar 2020
Posts: 7
Location: Lithuania.

PostPosted: Thu Mar 26, 2020 5:43 pm    Post subject: Hotkeys made with lua not working... Reply with quote

I am a newbie who's just started using cheat engine and lua.
I'm currently making my own trainer and trying to bind a hotkey to function but it doesn't work for some reason.

If anyone could help me, it would be greatly appreciated.
Thank you in advance!

Code:
Code:

UDF1.Show()
function UDF1_CEPanel8Click(sender)
openProcess('blablabla.exe')
autoAssemble[[
alloc(newmem,2048,"blablabla.exe"+1E005E)
label(returnhere)
label(originalcode)
label(exit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
//.jne blablabla.exe+1E0068
test ecx,ecx
jne blablabla.exe+1E00F4

exit:
jmp returnhere

"blablabla.exe"+1E005E:
jmp newmem
nop 5
returnhere:
]]
sender.color = '$0009FF09'
end

function UDF1_CEPanel6Click(sender)
if sender.showhint == false then
sender.showhint = true
sender.color = '$0009FF09'
autoAssemble[[
"blablabla.exe"+30D1F7:
jne 7FF7C6BFD2AA
"blablabla.exe"+2BA677:
jne 7FF7C6BAA6F7
"blablabla.exe"+2B9034:
jne 7FF7C6BA9129
"blablabla.exe"+2FC777:
db 90 90
"blablabla.exe"+30D993:
je 7FF7C6BFD9F2
{$LUA}
memrec = getAddressList().getMemoryRecordByDescription
memrec( 'counter' ).Value = "2"
memrec( 'counter' ).Active = true
{$ASM}
]]
else
sender.showhint = false
sender.color = '$000000D9'
autoAssemble[[
"blablabla.exe"+30D1F7:
je 7FF7C6BFD2AA
"blablabla.exe"+2BA677:
je 7FF7C6BAA6F7
"blablabla.exe"+2B9034:
je 7FF7C6BA9129
"blablabla.exe"+2FC777:
db 75 0C
"blablabla.exe"+30D993:
jne 7FF7C6BFD9F2
{$LUA}
memrec = getAddressList().getMemoryRecordByDescription
memrec( 'counter' ).Value = "1699966543"
memrec( 'counter' ).Active = false
{$ASM}
]]
end
end

function UDF1_CEPanel7Click(sender)
if sender.showhint == false then
sender.showhint = true
sender.color = '$0009FF09'
autoAssemble[[
"blablabla.exe"+30D993:
je 7FF7C6BFD9F2
]]
else
sender.showhint = false
sender.color = '$000000D9'
autoAssemble[[
"blablabla.exe"+30D993:
jne 7FF7C6BFD9F2
]]
end
end

function UDF1_CEPanel5Click(sender)
if sender.showhint == false then
sender.showhint = true
sender.color = '$0009FF09'
autoAssemble[[
"blablabla.exe"+30D1F7:
jne 7FF7C6BFD2AA
]]
else
sender.showhint = false
sender.color = '$000000D9'
autoAssemble[[
"blablabla.exe"+30D1F7:
je 7FF7C6BFD2AA
]]
end
end

function UDF1_CEPanel10Click(sender)
closeCE()
end

function UDF1_CEPanel1MouseDown(sender, button, x, y)
UDF1.DragNow()
end

createHotkey(UDF1_CEPanel6Click, VK_END)
createHotkey(UDF1_CEPanel7Click, VK_F1)
createHotkey(UDF1_CEPanel5Click, VK_F2)

_________________
Just a newbie trying to hack
Smile
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 76

Joined: 06 Jul 2014
Posts: 2570

PostPosted: Thu Mar 26, 2020 6:15 pm    Post subject: Reply with quote

The sender parameter isn't set to GUI elements when invoked from the hotkey function- it's set to the timer, which doesn't have the expected properties.

Make an anonymous wrapper function and invoke the callback with passing the GUI element:
Code:
createHotkey(function() UDF1_CEPanel6Click(UDF1.CEPanel6) end, VK_END)

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
zix3r
How do I cheat?
Reputation: 0

Joined: 26 Mar 2020
Posts: 7
Location: Lithuania.

PostPosted: Thu Mar 26, 2020 6:24 pm    Post subject: Reply with quote

THANK YOU!
YOU SAVED ME!

_________________
Just a newbie trying to hack
Smile
Back to top
View user's profile Send private message
yy5202071314
How do I cheat?
Reputation: 0

Joined: 30 Mar 2020
Posts: 3

PostPosted: Mon Mar 30, 2020 4:10 am    Post subject: Re: Hotkeys made with lua not working... Reply with quote

createHotkey(UDF1_CEPanel5Click, VK_F2)
Parameter 2 is the key code

createHotkey(UDF1_CEPanel5Click,113)--F2 = 113
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites