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 


Testing Looping Text Display in pure lua

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

PostPosted: Sun Oct 25, 2015 9:09 am    Post subject: Testing Looping Text Display in pure lua Reply with quote

Hi guys,

I try make a test to displaying a text (in iterating letter) by a timer function.

With long way method :

Code:

function text_looper()
reset()
c=createTimer(nil)
c.Interval=1000
c.OnTimer=function(c)
  control_setVisible(UDF1.CELabel1, true)
  control_setCaption(UDF1.CELabel1, 'H')
end
c.Enabled=true

o1=createTimer(nil)
o1.Interval=2000
o1.OnTimer=function(o1)
  control_setVisible(UDF1.CELabel2, true)
  control_setCaption(UDF1.CELabel2, 'a')
end
o1.Enabled=true

r1=createTimer(nil)
r1.Interval=3000
r1.OnTimer=function(r1)
  control_setVisible(UDF1.CELabel3, true)
  control_setCaption(UDF1.CELabel3, 'c')
end
r1.Enabled=true

r2=createTimer(nil)
r2.Interval=4000
r2.OnTimer=function(r2)
  control_setVisible(UDF1.CELabel4, true)
  control_setCaption(UDF1.CELabel4, 'k')
end
r2.Enabled=true

o2=createTimer(nil)
o2.Interval=5000
o2.OnTimer=function(o2)
  control_setVisible(UDF1.CELabel5, true)
  control_setCaption(UDF1.CELabel5, 'i')
end
o2.Enabled=true

d=createTimer(nil)
d.Interval=6000
d.OnTimer=function(d)
  control_setVisible(UDF1.CELabel6, true)
  control_setCaption(UDF1.CELabel6, 'n')
end
d.Enabled=true

e=createTimer(nil)
e.Interval=7000
e.OnTimer=function(e)
  control_setVisible(UDF1.CELabel7, true)
  control_setCaption(UDF1.CELabel7, 'g')
end
e.Enabled=true

r3=createTimer(nil)
r3.Interval=8000
r3.OnTimer=function(r3)
  control_setVisible(UDF1.CELabel8, true)
  control_setCaption(UDF1.CELabel8, 's')
end
r3.Enabled=true

cl=createTimer(nil)
cl.Interval=9000
cl.OnTimer=function(cl)
reset()
end
cl.Enabled=true
reset()
end

function reset()
control_setVisible(UDF1.CELabel1, false)
control_setVisible(UDF1.CELabel2, false)
control_setVisible(UDF1.CELabel3, false)
control_setVisible(UDF1.CELabel4, false)
control_setVisible(UDF1.CELabel5, false)
control_setVisible(UDF1.CELabel6, false)
control_setVisible(UDF1.CELabel7, false)
control_setVisible(UDF1.CELabel8, false)
end

---- test
text_looper()


When it run, text "Hackings" displaying letter by letter in right sequential with a time difference of 1 second displays each letter, but after reset() function, the text display not in the order. Does someone should help to fix the problem ?

Next, if use :

Code:

text=tostring("Hackings")
a = string.sub(text,1)    --- give result "Hackings"
print(a)


How to put "for..do" and give timer (/1 seconds every iterate letters) to display in order ?

Sorry for bad explanation in bad English
Regards



CRDR_Test_Text_Looping.CT
 Description:
Test to display a text. Iterating letter by letter

Download
 Filename:  CRDR_Test_Text_Looping.CT
 Filesize:  2.59 KB
 Downloaded:  752 Time(s)

Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Oct 25, 2015 9:21 am    Post subject: Reply with quote

Code:
text = "Hacking"
index = 1

c=createTimer(nil)
c.Interval=1000
c.OnTimer=function(c)
  if index <= #text then
    control_setVisible(UDF1.CELabel1, true)
    control_setCaption(UDF1.CELabel1, text:sub(1,index)
    index = index + 1
  end
end
c.Enabled=true

function reset()
  index = 1
end
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Oct 25, 2015 10:29 am    Post subject: Reply with quote

Thank so much Zanzer, I really appreciate it.

I just make little modified with the code and now it's working fine.

Code:

text = "Hacking"
index = 1

c=createTimer(nil)
c.Interval=1000
c.OnTimer=function(c)
  if index <= #text then
    control_setVisible(UDF1.CELabel1, true)
    control_setCaption(UDF1.CELabel1, text:sub(1,index))
    index = index + 1
  else
    control_setVisible(UDF1.CELabel1, false)
    index = 1
  end
  end
c.Enabled=true


Regards
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