View previous topic :: View next topic |
Author |
Message |
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Sat Mar 18, 2017 9:54 pm Post subject: Trackbar in Lua - Help |
|
|
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
Last edited by Sting9x on Sun Mar 19, 2017 5:33 am; edited 1 time in total |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25287 Location: The netherlands
|
Posted: Sun Mar 19, 2017 3:07 am Post subject: |
|
|
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 |
|
|
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Sun Mar 19, 2017 5:33 am Post subject: |
|
|
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
|
|
Back to top |
|
|
akumakuja28 Master Cheater Reputation: 16
Joined: 28 Jun 2015 Posts: 432
|
Posted: Sun Mar 19, 2017 5:37 pm Post subject: |
|
|
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
|
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 |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Mar 19, 2017 5:58 pm Post subject: |
|
|
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 |
|
|
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Sun Mar 19, 2017 10:20 pm Post subject: |
|
|
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
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon Mar 20, 2017 12:38 am Post subject: |
|
|
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 |
|
|
akumakuja28 Master Cheater Reputation: 16
Joined: 28 Jun 2015 Posts: 432
|
Posted: Mon Mar 20, 2017 3:16 am Post subject: |
|
|
cool^^^^^
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon Mar 20, 2017 4:03 am Post subject: |
|
|
akumakuja28 wrote: | cool^^^^^ |
Thank so much..
|
|
Back to top |
|
|
|