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 


Help request two timers causing problems

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Flux.
Advanced Cheater
Reputation: 0

Joined: 10 Nov 2016
Posts: 84
Location: Another World - N5X2 106311411+2123518

PostPosted: Sat Mar 16, 2019 4:40 pm    Post subject: Help request two timers causing problems Reply with quote

Looking for some help, with stuff found on the forum have tried to make a label which when used in a trainer will

1, show moving text which tells you game is not running and
2, show normal text (not moving) when your game is running and
3, automatically disables all cheats if the game crashes.

It partially works, but the two timers seem to mess up the moving text.
One timer is for checking the game process, the other for the text moving intervals.

Is it possible to use one timer for two intervals, or separate them so they don't interact, or is it something else ?

Code:
f = createForm()
f.height = 100
f.width = 600
l1 = createLabel(f)
l1.top = 10
l1.left = 10
l1.height = 50
l1.width = 600
l1.font.size = 18
cecheck_list = createStringlist()
function gamecheck()
 status = readInteger(process_name)
 getProcesslist(cecheck_list)
 local count = 0
 for i=0,cecheck_list.count-1 do
  if cecheck_list[i]:find("gamen process") then --------- game process
  count = count + 1
  end
 end
 if count < 1 and status == nil then
 AddressList.disableAllWithoutExecute()
 --CETrainer.CHEAT1.Activated=false
 --CETrainer.CHEAT0.Activated=false
 t = false
function moving_Text()
l1.Visible = true
index1 = 0
spaces1 = 67
step1 = 1
values1 = {}
for i=0,spaces1 do
  local text1 = "test" --------------------------------- text here
  for j=0,i do
    text1 = " " .. text1
  end
  values1[i] = text1
end
timer1=createTimer(nil, false)
timer1.Interval=50 ------------------------------------- speed
timer1.OnTimer=function(timer1)
color1 = 1
  if index1 >= spaces1 then
    step1 = -1
  elseif index1 <= 0 then
    step1 = 1
  end
  index1 = index1 + step1
  l1.Caption = (values1[index1])
  for i=0,3 do
    color1 = color1 * 10 + math.random(255)
  end
  l1.font.color = color1
end
timer1.Enabled=true
end
function exit()
 timer1.Destroy()
 closeCE();
 return caFree
end
moving_Text()
 elseif count < 1 and status ~= nil then
 AddressList.disableAllWithoutExecute()
 --CETrainer.CHEAT1.Activated=false
 --CETrainer.CHEAT0.Activated=false
 else
 l1.Caption = "test 2" ---------------------------------- text here
 l1.Font.Color = '0xFF0000'
 end
 cecheck_list.clear()
end
t=createTimer(nil)
timer_setInterval(t, 900)
timer_onTimer(t, gamecheck)
timer_setEnabled(t, true)
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