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 


How to block buttons?

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

Joined: 13 Dec 2014
Posts: 4

PostPosted: Sat Oct 10, 2020 8:22 am    Post subject: How to block buttons? Reply with quote

^topic. I need to block certain button after I enable my script so I can't flash my cheated stats accidentally. I'm kinda sure that I can't do it with assembler thats why I create topic here.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 10, 2020 9:16 am    Post subject: Reply with quote

Which buttons you meant?. On your trainer, CE main form, your game or the button in front of your house door?. Make it clear.

Code:
button.enabled = false

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
pvp7
How do I cheat?
Reputation: 0

Joined: 13 Dec 2014
Posts: 4

PostPosted: Sat Oct 10, 2020 12:06 pm    Post subject: Reply with quote

Corroder wrote:
Which buttons you meant?. On your trainer, CE main form, your game or the button in front of your house door?. Make it clear.

Code:
button.enabled = false


Well its pretty clear from the description that its about hooking the pressed button on the KEYBOARD so the character stats screen can't be accidentally shown. Of course it means that I have to check for the exact key or its code interpretation if the automatic key bind tech is not there yet.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 10, 2020 2:41 pm    Post subject: Reply with quote

pvp7 wrote:
Well its pretty clear from the description...


Is not clear. More easy if you said 'Disable Specific Keyboard Keys'. Usually for keyboard we call it as 'Keys' not 'Buttons'.

To disable specific keyboard keys, I believe need keyboard hook using callback lowLevelKeyboardProc. Bu the way, if you plan to disable keys on a form then use 'isKeyPressed' function logic, but if that for the process game handle then use keyboard hook or call GetAsyncKeyState or call GetKeyState through AA or maybe Lua.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
pvp7
How do I cheat?
Reputation: 0

Joined: 13 Dec 2014
Posts: 4

PostPosted: Sat Oct 10, 2020 3:18 pm    Post subject: Reply with quote

Well I just need equivalent functionality that I'm currently having from my ahk script (which I exactly know how to write), for ex.:
Code:
~*Space::
SpaceWasPressedAt:=A_TickCount   
#if A_TickCount-SpaceWasPressedAt<10000
*c::return   

Its nice to have everything in one place instead of launching my table + ahk script...
So I believe now that I should investigate lowLevelKeyboardProc. Thanks, I'll be back with the questions or results.
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sat Oct 10, 2020 4:03 pm    Post subject: Reply with quote

I prefer using a control instead of doing this.
A dysfunctional key not pressed on the keyboard can be annoying.
Examle=
Code:
control1=false
control1=true


Code:
if f then f.destroy() end
f=createForm(true) f.Position=poDesktopCenter

local b1 = createButton(f)
b1.Left=120 b1.Top=100 b1.caption="Function"

local control=false

function controlState()
if control==false then
control=true
--or b1.Enabled=true
else
control=false
--b1.Enabled=false
end
end

b1.OnClick=function()
if control==false then
showMessage("Oops!\nTo use this function, please enable the switch.")
else
showMessage("Bravo!\nI think the key is active. The function can be used.")
end
end

if controlKey then controlKey.destroy() end
controlKey=createHotkey(controlState, VK_F8)
Back to top
View user's profile Send private message
pvp7
How do I cheat?
Reputation: 0

Joined: 13 Dec 2014
Posts: 4

PostPosted: Sat Oct 10, 2020 4:10 pm    Post subject: Reply with quote

Well you can check the code above to get that the key is "disabled" only for 10 seconds (actual duration of cheat) and it never suits any purpose but showing stats and disabling it in this case is only "for good" but thanks.
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3326

PostPosted: Sat Oct 10, 2020 4:27 pm    Post subject: Reply with quote

pvp7 wrote:
Corroder wrote:
Which buttons you meant?. On your trainer, CE main form, your game or the button in front of your house door?. Make it clear.

Code:
button.enabled = false


Well its pretty clear from the description that its about hooking the pressed button on the KEYBOARD so the character stats screen can't be accidentally shown. Of course it means that I have to check for the exact key or its code interpretation if the automatic key bind tech is not there yet.

No, it is not clear at all.
Use AutoHotkey to remap the key and prevent from passing it in the first place. The good thing about this it that you can add a process check, so it won't redirect the key in any other app.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sun Oct 11, 2020 12:21 am    Post subject: Reply with quote

Alternatives:
1. You can try to substitute a key to another key, example:

Code:
if f then f.destroy() end

f = createForm()
f.Position = 'poScreenCenter'
e = createEdit(f)

KEYEVENTF_EXTENDEDKEY  = 0x1
KEYEVENTF_KEYUP  = 0x2
KEY_X = 88
KEY_Z = 90

function keybd_event(bVk, bScan, dwFlags, dwExtraInfo)
 return executeCodeLocalEx("user32.keybd_event", bVk, bScan, dwFlags, dwExtraInfo)
end

function FormKeyDown(sender, KeyCode)
 if KeyCode == VK_Z then
    res = keybd_event(90, 0, KEYEVENTF_KEYUP, 0)
    e.Text = keybd_event(VK_X, 0, KEYEVENTF_EXTENDEDKEY, 0)
 end
end

f.Show()
e.OnKeyDown = FormKeyDown




2. Using external tool like 'Simple Disable Key'
- which allow you to disable certain keys in specific process name
https://www.4dots-software.com/simple-disable-key/

3. Use 'BlockInput' function (I don't think this is work on Windows 7

4. Re-map keys and set certain keys (disable/enable) via Windows registry keyboard layout on HK_LOCAL_MACHINE > SYSTEM > Current Control

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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 Lua Scripting 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