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 


mouse_event(MOUSEEVENTF_LEFTDOWN) stays down, why?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Bit Byte
Advanced Cheater
Reputation: 0

Joined: 28 Nov 2022
Posts: 62

PostPosted: Mon Oct 09, 2023 10:02 am    Post subject: mouse_event(MOUSEEVENTF_LEFTDOWN) stays down, why? Reply with quote

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
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25794
Location: The netherlands

PostPosted: Mon Oct 09, 2023 11:41 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
Bit Byte
Advanced Cheater
Reputation: 0

Joined: 28 Nov 2022
Posts: 62

PostPosted: Mon Oct 09, 2023 1:50 pm    Post subject: Reply with quote

How would I get it to do so:

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.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1521

PostPosted: Mon Oct 09, 2023 3:40 pm    Post subject: Reply with quote

Code:
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

chkTim1.Enabled = true

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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