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 


Freeze value at the same time changing it with trackbar?

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

Joined: 28 May 2016
Posts: 51

PostPosted: Sat Mar 18, 2023 6:50 am    Post subject: Freeze value at the same time changing it with trackbar? Reply with quote

Hey! Im trying to freeze the value of pointers together with the trackbar position changes.
Example: Trackbar Pos = 1 writefloat + freeze (move to 2 or 3 keeps freeze but changes value) and then unfreeze again with pos 0

Would apprechiate any suggestions! Been trying for a while now without success Smile

This is what i use for checkboxes (there probably better ways to go about it but yeah):
Code:

function CETrainer_CECheckbox1Change(sender)
  if (CETrainer.CECheckbox1.State==cbChecked)then
   writeFloat("[[game.exe+pointer]+p]", value)
  else
   writeFloat("[[game.exe+pointer]+p]", value)
   end
end

function freeze(sender)
  if (CETrainer.CECheckbox1.State==cbChecked)then
  writeFloat("[[game.exe+pointer]+p]", value)
  else
  writeFloat("[[game.exe+pointer]+p]", value)
   end
end

FreezeTimer = createTimer(nil,true)
timer_setInterval(FreezeTimer, 1)
timer_onTimer(FreezeTimer, freeze)


How would i go about to implement something similar with this?
Code:

function CETrainer_CETrackBar1Change(sender)
  if sender.Position == 0 then
    writeFloat("[[game.exe+pointer]+p]", value1)
  elseif sender.Position == 1 then
    writeFloat("[[game.exe+pointer]+p]", value2)
  elseif sender.Position == 2 then
    writeFloat("[[game.exe+pointer]+p]", value3)
    end
end
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sat Mar 18, 2023 8:44 am    Post subject: Reply with quote

Code:
if FreezeTimer then FreezeTimer.Destroy() FreezeTimer=nil end

FreezeTimer = createTimer()
FreezeTimer.Interval=10
FreezeTimer.Enabled=false
CETrainer.CETrackBar1.Min=0
CETrainer.CETrackBar1.Max=2

FreezeTimer.OnTimer=function()
local index = CETrainer.CETrackBar1.Position
 if index==0 then
  writeFloat("[[game.exe+pointer]+p]", value1) -- What value1 ?
  FreezeTimer.Enabled=false
 end
 if index==1 then
  writeFloat("[[game.exe+pointer]+p]", value2) -- What value2 ?
 end
 if index==2 then
  writeFloat("[[game.exe+pointer]+p]", value3) -- What value3 ?
 end
end

function CETrainer_CETrackBar1Change(sender)
local index1 = CETrainer.CETrackBar1.Position
 if index1==0 then
  writeFloat("[[game.exe+pointer]+p]", value1) -- What value1 ?
  FreezeTimer.Enabled=false
  else
  FreezeTimer.Enabled=true
 end
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
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Sun Mar 19, 2023 6:50 am    Post subject: Reply with quote

I modified it a bit to get it to work and this worked great, really do apprechiate it alot!

How do i use the freezetimer with other trackbars or make a second one?
It also broke the checkbox freeze i use

AylinCE wrote:

Code:
if FreezeTimer then FreezeTimer.Destroy() FreezeTimer=nil end

FreezeTimer = createTimer()
FreezeTimer.Interval=10
FreezeTimer.Enabled=false
CETrainer.CETrackBar1.Min=0
CETrainer.CETrackBar1.Max=2

FreezeTimer.OnTimer=function()
local index = CETrainer.CETrackBar1.Position
 if index==0 then
  writeFloat("[[game.exe+pointer]+p]", 1)
  FreezeTimer.Enabled=false
 elseif index==1 then
  writeFloat("[[game.exe+pointer]+p]", 2)
 elseif index==2 then
  writeFloat("[[game.exe+pointer]+p]", 3)
 end
end

function CETrainer_CETrackBar1Change(sender)
local index1 = CETrainer.CETrackBar1.Position
 if index1==0 then
  writeFloat("[[game.exe+pointer]+p]", 1)
  FreezeTimer.Enabled=false
  else
  FreezeTimer.Enabled=true
 end
end
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Mar 19, 2023 7:47 am    Post subject: Reply with quote

I disabled the trackbar functions.
The cheat position values are still in the Trackbar though.
But there will be CheckBox controls that manage the functionality.
You can even add Trackbar visibility inside the CheckBox control.

You can reproduce it as shown in the code.

Code:
if FreezeTimer then FreezeTimer.Destroy() FreezeTimer=nil end

FreezeTimer = createTimer()
FreezeTimer.Interval=10
FreezeTimer.Enabled=false
CETrainer.CETrackBar1.Min=0
CETrainer.CETrackBar1.Max=2
CETrainer.CETrackBar2.Min=0
CETrainer.CETrackBar2.Max=2
local allPst=0 -- Timer enabled opsion ..

