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 


A loop function to dsplay date and time in a trainer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Sep 02, 2015 8:12 pm    Post subject: A loop function to dsplay date and time in a trainer Reply with quote

Does someone could help to make a clock function and display it in a trainer ?

Code:

function makeForm()
title="Game Trainer"
f  = createForm(false)
p  = createPanel(f)
setProperty(f,"ShowInTaskBar", 'stAlways')
setProperty(f,"Position", "poScreenCenter")
setProperty(f,"BiDiMode", "bdLeftToRight")
setProperty(p,"BiDiMode", "bdLeftToRight")
setProperty(p,"BiDiMode", "bdLeftToRight")
control_setSize(f, 400, 300)
x,y = control_getSize(f)
control_setSize(p, x,y)
control_setCaption(f, title)
---
---  Display date and time here, should be place in a function to loop as a clock
---  with timer function
tm = os.date()
tm = tostring(tm)
lb = createLabel(p)
control_setPosition(lb, 300, 5)
control_setCaption(lb, tm)
---  end of display date and time here
---
form_show(f)
end

makeForm()



Capture3.JPG
 Description:
 Filesize:  26.65 KB
 Viewed:  4397 Time(s)

Capture3.JPG




Last edited by Corroder on Wed Sep 02, 2015 9:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Sep 02, 2015 9:00 pm    Post subject: Reply with quote

Code:
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  control_setCaption(lb, tostring(os.date()))
end
t.Enabled=true
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Sep 02, 2015 9:26 pm    Post subject: Reply with quote

Thank so much Zanzer for quick response
It's done and work properly

Code:

function makeForm()
title="Game Trainer"
f  = createForm(false)
p  = createPanel(f)
setProperty(f,"ShowInTaskBar", 'stAlways')
setProperty(f,"Position", "poScreenCenter")
setProperty(f,"BiDiMode", "bdLeftToRight")
setProperty(p,"BiDiMode", "bdLeftToRight")
setProperty(p,"BiDiMode", "bdLeftToRight")
control_setSize(f, 400, 300)
x,y = control_getSize(f)
control_setSize(p, x,y)
control_setCaption(f, title)
---
---  Display date and time here, should be place in a function to loop
---  with timer function
lb = createLabel(p)
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  control_setCaption(lb, tostring(os.date()))
  control_setPosition(lb, 300, 5)
end
t.Enabled=true
form_show(f)
end

makeForm()
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
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