View previous topic :: View next topic |
Author |
Message |
yousefh How do I cheat? Reputation: 0
Joined: 16 Jun 2018 Posts: 3
|
Posted: Sat Jun 16, 2018 7:37 am Post subject: how can i loop mouse clicks by holding it? |
|
|
hi everyone, i'm newbie here.
i want to know how can i loop mouse clicks by holding it?
in this code i want to change the hot key from X to holding R mouse button.
so when i hold down R mouse button, it will auto R clicks with interval 90
Code: |
function CECheckbox2Click(sender)
if sender.state==1 then
if myhotkey1 then
myhotkey1.Destroy()
myhotkey1 = nil
end
function killmytimer()
if mytimer then
mytimer.Destroy()
mytimer = nil
end
end
myhotkey1 = createHotkey(function()
if mytimer then
killmytimer()
else
mytimer=createTimer()
mytimer.interval=90
mytimer.OnTimer=function()
mouse_event(MOUSEEVENTF_RIGHTDOWN)
mouse_event(MOUSEEVENTF_RIGHTUP)
end
end
end, VK_X)
else
myhotkey1.Destroy()
myhotkey1 = nil
end
end
|
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Jun 16, 2018 10:46 am Post subject: |
|
|
For some reason I expect the code constantly changing the state of the mouse button being up and down is going to interfere with the code that checks whether the mouse is down for the hotkey...
I tried a couple basic things in lua but didn't have any luck so, good luck
_________________
|
|
Back to top |
|
|
LewcowVaal Advanced Cheater Reputation: 0
Joined: 30 Dec 2017 Posts: 63
|
Posted: Sat Jun 16, 2018 10:54 am Post subject: |
|
|
FreeER wrote: | For some reason I expect the code constantly changing the state of the mouse button being up and down is going to interfere with the code that checks whether the mouse is down for the hotkey...
I tried a couple basic things in lua but didn't have any luck so, good luck |
Actually i was interested in doing this too. I tried some things but no luck, hopefully some crazy mind here comes up with a solution even because i'm not a LUA expert.
|
|
Back to top |
|
|
yousefh How do I cheat? Reputation: 0
Joined: 16 Jun 2018 Posts: 3
|
Posted: Sat Jun 16, 2018 1:15 pm Post subject: |
|
|
LewcowVaal wrote: | FreeER wrote: | For some reason I expect the code constantly changing the state of the mouse button being up and down is going to interfere with the code that checks whether the mouse is down for the hotkey...
I tried a couple basic things in lua but didn't have any luck so, good luck |
Actually i was interested in doing this too. I tried some things but no luck, hopefully some crazy mind here comes up with a solution even because i'm not a LUA expert. |
yes that's why i'm asking, changing state to button up while i'm holding the right mouse... i hope i find a solution for that
|
|
Back to top |
|
|
LewcowVaal Advanced Cheater Reputation: 0
Joined: 30 Dec 2017 Posts: 63
|
Posted: Mon Jun 18, 2018 8:43 am Post subject: |
|
|
I summon the mighty Darkbyte
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Mon Jun 18, 2018 10:54 am Post subject: |
|
|
Use a different key. It's not that much of an inconvenience. If anything, it lets the user still use the right mouse button if/when they don't need it to repeat.
Disregarding that, the input sent to the game shouldn't interfere with the hotkey trigger. You need to be more specific than mouse_event. For example, send a message directly to the window:
Code: | if hk then hk.destroy() end
if frm then frm.destroy() end
frm = createForm()
local btn = createButton(frm)
btn.Width = 120
btn.AnchorSideLeft.Control = frm
btn.AnchorSideLeft.Side = asrCenter
btn.AnchorSideTop.Control = frm
btn.AnchorSideTop.Side = asrCenter
btn.Caption = 'clicked 0 times'
local i = 0
btn.OnClick = function(b) i = i + 1; b.Caption = ('clicked %d times'):format(i) end
hk = createHotkey(function()
if frm and frm.isForegroundWindow() then
sendMessage(btn.handle, 0x0201, 1, 0)
sendMessage(btn.handle, 0x0202, 0, 0)
end
end, VK_LBUTTON)
hk.delayBetweenActivate = 90 |
Code injection is always an option.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Mon Jun 18, 2018 11:18 am Post subject: |
|
|
rebind the action associated with the left mouse button in the game to some other button, and then use a left mouse as a hotkey which initiates a timer that repeatedly presses that button up and down and check if the mouse button is still down. And if not, stop the timer
or use a different button, e.g mouse button 4 or 5, or the scroll down
_________________
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 |
|
|
kantoboy69 Advanced Cheater Reputation: 2
Joined: 31 Mar 2010 Posts: 71 Location: Manila
|
Posted: Tue Jun 19, 2018 4:26 am Post subject: |
|
|
I'm not sure if lua can call windows api but you can try
USER32.GetAsyncKeyState
And put it on a timer to check if the right mouse button is down
_________________
Cheater always prosper Hitler |
|
Back to top |
|
|
yousefh How do I cheat? Reputation: 0
Joined: 16 Jun 2018 Posts: 3
|
Posted: Wed Jun 20, 2018 9:50 am Post subject: |
|
|
ParkourPenguin wrote: | Use a different key. It's not that much of an inconvenience. If anything, it lets the user still use the right mouse button if/when they don't need it to repeat.
Disregarding that, the input sent to the game shouldn't interfere with the hotkey trigger. You need to be more specific than mouse_event. For example, send a message directly to the window:
Code: | if hk then hk.destroy() end
if frm then frm.destroy() end
frm = createForm()
local btn = createButton(frm)
btn.Width = 120
btn.AnchorSideLeft.Control = frm
btn.AnchorSideLeft.Side = asrCenter
btn.AnchorSideTop.Control = frm
btn.AnchorSideTop.Side = asrCenter
btn.Caption = 'clicked 0 times'
local i = 0
btn.OnClick = function(b) i = i + 1; b.Caption = ('clicked %d times'):format(i) end
hk = createHotkey(function()
if frm and frm.isForegroundWindow() then
sendMessage(btn.handle, 0x0201, 1, 0)
sendMessage(btn.handle, 0x0202, 0, 0)
end
end, VK_LBUTTON)
hk.delayBetweenActivate = 90 |
Code injection is always an option. |
this is a great solution, and i did try it before.
but the problem i'm always facing is how to get the window handle?
the game i'm talking about here is multi windows, and idk which window i should i send the message to
** there should be a image here for the windows but i'm not allowed to post urls yet.
Dark Byte wrote: | rebind the action associated with the left mouse button in the game to some other button, and then use a left mouse as a hotkey which initiates a timer that repeatedly presses that button up and down and check if the mouse button is still down. And if not, stop the timer
or use a different button, e.g mouse button 4 or 5, or the scroll down |
changing controls is not allowed in this game
Last edited by yousefh on Wed Jun 20, 2018 6:06 pm; edited 1 time in total |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Wed Jun 20, 2018 11:15 am Post subject: |
|
|
You should remove that image (see FAQ).
Find a window via findWindow and get to nearby windows via getWindow (CE exposes both to Lua). Identify it via class, name, parent, children, depth, etc.
I don't know which one is correct. Worst case, use trial and error to figure it out. Maybe sending messages to all of them will work, or only some of them.
If you really want to be exact about this, hook the thread's message loop. Watch for relevant messages, add/remove destination window handles to/from a list, and process that list periodically from CE. You'll need to be careful if you want to do this correctly (e.g. send btn_up message before next btn_down message, maybe drop some messages, avoid race conditions and data races, etc.).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
|