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 


Marquee Text on trainer

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

Joined: 07 Oct 2013
Posts: 18
Location: In Your Heart :P

PostPosted: Sat Oct 11, 2014 10:58 am    Post subject: Marquee Text on trainer Reply with quote

Hello DB and all, can u help me how to make text marquee on Trainer.
and this is work on trainer?
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Sun Oct 12, 2014 5:49 am    Post subject: Reply with quote

You may need to setup your main form close handler, so that the timer created is killed properly during DEBUG.

Code:
local function getRoot(c) local p,q = c.Parent,c ; while p do p,q=p.Parent,p end return q end
local isTrainer = TrainerOrigin -- it is actually the path of cetrainer executed, nil during debug
local function dp(...) if not isTrainer then print(...) end end

local TimerPool = {}
local function marquee (T)
  local NameID = getRoot(T).Name ..'|'..T.Name
  if TimerPool[NameID] == nil then
    local tm = createTimer(T)
    TimerPool[NameID] = tm
    tm.toRight = function() tm.Direction = 1 end
    tm.toLeft = function() tm.Direction = -1 end
    tm.setText = function(t) if T.setCaption then T.setCaption(t) end if T.Text then T.Text = t end end
    tm.getText = function(t) if T.setCaption then return T.getCaption(t) end if T.Text then return T.Text end end
    tm.start = function() tm.Enabled = true end
    tm.stop = function() tm.Enabled = false end
    tm.OnTimer = function()
      local s = tm.getText() ;
      local l = string.len(s)
      local dir = tonumber(tm.Direction,10) or tm.Direction or 1
      if l > 1 then
        if dir < 0 then
          tm.setText(string.sub(s,2,l)..string.sub(s,1,1))
        else
          tm.setText(string.sub(s,l,l)..string.sub(s,1,l-1))
        end
        T.update()
      end
    end
    tm.release = function()
      TimerPool[NameID] = nil
      tm.Enabled = false
      tm.destroy()
      tm = nil
    end
  end
  TimerPool[NameID].Direction = 1
  TimerPool[NameID].Interval = 1000
  TimerPool[NameID].Enabled = false
  return TimerPool[NameID]
end

-- need to kill timers during debug, adapt to your main form close handler
UDF1.OnClose = function(sender)
  local f = caHide
  if isTrainer then f = caFree end
  for k,v in pairs(TimerPool) do if v then v.destroy() ; TimerPool[k] = nil ; dp('timer for '..k..' killed')end end
  return f
end

-- for test, create controls at designer
local marqL = marquee(UDF1.CELabel1)
local marqE = marquee(UDF1.CEEdit1)
local marqL2 = marquee(UDF1.CELabel1)

-- test if createTimer properly
if marqL == marqL2 then dp('Same control Same Timer, Good') else dp('Same control Diff Timer, Bad') end
if marqL == marqE  then dp('Diff control Same Timer, Bad') else dp('Diff control Diff Timer, Good') end
marqL.setText('**abcde fghijkl mnopq rstu vwxyz')
marqE.setText('**1244 99883 2777 266666 99')
marqL.toRight()
marqL.start()
marqE.toLeft()
marqE.start()
UDF1.show()
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