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 


Lua -> Detect game window focused or not focusing on game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
dario3star
Newbie cheater
Reputation: 0

Joined: 14 Dec 2020
Posts: 23

PostPosted: Tue Mar 30, 2021 8:16 am    Post subject: Lua -> Detect game window focused or not focusing on game Reply with quote

Hello. I'm a bit stuck what to code next to detect the game if minimized or not focusing in game window. The plan is when i press F2, if the game window is not focused on or minimized, the script will not run.
If i press F2 and the game window is focused (inside game), the script will run.
Thank you so much! <3



Capture.JPG
 Description:
Need detect game window if focused or not focused
 Filesize:  44.52 KB
 Viewed:  1234 Time(s)

Capture.JPG


Back to top
View user's profile Send private message AIM Address
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Mar 30, 2021 11:00 am    Post subject: This post has 1 review(s) Reply with quote

Use "findWindow" to get the game window and then "focused" to see if it's focused.

From "celua.txt":
Code:

...
findWindow(classname OPTIONAL, caption OPTIONAL): windowhandle - Finds a window with the given classname and/or windowname
...

WinControl Class: (Inheritance: Control->Component->Object)
...
methods
...
  focused(): returns boolean true when focused
...

_________________
Back to top
View user's profile Send private message Visit poster's website
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