Page 2 of 10 FirstFirst 12345 ... LastLast
Results 41 to 80 of 366

Thread: Flickering Buttons: How Do I Get Rid Of Them?

  1. #41

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by MartinLiss View Post
    Lastly let me say that I believe that you will be making a BIG mistake if you have 4 very similar Q forms. So again let me ask, why do you have Q1 and Q2 when it looks to me that they are almost exactly the same?
    Separate text files are being considered for each Q# form (like I stated above, Q1 will involve "questions1.txt" file, Q2 to Q4 will involve "questions2.txt" file, and eventually Q5 (to start Round 2) will involve the "questions3.txt" file.

    Not to mention that I heard from someone that you can only sync captions or other stuff with DirectSoundBuffers up to 12 times in a single form. I could have heard wrong, but is it actually possible to sync items to DirectSoundBuffers more than 12 times in a single form?

  2. #42
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Code:
    Select Case SomeVariableThatDefinesWhatStageTheGameIsIn
        Case 1
            Open Questions1.txt...
        Case 2
            Open Questions2.txt...    
        Case 3
            Open Questions3.txt...
        'etc.
    End Select case
    I have no knowledge about DirectSoundBuffers but you could ask a question in this or the games forum and find out.

  3. #43
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Are you sure, that it isn't video flickering and not processes errors???
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  4. #44

  5. #45

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by MartinLiss View Post
    Code:
    Select Case SomeVariableThatDefinesWhatStageTheGameIsIn
        Case 1
            Open Questions1.txt...
        Case 2
            Open Questions2.txt...    
        Case 3
            Open Questions3.txt...
        'etc.
    End Select case
    I put this code in the Form_Load section, but how could I code the following in order to allow for the case numbers to be used for each question in numerical order (like Case 1 for Question 1, Case 2 for Question 2, etc.)?

    Here is my code:

    Code:
        Case ShowQuestion
            token = 0
            QuesCount(0).Caption = "A"
            For i = 0 To 1
                Label2(i).Visible = False
            Next
            CurrentQ = CurrentQ + 1
            If CurrentQ > 36 Then CurrentQ = 1
            For i = 2 To 3
                Label1(i).Caption = Question(CurrentQ)
            Next
            Command1.Enabled = False
            Command2.Enabled = True
            Command2.Visible = True
            Text1.Enabled = True

  6. #46
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Are you now going with my suggestion of using just one form?

    If so why is that code in Form_Load since Form_Load is only run once?

    And I'm also not sure what you are asking about case numbers for each question but perhaps this.

    Code:
    Select Case CurrentQ 
        Case 1
            ' do whatever special things are required when doing question #1
        Case 2
            ' do whatever special things are required when doing question #2
        'etc
    End Select case
    Do you need any explanation of the Select Case construct?

  7. #47

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by MartinLiss View Post
    Are you now going with my suggestion of using just one form?
    Yes, but I do have the former code backed up on my hard drive just in case.

    Quote Originally Posted by MartinLiss View Post
    Code:
    Select Case CurrentQ 
        Case 1
            ' do whatever special things are required when doing question #1
        Case 2
            ' do whatever special things are required when doing question #2
        'etc
    End Select case
    Do you need any explanation of the Select Case construct?
    So, with regards to the Select Case CurrentQ construct (and I do know how it works), but do I place that Select Case CurrentQ within the Case ShowQuestion area?

    I do have some news, however... My PC isn't working properly this morning (problems involve mostly the NVIDIA graphics card and other stuff), and I had to bring it in to a repair shop a little while ago. Might be at least 3 days before I get my CPU back. I am at my grandfather's computer as I key this, so I will be without a computer in my home for a few days.

    Quote Originally Posted by MartinLiss View Post
    If so why is that code in Form_Load since Form_Load is only run once?
    Probably due to some trial and error, which apparently didn't work at all.

  8. #48

  9. #49
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I've got a question for you In my version of the program cur.lPlay never changes from 0 so the the game starts but the first question isn't shown. How does cur.lPlay get a value > 0?

  10. #50
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Working with the new files you sent me I noticed that when you click the X on Game1A.frm that the app doesn't actually end. That's because in the Unload sub of that form you have a line that says Info.Timer1.Enabled = False. When any control of a form is referred to that form is Loaded (if not already loaded) so the Info form is Loaded again. I may be responsible for that line being there but it should be removed.

    Also, and I don't know the rules of the real game, I find that I can almost always "guess" the right number if I choose 0 and then "Higher". Is that the way the real game is played?

    The problem you mention in your question #2 (which has to do with the control array) is being caused by CurrentSlot being -1 which makes makes such lines as Set CurImage = RCard(CurrentSlot) invalid. CurrentSlot becomes -1 when you change WhosTurn to RedPlayer while freezecard(1) is still -1.

  11. #51

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by MartinLiss View Post
    Also, and I don't know the rules of the real game, I find that I can almost always "guess" the right number if I choose 0 and then "Higher". Is that the way the real game is played?
    That is correct. No negative numbers (nothing below zero) are involved in game play.

    Also, I removed the line from Form_Unload, but it would be nice for the music to stop when I launch Game1.frm. What would I do for the music to stop upon launching Game1.frm?

    And what would I do to fix this problem with the cards? Any recommendations?
    Last edited by JonSea31; Dec 16th, 2009 at 01:03 PM.

  12. #52
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    [QUOTE=JonSea31;3682048]That is correct. No negative numbers (nothing below zero) are involved in game play. But why then would anyone ever select any number other than 0?
    Also, I removed the line from Form_Unload, but it would be nice for the music to stop when I launch Game1.frm. What would I do for the music to stop upon launching Game1.frm? I'll look into that.

    And what would I do to fix this problem with the cards? Any recommendations? Please describe what should happen using the names of objects and what should appear in them including image names.[/QUOTE]....

  13. #53

  14. #54

  15. #55

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I added the line of code that will stop the music when advancing to a new form. It works perfectly.

    Now, another problem with the cards...

    When the red or blue player wins the first question, and that same player makes a mistake on the cards, then the opposite player (say, the red player, for example) gets a free shot at the cards, then after that it's on to Question 2.

    But whoever wins Question 2 (whether it be the red or the blue player), that person has control of the cards, and if that person makes a mistake (should the red player have had a free turn before the start of Question 2), instead of the blue player getting a free shot at the cards, it automatically goes on to a new question. This should not prevail. If the blue player gets first shot at the cards after winning the first question, and the red player gets a free shot at the cards if the blue player makes a mistake, then the red player wins the second question and has first shot at the cards, and then makes a mistake, it should alternate players so that if the first player that turn plays the cards and makes a mistake, the other person has a shot at the cards.

    I will send you the updated files and see what can be done about it. But other than that, I seem to be on the right track.

  16. #56
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I'm looking at the problem you mentioned and in doing that I noticed something. You have two Shuffle routines, one in Game1B and the other in GameEssentails6. I don't believe you need both and so you should remove the one in Game1B. I'm not sure if I mentioned this in our discussion of scope, but if you have two procedures with the same name (like shuffle), VB will execute the most local one. So as it is now, the shuffle routine in GameEssentails6 is being executed when shuffle is called from Game1B Form_Load because the form isn't fully loaded yet and its shuffle routine doesn't exist. Once the form is loaded however its shuffle is the one that's executed because it's local to the form.

    One of the places that the shuffle is executed from is the Timer1 in that form when token equals PlayIntro. That means that the deck is shuffled over and over unnecessarily until the token value changes. That's one of the problems with putting so much stuff in your timer. In any case I believe you can safely remove the following lines from that sub.

    Code:
            Randomize (Timer)
            Shuffle 'call card shuffle

  17. #57
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Hang on a sec. The shuffle in gameessentials is different and it appears to be wrong so unless you have a special purpose for that shuffle use the one in Game1B instead.

  18. #58

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    After finishing the second question, and the red player wins that question, he plays the cards, makes a mistake, and then instead of the blue player having control of the cards, it advances right to the next question. Removing Shuffle command from Form_Load or Timer1 didn't do any good.

    I'll have to provide a video later this evening and provide a visual example of what I am referring to.

  19. #59
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by JonSea31 View Post
    After finishing the second question, and the red player wins that question, he plays the cards, makes a mistake, and then instead of the blue player having control of the cards, it advances right to the next question. Removing Shuffle command from Form_Load or Timer1 didn't do any good.

    I'll have to provide a video later this evening and provide a visual example of what I am referring to.
    I'm sorry but I didn't mean to imply that removing shuffle would fix the problem you reported to me. What it does do is to make your program run faster and more efficiently.

  20. #60

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Sorry, didn't mean to misunderstand, but thanks for making it run faster.

    Anyways, a video will come within the next few hours or tomorrow morning at the latest and it will show where the problem exists.

  21. #61

  22. #62

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I am familiar with Private or Public Sub, but Private Property, this is something new to me.

    Anyways, as promised, here is a video demonstration to show you where the problem lies (and it is a video recording of the gameplay in action, complete with annotations):

    http://www.youtube.com/watch?v=JAUXe1XWd7w

    I downloaded the other sample you sent me just now, and I will test it out, and see if it helps me any bit. I will see if I can provide feedback at some point tomorrow.

  23. #63

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    BTW, I did a test run with the updated code you sent me, and it does run more smoothly (at least for the first play of the cards).

    If I can get the problem with the cards fixed, so that it can be prevented for all subsequent playings of the cards and allow for consistency throughout the game, then the next thing to get rid of will be the flickering of the images upon synching DirectSound. I will see if I can create a new thread about other ways to sync captions/images/buttons with certain parts of audio soon.

  24. #64
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    You will have to split up the audio into separate files, to be set into motion upon the captions, images and buttons. It is just that more easily done that way. But that is for your other thread, and then I guess that we can leave it as that, don't you think???
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  25. #65
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I played the video and the last notation I saw was "so far so good" at about 00:45. Did I miss some later ones? You could also just tell me the time where the problem happens, what I'm looking at and what I should be seeing instead.

  26. #66

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Scroll to about 2:30, and from there on in, you'll discover where the problem exists.

    Updated link.

    It is recommended that you view the clip from 1:30 onwards.

  27. #67

  28. #68
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    In the video you say you set the max to 100. Here is how you can do that programmatically.

    Create a new form-level variable like

    Code:
    Private mlngMaxAnswer As Long
    Then when you read a question file do this.
    Code:
            Dim lngMax As Long
            Open (App.Path & "\text\audiencepollquestions2.txt") For Input As 1
                For i = 1 To 35
                    Line Input #1, tmpstr
                    tmp = Split(tmpstr, "|")
                    Question(i) = tmp(0): ans(i) = tmp(1)
                    If ans(i) > lngMax Then
                        lngMax = ans(i)
                    End If
                Next i
            Select Case lngMax
                Case 0 To 10
                    mlngMaxAnswer = 10
                Case 11 To 100
                    mlngMaxAnswer = 100
                Case Else
                    mlngMaxAnswer = 99999 '?
            End Select
    And finally

    Code:
    Private Sub Command2_Click()
    
        If Val(Text1.Text) < 0 Or Val(Text1.Text) > mlngMaxAnswer Then
            MsgBox "Answer must be between 0 and " & mlngMaxAnswer & "."
            Text1.Enabled = True
        Else
            RDNumber.Visible = True
            RDNumber.Caption = Val(Text1.Text)
            Text1.Enabled = False
            WhosTurn = BluePlayer
            token = AskHigherLower
        End If
    End Sub

  29. #69

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Good advice on setting the maximum number, but the problem is in the cards transitioning to the next question.

    I should have provided a disclaimer that the first few seconds of the clip should be ignored, as a new game starts at around 1:10, and that is where the updated game is supposed to start.
    • The first question is revealed, the red player enters a number, and the blue player guesses higher or lower.

    • The blue player wins his/her question, and then has first shot at the cards.

    • The blue player makes a mistake midway across the row, and the red player has a free shot at the cards.

    • The red player eventually freezes on the 5 (which is the next-to-last card on the red row), and then the game goes to the second question.

    • The blue player answers that question with a numeric answer, then the red player guesses higher or lower.

    • The red player wins control of the cards, and then chooses to play off the 5. He predicts lower. The card result was higher, and while control of the cards was supposed to be designated to the blue player (who would normally have a free shot at the cards), the blue player's turn at the cards gets skipped, and it moves to the next question instead.


    As for setting the maximum number to 10, 99, or whatever, it would take 3 text files of questions for each maximum number to be used.

  30. #70
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Is the reason for the problem that the tokens are the same?

    Code:
        Case HigherWrongCardsB
            For i = 0 To 1
                Label1(i).Caption = Label2(1).Caption & vbCrLf & "No, it is not higher."
            Next
            Me.Refresh
            PlaySound App.Path & "\sounds\buzz1.wav", ByVal 0&, SND_SYNC Or SND_FILENAME
            RemoveCards
            Sleep 200
            If FreezeCard(WhosTurn) < 0 And WhosTurn = RedPlayer Then
                token = RestartTurnB1
            ElseIf FreezeCard(WhosTurn) < 0 And WhosTurn = BluePlayer Then
                token = RestartTurnB1
            Else
                token = Q2Audio 'wait for button event
            End If

  31. #71
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Actually what is happening there is that for some reason the token in that code is not being set to RestartTurnB1, but rather to Q2Audio which starts the ball rolling to the next question. Put a breakpoint on the If FreezeCard(WhosTurn) < 0 And WhosTurn = RedPlayer Then line and when the code gets there at the appropriate time step through the code using F8 and you may be able to see why the token is being set improperly.

  32. #72
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Okay I set a breakpoint on that line and when the code got there WhosTurn is 0 and so FreezeCard(WhosTurn) is 0 and since the first two parts of the If check for < 0 the If defaults to setting the token to Q2Audio.

  33. #73

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by MartinLiss View Post
    Okay I set a breakpoint on that line and when the code got there WhosTurn is 0 and so FreezeCard(WhosTurn) is 0 and since the first two parts of the If check for < 0 the If defaults to setting the token to Q2Audio.
    So what would I have to set the FreezeCard(WhosTurn) to? In order for the other player to have control of the cards (blue player would have free shot), would I have to set the FreezeCard(WhosTurn) to > 0 or something?

    And the "0" in FreezeCard(WhosTurn) - is that where the player's base card would be located?

  34. #74
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Please describe in English what you want to have happen in the code I show after the Sleep 200 line. Is it anything more complex than if it is currently Blue's turn make it Red's and vice versa?

    And as to your "And the "0" in FreezeCard(WhosTurn) - is that where the player's base card would be located?" question, you're the program's author so you would be the one to answer that.

  35. #75

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I figured it out myself, and realized where I went wrong.

    After the Sleep 200 line, I used this code:

    Code:
            If FreezeCard(WhosTurn) > 0 Then
                token = RestartTurnB1
            ElseIf FreezeCard(WhosTurn) = 0 Then
                token = RestartTurnB1
            Else
                token = StartQ2 'wait for button event
            End If
    And the transfer of control of cards works perfectly now.

    However, after the second player makes a mistake on the cards, I cannot advance to the StartQ2. Only two players max should play the cards after each question.

  36. #76
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Try that code like this:
    Code:
            If FreezeCard(WhosTurn) > 0 Then token = RestartTurnB1
            If FreezeCard(WhosTurn) = 0 Then token = RestartTurnB1
            If token = StartQ2
            End If
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  37. #77
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Quote Originally Posted by JonSea31 View Post
    I figured it out myself, and realized where I went wrong.

    After the Sleep 200 line, I used this code:

    Code:
            If FreezeCard(WhosTurn) > 0 Then
                token = RestartTurnB1
            ElseIf FreezeCard(WhosTurn) = 0 Then
                token = RestartTurnB1
            Else
                token = StartQ2 'wait for button event
            End If
    And the transfer of control of cards works perfectly now.

    However, after the second player makes a mistake on the cards, I cannot advance to the StartQ2. Only two players max should play the cards after each question.
    That can be simplified to

    Code:
            If FreezeCard(WhosTurn) >= 0 Then
                token = RestartTurnB1
            Else
                token = StartQ2 'wait for button event
            End If

  38. #78
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    What you could do is to create a new global integer to keep track of how many wrong guesses there have been and if the total gets to two then set the token to StartQ2. Don't forget to reset the new global to 0 when the you are done with it.

  39. #79

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2008
    Location
    St. John's, Newfoundland, Canada
    Posts
    965

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    I (sort of) did that already. Only I created a label to designate how many plays of the cards were used per question.

    If the first player (say, the red player) won control of the cards, that play of the cards would be designated - in the PlayAOrB.Caption - the letter "A." If the red player who won the question made a mistake, control goes to the blue player and has a free play at the cards (which the PlayAOrB.Caption is designated the letter "B"). Once that turn is used, the "B" is cleared (PlayAOrB.Caption = "") and it moves to the next question.

    BTW, I am already working on getting past the third question, and I believe there is significant progress going on right now.

    After many test runs, and just before the game gets released, I will place the labels behind the picture box so that they will be hidden and no one will see them.

  40. #80
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Flickering Buttons: How Do I Get Rid Of Them?

    Please don't be insulted when I say this but the use of labels to keep track of things like that is a noobie-ish technique and not the best way to do it. While it can work, you make your program less (very slightly less) efficient if you do because there is unnecessary overhead generated when you use a label rather than a variable. Also a more experienced person looking at your code would never expect to find labels being used that way. So my suggestion to you would be to remove the labels and replace them with variables. If you are going to store numbers in them then one method to "clear" them would be to set their value to -1 or 9999 or something like that if setting them to 0 would be a problem. BTW if I were doing it I would create a variable and a CONST like this.

    Private mintKeepTrackOfSomething As Integer
    Private Const INITIAL_VALUE = 9999

    And so to "clear" it I would do
    mintKeepTrackOfSomething = INITIAL_VALUE

    One reason for going through the trouble of creating the Const is that if you want to "clear" the variable in several places you take the chance of missing one if for some reason you decide to change the value you use to indicate the "clear" state. With the Const you just have to change the value of the Const. Another reason is that when you use a properly named const it is self-documenting. If you're not aware of the self-documenting concept it means that it makes the program easier to understand. Compare the following to lines of code:

    mintKeepTrackOfSomething = 9999
    mintKeepTrackOfSomething = INITIAL_VALUE

    In the first case you may have to think for a split second to understand what is going on and in the second you don't.

    Using Consts like that and giving objects and variables meaningful names is all about self-documentation and trust me, it's very important because for example right now you may know immediately what Command1 is when you see it in code (at this point you may well be seeing it in your dreams), but if you come back to this program six months from now it would make getting back into the program a lot easier if it were named cmdShowQuestion.

Page 2 of 10 FirstFirst 12345 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width