function freeze1()
local index1 = CETrainer.CETrackBar1.Position -- CETrackBar1
 if index1==0 then
  writeFloat("[[game.exe+pointer]+p]", 1)
  FreezeTimer.Enabled=false
 elseif index1==1 then
  writeFloat("[[game.exe+pointer]+p]", 2)
 elseif index1==2 then
  writeFloat("[[game.exe+pointer]+p]", 3)
 end
end

function freeze2()
local index2 = CETrainer.CETrackBar2.Position -- CETrackBar2
 if index2==0 then
  writeFloat("[[game.exe+pointer]+p]", 1)
  FreezeTimer.Enabled=false
 elseif index2==1 then
  writeFloat("[[game.exe+pointer]+p]", 2)
 elseif index2==2 then
  writeFloat("[[game.exe+pointer]+p]", 3)
 end
end

FreezeTimer.OnTimer=function()
 if allPst==0 then
  FreezeTimer.Enabled=false
  --print("All opsions stoped!")
 else
  if CETrainer.CECheckbox1.Checked==true then freeze1() end
  if CETrainer.CECheckbox2.Checked==true then freeze2() end
 end
end

-- allPst opsion sample;

CETrainer.CECheckbox1.OnChange=function()
 if CETrainer.CECheckbox1.Checked==true then
  allPst=tonumber(allPst) + 1
  --CETrainer.CETrackBar1.Visible=true
  -- or
  -- CETrainer.CETrackBar1.Enabled=true
  FreezeTimer.Enabled=true
 else
  allPst=tonumber(allPst) - 1
  --CETrainer.CETrackBar1.Position=0
  --CETrainer.CETrackBar1.Visible=false
  -- or
  -- CETrainer.CETrackBar1.Enabled=false
 end
end

CETrainer.CECheckbox2.OnChange=function()
 if CETrainer.CECheckbox2.Checked==true then
  allPst=tonumber(allPst) + 1
  FreezeTimer.Enabled=true
 else
  allPst=tonumber(allPst) - 1
 end
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
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Sun Mar 19, 2023 8:31 am    Post subject: Reply with quote

Thanks alot man! Very Happy

AylinCE wrote:
I disabled the trackbar functions.
The cheat position values are still in the Trackbar though.
But there will be CheckBox controls that manage the functionality.
You can even add Trackbar visibility inside the CheckBox control.

You can reproduce it as shown in the code.

Code:
if FreezeTimer then FreezeTimer.Destroy() FreezeTimer=nil end

FreezeTimer = createTimer()
FreezeTimer.Interval=10
FreezeTimer.Enabled=false
CETrainer.CETrackBar1.Min=0
CETrainer.CETrackBar1.Max=2
CETrainer.CETrackBar2.Min=0
CETrainer.CETrackBar2.Max=2
local allPst=0 -- Timer enabled opsion ..

function freeze1()
local index1 = CETrainer.CETrackBar1.Position -- CETrackBar1
 if index1==0 then
  writeFloat("[[game.exe+pointer]+p]", 1)
  FreezeTimer.Enabled=false
 elseif index1==1 then
  writeFloat("[[game.exe+pointer]+p]", 2)
 elseif index1==2 then
  writeFloat("[[game.exe+pointer]+p]", 3)
 end
end

function freeze2()
local index2 = CETrainer.CETrackBar2.Position -- CETrackBar2
 if index2==0 then
  writeFloat("[[game.exe+pointer]+p]", 1)
  FreezeTimer.Enabled=false
 elseif index2==1 then
  writeFloat("[[game.exe+pointer]+p]", 2)
 elseif index2==2 then
  writeFloat("[[game.exe+pointer]+p]", 3)
 end
end

FreezeTimer.OnTimer=function()
 if allPst==0 then
  FreezeTimer.Enabled=false
  --print("All opsions stoped!")
 else
  if CETrainer.CECheckbox1.Checked==true then freeze1() end
  if CETrainer.CECheckbox2.Checked==true then freeze2() end
 end
end

-- allPst opsion sample;

CETrainer.CECheckbox1.OnChange=function()
 if CETrainer.CECheckbox1.Checked==true then
  allPst=tonumber(allPst) + 1
  --CETrainer.CETrackBar1.Visible=true
  -- or
  -- CETrainer.CETrackBar1.Enabled=true
  FreezeTimer.Enabled=true
 else
  allPst=tonumber(allPst) - 1
  --CETrainer.CETrackBar1.Position=0
  --CETrainer.CETrackBar1.Visible=false
  -- or
  -- CETrainer.CETrackBar1.Enabled=false
 end
end

CETrainer.CECheckbox2.OnChange=function()
 if CETrainer.CECheckbox2.Checked==true then
  allPst=tonumber(allPst) + 1
  FreezeTimer.Enabled=true
 else
  allPst=tonumber(allPst) - 1
 end
end
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