View previous topic :: View next topic |
Author |
Message |
usernotfound Expert Cheater
Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Sun Aug 21, 2016 10:47 pm Post subject: [solved] |
|
|
[solved thanks to Zanzer]
Last edited by usernotfound on Sat Aug 27, 2016 7:25 pm; edited 1 time in total |
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Aug 21, 2016 11:01 pm Post subject: |
|
|
Code: | if mytimer1 == nil then
mytimer1 = createTimer(nil, false)
end
mytimer1.Interval = 1000
mytimer1_index = 0
mytimer1.OnTimer = function(timer)
mytimer1_index = mytimer1_index + 1
if mytimer1_index == 1 then
doKeyPress(VK_ESCAPE)
elseif mytimer1_index == 2 then
doKeyPress(VK_RETURN)
elseif mytimer1_index == 3 then
doKeyPress(VK_UP)
elseif mytimer1_index >= 4
doKeyPress(VK_RETURN)
mytimer1_index = 0
end
end
mytimer1.Enabled = true |
Code: | if mytimer2 == nil then
mytimer2 = createTimer(nil, false)
end
mytimer2.Interval = 300000
mytimer2.OnTimer = function(timer)
mytimer1.Enabled = false
end
mytimer2.Enabled = true |
|
|
Back to top |
|
 |
usernotfound Expert Cheater
Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Mon Aug 22, 2016 10:08 am Post subject: |
|
|
Zanzer wrote: | Code: | if mytimer1 == nil then
mytimer1 = createTimer(nil, false)
end
mytimer1.Interval = 1000
mytimer1_index = 0
mytimer1.OnTimer = function(timer)
mytimer1_index = mytimer1_index + 1
if mytimer1_index == 1 then
doKeyPress(VK_ESCAPE)
elseif mytimer1_index == 2 then
doKeyPress(VK_RETURN)
elseif mytimer1_index == 3 then
doKeyPress(VK_UP)
elseif mytimer1_index >= 4
doKeyPress(VK_RETURN)
mytimer1_index = 0
end
end
mytimer1.Enabled = true |
Code: | if mytimer2 == nil then
mytimer2 = createTimer(nil, false)
end
mytimer2.Interval = 300000
mytimer2.OnTimer = function(timer)
mytimer1.Enabled = false
end
mytimer2.Enabled = true |
|
Hi Zanzer, thank you kindly for the example but I'm not quite sure how to set it up correctly. The first part does what I'm looking for with the Keypress loop, but how do I disable it with my togglebox? And the second part for the interval, I'm not quite sure how to implement that with my editbox.
Really sorry for my incompetence !
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Aug 22, 2016 6:09 pm Post subject: |
|
|
Have the two scripts just execute when the table loads, but remove these two lines from them:
Code: | mytimer1.Enabled = true
mytimer2.Enabled = true |
When the user clicks your button, simply execute:
Code: | mytimer2.Interval = tonumber(UDF1.CEEdit1.Text)
mytimer1_index = 0
mytimer2.Enabled = true
mytimer1.Enabled = true |
If you want to let the user disable the timer before it runs out, simply execute:
Code: | mytimer2.Enabled = false
mytimer1.Enabled = false |
|
|
Back to top |
|
 |
usernotfound Expert Cheater
Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Mon Aug 22, 2016 7:54 pm Post subject: |
|
|
Zanzer wrote: | Have the two scripts just execute when the table loads, but remove these two lines from them:
Code: | mytimer1.Enabled = true
mytimer2.Enabled = true |
When the user clicks your button, simply execute:
Code: | mytimer2.Interval = tonumber(UDF1.CEEdit1.Text)
mytimer1_index = 0
mytimer2.Enabled = true
mytimer1.Enabled = true |
If you want to let the user disable the timer before it runs out, simply execute:
Code: | mytimer2.Enabled = false
mytimer1.Enabled = false |
|
Ahh I got it now, thank you so much for the clear explanation. This will be fun to play around with
|
|
Back to top |
|
 |
|