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 


Multiple Timer example...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Jan 15, 2003 6:05 am    Post subject: Multiple Timer example... Reply with quote

There's been some questions about multiple timers, so
here's one way to do it.

It's not gonna be 100 percent accurate - occasionally
"WAIT EVENT, 1" loses a second for ya, but hopefully ya
won't be using VDS in a missile defense system anyway...
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Test Program,-1,0,200,40
  DIALOG ADD,STATUS,Stat2,@datetime(ss)
  DIALOG ADD,STATUS,Stat1,@datetime(ss)
DIALOG SHOW

:EVLOOP
  WAIT EVENT, 1
  goto @event()

:TIMER
  %t = @datetime(ss)
  DIALOG SET, Stat1, %t
  DIALOG SET, Stat2, %t
  rem -- Use GOSUB (not GOTO) if ya want both timers to work --
  if @equal(@mod(%t, 2), 0)
     GOSUB TIMER1
  end
  if @equal(@mod(%t, 5), 0)
     GOSUB TIMER2
  end
  goto EVLOOP

:TIMER1
  DIALOG SET, Stat1, %t - "2 second timer"
  exit

:TIMER2
  DIALOG SET, Stat2, %t - "5 second timer"
  exit

:CLOSE
  EXIT

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Jan 15, 2003 6:26 am    Post subject: Re: Multiple Timer example... Reply with quote

Mac wrote:
... but hopefully ya won't be using VDS in a missile defense system anyway...


Darn! Does that mean that I cannot do that NASA Mars flight control program in VDS ??
I'd better stick with Space Invaders or something instead then...

Wink

Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 571
Location: Bergen, Norway

PostPosted: Thu Nov 18, 2004 8:29 am    Post subject: Reply with quote

Thanks for the example.
I need to use two timers in my program.
The first timer runs a code every 300 seconds or 5 minutes, that checks a server for update. And the second timer to be used in a minimize to taskicon thing.

Any chance for a simple example for that?

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Thu Nov 18, 2004 10:10 am    Post subject: Reply with quote

Just use a 1 second time to do a countdown. Do the minimize thing each time. Do the other thing when the countdown reaches 0, and then reset it to 300.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 571
Location: Bergen, Norway

PostPosted: Thu Nov 18, 2004 11:48 am    Post subject: Reply with quote

Good idea jules.
Thanks Smile

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code 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