Adblock breaks this site

[Source] Skull Timer

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

  1. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    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
    [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.
     
  2. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    [Source] Skull Timer

    It seems like it only counts 59 seconds?
     
  3. halojunkie

    halojunkie Active Member

    Joined:
    Dec 17, 2005
    Posts:
    232
    Referrals:
    0
    Sythe Gold:
    0
    [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
     
  4. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    [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.
     
  5. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    [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
     
  6. bojanglesman

    bojanglesman Member

    Joined:
    Nov 4, 2007
    Posts:
    32
    Referrals:
    0
    Sythe Gold:
    0
    [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
     
  7. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    [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. =)
     
  8. Cornflake

    Cornflake Active Member

    Joined:
    Nov 8, 2007
    Posts:
    141
    Referrals:
    0
    Sythe Gold:
    0
    [Source] Skull Timer

    ooo ill try this, thanks
     
  9. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    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
    [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.
     
  10. pkng0d

    pkng0d Forum Addict

    Joined:
    Nov 17, 2007
    Posts:
    253
    Referrals:
    0
    Sythe Gold:
    0
    [Source] Skull Timer

    ty for this
     
  11. jdsfighter

    jdsfighter Forum Addict
    Visual Basic Programmers

    Joined:
    Jan 21, 2007
    Posts:
    603
    Referrals:
    0
    Sythe Gold:
    0
    [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] >


 
 
Adblock breaks this site