[Source] Skull Timer

Discussion in 'Programming General' started by Blupig, Nov 8, 2007.

[Source] Skull Timer
  1. Unread #1 - Nov 8, 2007 at 8:40 AM
  2. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [Source] Skull Timer

    You need:
    1 Textbox (txtSeconds)
    To enable the Timer1, just put a command button in, and it's code would be:
    Code:
    Private Sub Command1_Click()
    Timer1.Enable = True
    End Sub
    
    To make the timer count down from 20 minutes, add this in your Form Load()
    Code:
    Private Sub Form_Load()
    txtSeconds.Text = "1200"
    End Sub
    
    Code:
    Private Sub Timer1_Timer()
    
    If txtSeconds.Text > 0 Then
    txtSeconds.Text = txtSeconds.Text - 1
    Else
    txtSeconds.Text = 59
    End If
    
    If txtSeconds.Text = 0 Then
    Timer1.Enabled = False
    MsgBox "The skull timer has gone through it's cycle.", vbCritical = vbOKOnly, "Skull Timer Source by Blupig"
    End If
    End Sub

    GIVE CREDEETZ >:3
    This was originally made by Timk77, but his version didn't work so I modded it.
     
  3. Unread #2 - Nov 8, 2007 at 3:34 PM
  4. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    [Source] Skull Timer

    It seems like it only counts 59 seconds?
     
  5. Unread #3 - Nov 8, 2007 at 5:49 PM
  6. halojunkie
    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0

    halojunkie Active Member

    [Source] Skull Timer

    That would appear to only count 59 seconds. And I believe a skull stays around for 20 minutes. If you want a sample source let me know
     
  7. Unread #4 - Nov 9, 2007 at 9:00 AM
  8. Nullware
    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0

    Nullware Guru

    [Source] Skull Timer

    Code:
    Private Sub Command1_Click()
        Timer1.Enabled = True
        Timer1.Interval = 1000
        txtSeconds.Text = 1200
    End Sub
    
    Private Sub Timer1_Timer()
    
    If txtSeconds.Text > 0 Then
        txtSeconds.Text = txtSeconds.Text - 1
    Else
        txtSeconds.Text = 1200
    End If
    
    If txtSeconds.Text = 0 Then
        Timer1.Enabled = False
        MsgBox "The skull timer has gone through it's cycle.", vbCritical = vbOKOnly, "Skull Timer Source by Blupig"
    End If
    
    End Sub
    If you want to learn here's a working one I just whipped up.
     
  9. Unread #5 - Nov 10, 2007 at 3:28 PM
  10. WoW Sucks
    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0

    WoW Sucks Global Moderator
    Banned

    [Source] Skull Timer

    Code:
    Private Sub Command1_Click()
    Timer1.Enabled = True
    Text1.Text = Text1.Text & 60
    Text2.Text = Text2.Text & 20
    End Sub
    
    Private Sub Timer1_Timer()
    
    If Text1.Text > 0 Then
    Text1.Text = Text1.Text - 1
    End If
    
    If Text1.Text = 0 Then
        Text1.Text = Text1.Text + 60
        Text2.Text = Text2.Text - 1
        
    End If
    
    If Text2.Text = 0 And Text1.Text = 1 Then
        MsgBox "The Skull Timer Has Ended!", vbInformation, "Skull Timer Ended"
        Timer1.Enabled = False
    End If
    End Sub
    
    My noob source :D

    EDIT: Text1 is seconds and text2 is mins
     
  11. Unread #6 - Nov 10, 2007 at 9:46 PM
  12. bojanglesman
    Joined:
    Nov 4, 2007
    Posts:
    32
    Referrals:
    0
    Sythe Gold:
    0

    bojanglesman Member

    [Source] Skull Timer

    Wow Sucks, i fixed your source so that when you click command1 it disables command1 so you cant fuck it up when its counting down. This one fully works! :p


    Code:
    Private Sub command1_Click()
    Timer1.Enabled = True
    Text1.Text = Text1.Text & 60
    Text2.Text = Text2.Text & 20
    command1.Enabled = False
    End Sub
    
    Private Sub Form_Load()
    
    End Sub
    
    Private Sub Timer1_Timer()
    
    If Text1.Text > 0 Then
    Text1.Text = Text1.Text - 1
    End If
    
    If Text1.Text = 0 Then
        Text1.Text = Text1.Text + 60
        Text2.Text = Text2.Text - 1
        
    End If
    
    If Text2.Text = 0 And Text1.Text = 1 Then
        MsgBox "The Skull Timer Has Ended!", vbInformation, "Skull Timer Ended"
        Timer1.Enabled = False
        command1.Enabled = True
    End If
    End Sub
     
  13. Unread #7 - Nov 11, 2007 at 4:11 AM
  14. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    [Source] Skull Timer

    WoW Sucks, put this in the Command1 Sub.
    Code:
    Timer1.Enabled = True
    Text1.Text = 60
    Text2.Text = 20
    Command1.Enabled = False
    See, having the "Text1.Text &" could screw it up, if the user clicks it more than once you could have Text1 saying "20202020202019" or something. Not that it matters if the button is disabled. =P But for future reference. =)
     
  15. Unread #8 - Nov 11, 2007 at 5:45 AM
  16. Cornflake
    Joined:
    Nov 8, 2007
    Posts:
    141
    Referrals:
    0
    Sythe Gold:
    0

    Cornflake Active Member

    [Source] Skull Timer

    ooo ill try this, thanks
     
  17. Unread #9 - Nov 11, 2007 at 10:49 AM
  18. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [Source] Skull Timer

    Actually no, my source code is right - You just need to set the original value of the textbox to 1200 (this timer counts down in seconds). I'll add it to the code.
     
  19. Unread #10 - Nov 22, 2007 at 6:59 PM
  20. pkng0d
    Joined:
    Nov 17, 2007
    Posts:
    253
    Referrals:
    0
    Sythe Gold:
    0

    pkng0d Forum Addict

    [Source] Skull Timer

    ty for this
     
  21. Unread #11 - Nov 23, 2007 at 11:39 AM
  22. jdsfighter
    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0

    jdsfighter Forum Addict
    Visual Basic Programmers

    [Source] Skull Timer

    Or how about all in one label.

    1 Label - Name: lblNoSkull Caption: 20:00
    1 Timer - Name: Timer2Skull Interval: 1000

    Code:
    Private Sub Timer2Skull_Timer()
    Dim Mins As Integer, Secs As Integer
    Mins = Split(lblNoSkull.Caption, ":")(0)
    Secs = Split(lblNoSkull.Caption, ":")(1)
    If Secs > 0 Then
        Secs = Secs - 1
    Else
        Mins = Mins - 1
        Secs = "59"
    End If
    Secs = Format(Secs, "0#")
    Mins = Format(Mins, "0#")
    lblNoSkull.Caption = Mins & ":" & Secs
    If lblNoSkull.Caption = "00:00" Then MsgBox "Skull Times Up!!", vbInformation = vbOKOnly, "Skull Over"
    End Sub
     
< Webbrowser? | [Icons Pack ~ 249 Icons] >

Users viewing this thread
1 guest


 
 
Adblock breaks this site