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 in Lua - Help

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

Joined: 27 Jul 2016
Posts: 124

PostPosted: Sat Mar 18, 2017 9:54 pm    Post subject: Trackbar in Lua - Help Reply with quote


Hello all members
I have this code written by Zanzer .
Code:
local recordId = 0
local elapsed = 50000
local duration = 1000
local original = 5053
local changeTo = 5054

myrecord = getAddressList().getMemoryRecordByID(recordId)
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)
  if mytimer.Interval == elapsed then
    mytimer.Interval = duration
    myrecord.Value = changeTo
  else
    mytimer.Interval = elapsed
    myrecord.Value = original
  end
end
mytimer.Interval = elapsed

function CECheckbox1Change(sender)
  mytimer.Enabled = sender.Checked
end

As the code above,I want to add the trackbar in it. I want the trackbar to operate in this place
Code:
local elapsed = 20000

I want the MAX trackbar to be 50 and Min to be 10
If it possible, please help and guide me
Very Happy


Last edited by Sting9x on Sun Mar 19, 2017 5:33 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25253
Location: The netherlands

PostPosted: Sun Mar 19, 2017 3:07 am    Post subject: Reply with quote

set the max value of the trackbar to 40 and in the code get the value using formname.trackbarname.position+10
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Sun Mar 19, 2017 5:33 am    Post subject: Reply with quote

Dark Byte wrote:
set the max value of the trackbar to 40 and in the code get the value using formname.trackbarname.position+10

Hi, maybe you don't understand my mind.
want Trackbar active when i click in Checkbox. I want Trackbar activity in this place

Code:
local elapsed = 50000

Mechanism of action is Max 50 and Min 10
If it possible, please help and guide me

Razz
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Sun Mar 19, 2017 5:37 pm    Post subject: Reply with quote

Sting9x wrote:
Dark Byte wrote:
set the max value of the trackbar to 40 and in the code get the value using formname.trackbarname.position+10

Hi, maybe you don't understand my mind.
want Trackbar active when i click in Checkbox. I want Trackbar activity in this place

Code:
local elapsed = 50000

Mechanism of action is Max 50 and Min 10
If it possible, please help and guide me

Razz


Wow.

Well first you have to dictate the states of the checkbox.
Then you need to set the trackbar up. Pos, onmouse events, value that is being changed, etc...

_________________
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 Mar 19, 2017 5:58 pm    Post subject: Reply with quote

Code:
MYTIMER_INTERVAL = 50000
mytimer.OnTimer = function(timer)
  if mytimer.Interval == MYTIMER_INTERVAL then
    mytimer.Interval = duration
    myrecord.Value = changeTo
  else
    mytimer.Interval = MYTIMER_INTERVAL
    myrecord.Value = original
  end
end

Code:
function CETrackBar1Change(sender)
  MYTIMER_INTERVAL = sender.Position * 1000
end
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Sun Mar 19, 2017 10:20 pm    Post subject: Reply with quote

Zanzer wrote:
Code:
MYTIMER_INTERVAL = 50000
mytimer.OnTimer = function(timer)
  if mytimer.Interval == MYTIMER_INTERVAL then
    mytimer.Interval = duration
    myrecord.Value = changeTo
  else
    mytimer.Interval = MYTIMER_INTERVAL
    myrecord.Value = original
  end
end

Code:
function CETrackBar1Change(sender)
  MYTIMER_INTERVAL = sender.Position * 1000
end

Looks like this does not work Sad
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Mar 20, 2017 12:38 am    Post subject: This post has 1 review(s) Reply with quote

As akumakuja 28 said :

Quote:
Well first you have to dictate the states of the checkbox.
Then you need to set the trackbar up. Pos, onmouse events, value that is being changed, etc...


Here is a sample, if I am not misunderstood what you want

Copy this script below to CE table lua script and execute,
Just a sample and you able to try implementing the logic to your script.


Code:
f = createForm()
f.Width = 200
f.Height = 200
f.Position = 'poScreenCenter'

c = createCheckBox(f)
c.Left = 10
c.Top = 10
c.Caption = 'Check Me To Show Track Bar'

l = createLabel(f)
l.Font.Size = 12
l.Caption = 'StingBx'
l.Top = c.Top + c.Height + 20
l.Left = math.floor(f.Width - l.Width) / 2
l.Visible = false

t = createTrackBar(f)
t.left = 20
t.top = f.height - 60
t.width = f.width - t.left - 20
t.height = 30
t.frequency = 1
t.Max = 48   --- Maximum Value for a variable you want to change
t.Min = 12   --- Maninum Value for a variable you want to change
t.position = 0
t.SelStart = 0
t.SelEnd = 0
t.Visible = false

l2 = createLabel(f)
l2.Caption = 'Font Size : 12'
l2.Top = t.Top + t.Height + 8
l2.Left = 10
l2.Visible = false

f.show()


---- input here what all stuffs you want change when it check / uncheck
function cCheck(sender)
  if sender.Checked then
     l.Visible = true
     l2.Visible = true
     t.Visible = true
  else
     l.Visible = false
     l2.Visible = false
     t.Visible = false
  end
end


---- Change your variable values here according to trackbar position
function TrackBar1Change(sender)
 l.Font.Size = t.Position
 l2.Caption = 'Font Size : '..tostring(t.position)
 l.Left = math.floor(f.Width - l.Width) / 2
 l.Top = c.Top + c.Height + 20
end

t.onChange = TrackBar1Change    --- execute trackbar change
c.onChange = cCheck  --- execute check box change
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Mon Mar 20, 2017 3:16 am    Post subject: Reply with quote

cool^^^^^
_________________
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Mar 20, 2017 4:03 am    Post subject: Reply with quote

akumakuja28 wrote:
cool^^^^^


Thank so much..
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