timer =: 3 : 0
NB. Set the timer to y, or turn it off if y is empty
wd 'timer ' , ": {. y
)
sys_timer_z_ =: 3 : 0
try.
myFunc'' NB. This is where your function runs
catch.
timer'' NB. if myFunc fails, avoid timer loop
end.
)
myFunc =: 3 : 0
smoutput 'myFunc ran!'
)
untested.
Henry Rich
On 8/16/2014 11:02 AM, Jon Hough wrote:
You are, of course, correct. But how do I use that in the context of the qT
Timer Demo?
e.g.
timer=: 3 : 0
if. y do.
sys_timer_z_=: 3 : 'smoutput ''systimer: '',":6!:0$0'
wd 'timer ',":y
else.
wd 'timer 0'
sys_timer_z_=: ]
end.
Furthermore, I am unsure how to call an arbitrary function every update cycle (e.g. define myFunc,
and call it every two seconds, or whatever the timer is set to). For the time being the
"arbitrary" function is just to calculate "time since timer start".
Date: Sat, 16 Aug 2014 10:51:49 -0400
From: [email protected]
To: [email protected]
Subject: Re: [Jprogramming] jQT timer
Look at 6!:1
starttime =: 6!:1 ''
start timer
some time later
elapsedttime =. (6!:1'') - starttime
Henry Rich
On 8/16/2014 10:49 AM, Jon Hough wrote:
I looked at the jQt timer example, which shows an example of outputting the
current time every 2 seconds etc.
I have been trying to modify this to not only outputting the current time but to
increment a timecount variable, perhaps using the 6!:9 foreign conjunction. So that,
essentially I have avariable for "time since timer started".
I can't seem to find a way to do this.Any help appreciated.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm