Posted: Mon Oct 09, 2023 10:02 am Post subject: mouse_event(MOUSEEVENTF_LEFTDOWN) stays down, why?
I have this:
Code:
local Flag = getAddressSafe('[game.exe+01ABCD88]+6AC')
if readInteger(Flag)==123456789 then
mouse_event(MOUSEEVENTF_LEFTDOWN)
elseif readInteger(Flag)~=123456789 and isKeyPressed(VK_LBUTTON) then
mouse_event(MOUSEEVENTF_LEFTDOWN)
elseif readInteger(Flag)~=123456789 and not isKeyPressed(VK_LBUTTON) then
mouse_event(MOUSEEVENTF_LEFTUP)
end
why does mouse_event(MOUSEEVENTF_LEFTDOWN) stay down even after readInteger(Flag) is no longer =123456789 and I am not pressing any mouse button? The 3rd condition should execute and mouse button event should go up. Where am i going wrong
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
Posted: Mon Oct 09, 2023 11:41 am Post subject:
mouse_event(MOUSEEVENTF_LEFTUP) only gets executed when the left button is not down
but since it is currently down (MOUSEEVENTF_LEFTDOWN) it won't execute _________________
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
1) when flag =123456789 then mouse button should be down
2) when flag not =123456789 but if i press left mouse button on physical mouse it should click/work as a it normaly would.
3) if flag not =123456789 and i am not pressing the left mouse button on physical mouse then it should be like no button is pressed i.e mouse button up.
function check1(flag)
-- flag string "12345" or number ?
if tonumber(flag)==123456789 then
print("select: 1 (Down L)")
mouse_event(MOUSEEVENTF_LEFTDOWN) --click
elseif isKeyPressed(VK_LBUTTON) and tonumber(flag)~=123456789 then
print("select: 2 (Click L)")
mouse_event(MOUSEEVENTF_LEFTDOWN) -- click
elseif not isKeyPressed(VK_LBUTTON) then
if tonumber(flag)~=123456789 then
print("select: 3 (Not click L)")
mouse_event(MOUSEEVENTF_LEFTUP) -- no clicked
end
end
end
-- use simulation: Run it and click the left mouse button occasionally.
if chkTim1 then chkTim1.Destroy() chkTim1=nil end
chkTim1=createTimer()
chkTim1.Interval=500
local flagTbl = {12345,123456789}
local chkindx = 0
local chkindx1 = 0
flag1 = flagTbl[1]
chkTim1.OnTimer=function()
chkindx = tonumber(chkindx) + 1
if chkindx==20 then
chkindx = 0
chkindx1 = tonumber(chkindx1) + 1
if flag1 == flagTbl[1] then
flag1 = flagTbl[2]
else
flag1 = flagTbl[1]
end
end
check1(flag1) -- func active ..
print("Flag: "..flag1)
if chkindx1 == 3 then -- stop timer
print("Stoped!")
chkTim1.Enabled = false
end
print(" ")
end
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