Creating a pause...

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
User avatar
MasterChief2829




Critic Blacksmith

Posts: 1184
Joined: Sun Dec 26, 2004 2:18 pm

Creating a pause...

Post by MasterChief2829 »

Hey, I was wondering how you make it like pause. I know how to make it so a message pops up of course thats basic... but can you make it like pause a few seconds before the message pops up? Like time it? Thanks.
Onetoomanysodas





Posts: 325
Joined: Mon Mar 22, 2004 3:59 pm
Location: Everywhere but nowhere
Contact:

Post by Onetoomanysodas »

Yea, at the end of the code where you want it to pause write something like this:

Code: Select all

Command1_click()
Timer1.Interval = 3000 '(This is 3 seconds because its in milliseconds)
End Sub
Make sure to create a timer and put this code in the timer:

Code: Select all

Timer1_Timer()
Msgbox "3 seconds have passed"
Timer1.interval = 0
End Sub
The reason you set the interval to 3000 and then back to 0 is because when a timer's interval is set to 0 it is the same as being disabled. This also allows you to press the command button more than once. This also works with the timer.enabled property but then you have to set the timer to be disabled on startup rather than its default enabled.
User avatar
MasterChief2829




Critic Blacksmith

Posts: 1184
Joined: Sun Dec 26, 2004 2:18 pm

Post by MasterChief2829 »

I'm using Visual C#... isnt that Visual Basic,...
Patrickssj6




Pi Collaborator

Posts: 5426
Joined: Sat Jul 24, 2004 12:12 pm
Location: I'm a Paranoid
Contact:

Post by Patrickssj6 »

Yeah that was vb
...left for good
User avatar
MasterChief2829




Critic Blacksmith

Posts: 1184
Joined: Sun Dec 26, 2004 2:18 pm

Post by MasterChief2829 »

ahh well I can use VB too :P Thanks.
superaison





Posts: 175
Joined: Mon Jul 25, 2005 5:06 pm

Post by superaison »

Onetoomanysodas wrote:Yea, at the end of the code where you want it to pause write something like this:

Code: Select all

Command1_click()
Timer1.Interval = 3000 '(This is 3 seconds because its in milliseconds)
End Sub
Make sure to create a timer and put this code in the timer:

Code: Select all

Timer1_Timer()
Msgbox "3 seconds have passed"
Timer1.interval = 0
End Sub
The reason you set the interval to 3000 and then back to 0 is because when a timer's interval is set to 0 it is the same as being disabled. This also allows you to press the command button more than once. This also works with the timer.enabled property but then you have to set the timer to be disabled on startup rather than its default enabled.

um that just made like the app crash
Onetoomanysodas





Posts: 325
Joined: Mon Mar 22, 2004 3:59 pm
Location: Everywhere but nowhere
Contact:

Post by Onetoomanysodas »

Uhm, this is vb 6 you noob
Post Reply