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 


About A FreeER Script tip
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
FIRESKY
Cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 34

PostPosted: Tue May 07, 2024 7:24 am    Post subject: Reply with quote

thanks for the tips and your time! Very Happy
Quote:
AylinCE

I can finally try many new tests with all the correct statements, this work!



Was forgot too another little sub question:
i was think if was possible while the cursor passes over an CEEDIT, then without put it in active control, right to create a bolean / statement only while the mouse cursor is above the CEEDIT.


Also Is there a correct negative form for this? "if (CETtrainer.isForegroundWindow(CETtrainer))" then -----> Exemple: (CETtrainer.notisForegroundWindow(CETtrainer)) or IDK...
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1531

PostPosted: Tue May 07, 2024 11:51 am    Post subject: Reply with quote

Here are general examples:
Functions have been added to warn when the cursor hovers over CEEdit (OnMouseEnter) and when the cursor leaves CEEdit (OnMouseLeave).

Also added a function (isForegroundWindow()) with which you can test whether the Trainer window is at the top or not.
You can test this not with "not" but with "true" or "false" as shown in the code (foregroundW1()).

Timers are given as examples.
You decide what you want the timers to do.
2 timers were given;

1) Trainer window constantly checks to see if it is at the top. It will only stop if the cursor is on CEEdit.
(tmr22.OnTimer=foregroundW1)

2) It will work if the trainer window is at the top. Or you can arrange it for the opposite. Or you can replace this timer with a code replacement function.
(TimerAA.OnTimer=startMsg)

I think you'll edit again and ask another question. Smile
I hope you achieve the final result.

Code:
if frm1 then frm1.Destroy() frm1=nil end
frm1=createForm()
frm1.Position="poDesktopCenter"
frm1.Height=80
local CETrainer = {}

CETrainer.CEEdit1 = createEdit(frm1)
CETrainer.CEEdit1.Left=30 CETrainer.CEEdit1.Top=30

-------------------------------------------------------------------

if tmr22 then tmr22.Destroy() tmr22=nil end
tmr22=createTimer()
tmr22.Interval=1000
tmr22.Enabled=false

if TimerAA then TimerAA.Destroy() TimerAA=nil end
TimerAA=createTimer()
TimerAA.Interval=1000
TimerAA.Enabled=false

-------------------------- Foreground Window func -----------------

local ctpid = 0
--Get the trainer window ID. (Execute Script or Trainer.Show() )
if ctpid==0 then ctpid = getForegroundProcess() end
print(ctpid)
--Use during testing: If CETrainer is not at the top, the print trainer is at the top.
--This code will prevent the Lua Engine (Print) window from rising to the top unnecessarily.
getLuaEngine().cbShowOnPrint.Checked=false

isForegroundWindow=function(s)
res = false
    pd = getForegroundProcess()
    if tonumber(pd)==tonumber(ctpid) then
      res=true
    else
      res=false
    end
return res
end
----------------------- start timer check window! ---------------------

function startMsg()
print("Now: CETrainer is on top!")
end

function foregroundW1()
    if isForegroundWindow(CETrainer)==true then --foreground window check:
      TimerAA.Enabled=true
    else
     print("Now: CETrainer is not at the top!")
     TimerAA.Enabled=false
    end
end

tmr22.OnTimer=foregroundW1

TimerAA.OnTimer=startMsg
tmr22.Enabled=true

------------------------ cursor and edit -------------------------
--right to create a bolean / statement only while the mouse cursor is above the CEEDIT.

CETrainer.CEEdit1.OnMouseEnter=function(sender)
 tmr22.Enabled=false
 TimerAA.Enabled=false
 print("Cursor on Edit1!")
end

CETrainer.CEEdit1.OnMouseLeave=function(sender)
 tmr22.Enabled=true
 print("Cursor not on Edit1!")
end

-------------------------------------------------------------------

_________________
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
FIRESKY
Cheater
Reputation: 0

Joined: 01 Mar 2017
Posts: 34

PostPosted: Wed May 08, 2024 6:36 am    Post subject: Reply with quote

Ofc AylinCE I accomplished what I had to from quite a few tips ago ,

I just took the opportunity to better understand some statements that could be more or less useful for me and probably others and I thank you for your time, you really were really friendly.

More than anything I used your advice to experiment with many things,
have ideas and understand some correct forms of lua that were not clear to me, certainly everyone can learn a lot from the official lua guides,
but it's also nice to do it by asking for advice and help, but I certainly don't want to take advantage of your time, so realy thanks for everything. Very Happy

I just hope sooner or later I can reciprocate in some way.


AylinCE = Master-chief.


- TOPIC SOLVED -
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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