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 


Some issues with the setLayeredAttributes function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
.lua
Expert Cheater
Reputation: 1

Joined: 13 Sep 2018
Posts: 202

PostPosted: Wed Mar 26, 2025 12:57 am    Post subject: Some issues with the setLayeredAttributes function Reply with quote

I want the mouse to still be able to operate after specifying the transparent color in the window, instead of penetrating.
is there any way?
Code:
if UDF1==nil then  UDF1=createForm(true)  end
UDF1.Color=0xff
UDF1.setLayeredAttributes(0xff,255,1)
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Wed Mar 26, 2025 8:38 am    Post subject: Reply with quote

I think it is not possible to click in fully transparent state.

But if reducing the transparency at click time and making the click possible is a solution, try the following code.

Code:
if UDF1 then UDF1.Destroy() UDF1=nil end
UDF1=createForm()
UDF1.Color=0x000100
UDF1.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )

local frm2 = UDF1

function isMouseInBounds(x1, y1, x2, y2)
    local mouseX, mouseY = getMousePos()
    return mouseX >= x1 and mouseX <= x2 and mouseY >= y1 and mouseY <= y2
end

function frmPos()
local x1, y1 = frm2.Left, frm2.Top
local x2, y2 = x1 + frm2.Width + 20, y1 + frm2.Height + 20

      if isMouseInBounds(x1, y1, x2, y2) then
         frm2.setLayeredAttributes(0x000100, 120, LWA_ALPHA )
      else
         frm2.setLayeredAttributes(0x000100, 255, LWA_COLORKEY | LWA_ALPHA )
      end
      collectgarbage("step")
end

frm2.OnMouseDown = function() frm2.DragNow() end

if posTmr then posTmr.Destroy() posTmr=nil end
posTmr = createTimer()
posTmr.Interval = 100
posTmr.OnTimer = frmPos
posTmr.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 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