| View previous topic :: View next topic |
| Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 2:31 am Post subject: timer question |
|
|
hello all
i have a timer that runs a command BUT the problem is as soon as i start vds script timer starts how can i make timer ONLY start when you hit the start button?
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 2:50 am Post subject: also |
|
|
| to how to stop timer when you hit the "stop" button? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Mon Jan 13, 2003 4:54 am Post subject: |
|
|
You can set up a variable to hold Yes or No as to whether the Timer should run or not. At the beginning of the script, set the variable to No(%%Timer = No). In the StartBUTTON event set it to Yes, in the StopBUTTON set it to No and in the Timer event only execute the Timer code if @EQUAL(%%Timer,Yes). _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 5:22 am Post subject: hummm |
|
|
we i though i was following you there but this part i don't understand
| Quote: |
Timer event only execute the Timer code if @EQUAL(%%Timer,Yes).
|
i don't follow to well do i chnage the timer lable? then added it? explain more please
thanks |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Jan 13, 2003 5:31 am Post subject: |
|
|
Try this Tim:
| Code: |
TITLE Timer Demo
option scale,96
option fieldsep,"|"
option decimalsep,"."
dialog create,Timer Demo,-1,0,200,100
dialog add,BUTTON,bStart,10,10,65,25,&Start
dialog add,BUTTON,bStop,45,10,65,25,S&top
dialog add,Status,Stat
dialog show
:Evloop
wait event,.1
%E = @event()
goto %E
:Timer
if @equal(@timer(1,S),1)
dialog set,Stat,@timer(1,v)
else
dialog set,Stat,
end
goto Evloop
:bStartBUTTON
timer start,1,chrono,@datetime(DD-HH:NN:SS)
goto Evloop
:bStopBUTTON
timer stop,1
goto Evloop
:CLOSE
exit
|
See if that isn't what ya want.
Edit:
Removed @substr() function from the :Timer label. It should work for
anybody now. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it."
Last edited by ShinobiSoft on Mon Jan 13, 2003 6:04 am; edited 1 time in total |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 5:45 am Post subject: hummmm |
|
|
well i tired that demo script i get a eorror code 7 at line 21
error is in the :timer code  |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Jan 13, 2003 6:05 am Post subject: |
|
|
I edited my previous post and removed the @substr() function for the
:Timer label. It was originally written for VDS 4. Sorry!
It should work for ya now!  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 6:15 am Post subject: hummmm |
|
|
hummmm
i still get the same eorror  |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Jan 13, 2003 6:19 am Post subject: |
|
|
What version of VDS are you using Tim? _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 6:27 am Post subject: 3.0 |
|
|
i have 3.0  |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Jan 13, 2003 6:32 am Post subject: |
|
|
No problem.
Here's a timer based on SnarlingSheep's concept:
| Code: |
TITLE Timer Demo
option scale,96
option fieldsep,"|"
option decimalsep,"."
rem Timer is "OFF" for starters
%Y = off
rem These will keep track of your hours, minutes, and seconds
%H = 0
%M = 0
%S = 0
dialog create,Timer Demo,-1,0,200,100
dialog add,BUTTON,bStart,10,10,65,25,&Start
dialog add,BUTTON,bStop,45,10,65,25,S&top
dialog add,Status,Stat
dialog show
:Evloop
rem wait 1 second then goto the Timer label
wait event,1
%E = @event()
goto %E
:Timer
rem If %Y is equal to "ON" then...
if @equal(%Y,on)
%S = @succ(%S)
if @equal(Sx,59)
%S = 0
%M = @succ(%M)
end
if @equal(%M,59)
if @equal(%S,59)
%H = @succ(%H)
end
end
dialog set,Stat,%H:%M:%S
else
rem Otherwise do this...
dialog set,Stat,
end
goto Evloop
:bStartBUTTON
rem Turn the timer on here
%Y = on
goto Evloop
:bStopBUTTON
rem Turn the timer off here
%Y = off
goto Evloop
:CLOSE
exit
|
You don't have a TIMER command and @timer() function with VDS 3 that's
why my first example didn't work for ya.
Edit
There's a typeo in the :Timer label ->
if @equal(Sx,59) should be
if @equal(%S,59)
Sorry!  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it."
Last edited by ShinobiSoft on Mon Jan 13, 2003 6:48 am; edited 2 times in total |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Mon Jan 13, 2003 6:39 am Post subject: great |
|
|
thanks
I will play with that to see what i can come up with
thanks again |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Mon Jan 13, 2003 6:48 am Post subject: |
|
|
See the Edit at the bottom of my last post _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
|
|
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 can attach files in this forum You can download files in this forum
|
|