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 


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: Wed Jul 06, 2016 6:04 pm    Post subject: trackbar Reply with quote

Hello, how do i use a trackbar?

I want it to be disabled when my checkbox is unticked and enabled when it is ticked, i set it to four stages. One stage for different Integer values. (it is the same adress just different values)

so for an example: checkbox unticked -> set value to x.
checkbox ticked -> activate the trackbar, and set value to wherever the trackbar is set.

i hope i made myself understood properly, cheers!
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 Jul 06, 2016 7:18 pm    Post subject: Reply with quote

Code:
{$lua}
[ENABLE]
UDF1.CETrackBar1.Enabled = true
[DISABLE]
UDF1.CETrackBar1.Enabled = false
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Thu Jul 07, 2016 9:28 am    Post subject: Reply with quote

Zanzer wrote:
Code:
{$lua}
[ENABLE]
UDF1.CETrackBar1.Enabled = true
[DISABLE]
UDF1.CETrackBar1.Enabled = false


But how do i use it? would something like this work?
Code:

function CETrackBar1Change(sender)
 if (trackBar_getState(CETrainer.CETrackBar1) == 0) then
    writeInteger("game.exe+0084E4BC", 2)
 if (trackBar_getState(CETrainer.CETrackBar1) == 1) then
    writeInteger("game.exe+0084E4BC",3)
 if (trackBar_getState(CETrainer.CETrackBar1) == 2) then
    writeInteger("game.exe+0084E4BC", 4)
 if (trackBar_getState(CETrainer.CETrackBar1) == 3) then
    writeInteger("game.exe+0084E4BC", 5)
 end
end
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4699

PostPosted: Thu Jul 07, 2016 9:43 am    Post subject: Reply with quote

Code:
function CECheckbox1Change(sender)
  writeInteger(address,0)
  UDF1.CETrackBar1.Enabled = sender.Checked
end
function CETrackBar1Change(sender)
  if sender.Position == 0 then
    writeInteger(address,1)
  elseif sender.Position == 1 then
    writeInteger(address,2)
  elseif sender.Position == 2 then
    writeInteger(address,3)
  else
    writeInteger(address,4)
  end
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Thu Jul 07, 2016 10:35 am    Post subject: Reply with quote

ParkourPenguin wrote:
Code:
function CECheckbox1Change(sender)
  writeInteger(address,0)
  UDF1.CETrackBar1.Enabled = sender.Checked
end
function CETrackBar1Change(sender)
  if sender.Position == 0 then
    writeInteger(address,1)
  elseif sender.Position == 1 then
    writeInteger(address,2)
  elseif sender.Position == 2 then
    writeInteger(address,3)
  else
    writeInteger(address,4)
  end
end


When i did it like this the speedhack checkbox wrote fine, however the trackbar still did nothing (yes i assigned the trackbar aswell)

Code:
function CETrainerCheckbox47Change(sender)
  CETrainer.CETrackBar1.Enabled = sender.Checked
end
function CETrainerTrackBar1Change(sender)
  if sender.Position == 0 then
    writeFloat(0x0639AD14,2)
  elseif sender.Position == 1 then
    writeFloat(0x0639AD14,3)
  elseif sender.Position == 2 then
    writeFloat(0x0639AD14,4)
  elseif sender.Position == 3 then
    writeFloat(0x0639AD14,5)
  else
    writeFloat(0x0639AD14,1.5)
  end
end


I removed the writeFloat from the checkbox since i dont think ill need that, however the trackbar still doesent change anything. (max is "3" on the trackbar, so it got four positions)

i also changed it to Float since its a float value and not a 4byte (my bad)
any more suggestions to what i can change?[/code]
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4699

PostPosted: Thu Jul 07, 2016 10:42 am    Post subject: Reply with quote

Code:
function CETrainerTrackBar1Change(sender)
  print(sender.Position)
end

Move the trackbar from one end to the other and let me know what this outputs.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Thu Jul 07, 2016 10:53 am    Post subject: Reply with quote

ParkourPenguin wrote:
Code:
function CETrainerTrackBar1Change(sender)
  print(sender.Position)
end

Move the trackbar from one end to the other and let me know what this outputs.


did not output anything Confused



1.jpg
 Description:
 Filesize:  191.31 KB
 Viewed:  10349 Time(s)

1.jpg


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

Joined: 06 Jul 2014
Posts: 4699

PostPosted: Thu Jul 07, 2016 10:57 am    Post subject: Reply with quote

It works fine for me. You either didn't execute the script or didn't exit the form designer before testing it.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Thu Jul 07, 2016 11:03 am    Post subject: Reply with quote

ParkourPenguin wrote:
It works fine for me. You either didn't execute the script or didn't exit the form designer before testing it.


i generated it and nothing happened
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4699

PostPosted: Thu Jul 07, 2016 11:08 am    Post subject: Reply with quote

Open this .CT, execute the Lua script, and figure out the difference between your code and this.


Trackbar Example.CT
 Description:

Download
 Filename:  Trackbar Example.CT
 Filesize:  515 Bytes
 Downloaded:  789 Time(s)


_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Thu Jul 07, 2016 11:21 am    Post subject: Reply with quote

ParkourPenguin wrote:
Open this .CT, execute the Lua script, and figure out the difference between your code and this.


oh so this is what screws the trackbar up
Code:
CETrainerTrackBar1Change


It works when its like this
Code:
CETrackBar1Change

Stupid mistake lol, thx!
and btw, how do i add so i writeFloat 1.5 when the checkbox is unchecked?
Currently looks like this:

Code:
function CETrainerCheckbox47Change(sender)
  CETrainer.CETrackBar1.Enabled = sender.Checked
end
function CETrackBar1Change(sender)
  if sender.Position == 0 then
    writeFloat(0x0639AD14,2)
  elseif sender.Position == 1 then
    writeFloat(0x0639AD14,3)
  elseif sender.Position == 2 then
    writeFloat(0x0639AD14,4)
  elseif sender.Position == 3 then
    writeFloat(0x0639AD14,5)
  else
    writeFloat(0x0639AD14,1.5)
  end
end
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4699

PostPosted: Thu Jul 07, 2016 11:25 am    Post subject: Reply with quote

Similar to my original post:
Code:
function CECheckbox1Change(sender)
  UDF1.CETrackBar1.Enabled = sender.Checked
  if not sender.Checked then writeFloat(address,1.5) end
end

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
lothe23
Advanced Cheater
Reputation: 0

Joined: 28 May 2016
Posts: 51

PostPosted: Thu Jul 07, 2016 11:30 am    Post subject: Reply with quote

ParkourPenguin wrote:
Similar to my original post:
Code:
function CECheckbox1Change(sender)
  UDF1.CETrackBar1.Enabled = sender.Checked
  if not sender.Checked then writeFloat(address,1.5) end
end


Okay, thank you for all your help, i really do apprechiate it
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