forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


timer question

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 2:31 am    Post subject: timer question Reply with quote

hello all

i have a timer that runs a command BUT the problem is as soon as i start vds script timer starts Sad how can i make timer ONLY start when you hit the start button?


thanks
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 2:50 am    Post subject: also Reply with quote

to how to stop timer when you hit the "stop" button?
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon Jan 13, 2003 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 5:22 am    Post subject: hummm Reply with quote

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
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Mon Jan 13, 2003 5:31 am    Post subject: Reply with quote

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. Smile

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 5:45 am    Post subject: hummmm Reply with quote

well i tired that demo script i get a eorror code 7 at line 21 Sad

error is in the :timer code Sad
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Mon Jan 13, 2003 6:05 am    Post subject: Reply with quote

I edited my previous post and removed the @substr() function for the
:Timer label. It was originally written for VDS 4. Sorry! Sad

It should work for ya now! Smile

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 6:15 am    Post subject: hummmm Reply with quote

hummmm

i still get the same eorror Sad
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Mon Jan 13, 2003 6:19 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 6:27 am    Post subject: 3.0 Reply with quote

i have 3.0 Sad
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Mon Jan 13, 2003 6:32 am    Post subject: Reply with quote

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! Sad

_________________
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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Mon Jan 13, 2003 6:39 am    Post subject: great Reply with quote

thanks Smile

I will play with that to see what i can come up with Smile

thanks again
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Mon Jan 13, 2003 6:48 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
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 can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group