CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    154

    [RESOLVED] How to make debug messages

    Is there a way to send messages to error box or something. I have some steps in a method that sends feedback to a textbox. The problem is this part

    Code:
                    //If parryroll was greater than their ParrySkill then they failed
                    if (parry == true) //parry ability true, opponent can Parry!
                    {
                        parryrate = parrySkillOpponent; //Opponent's skill in Parry
                        Random randParry = new Random();
                        parryroll = Math.Abs(randParry.Next(1, 100));
                        if (parrySkillOpponent < parryroll)
                        {
    never seems to happen, even when I set parrySkillOpponent over 100.

    (BTW) The Parry skill is enabled true by a check box. Maybe I am not correctly checking if the checkbox has been checked? If so what is the correct way to check if a Checkbox has been checked?
    Last edited by bixel; March 12th, 2009 at 09:04 AM.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: How to make debug messages

    I don't understand what you're saying. parryroll is always between 1 and 100. If you set parrySkillOpponent over 100, how can you expect that something that is greater than 100 be actually less? So of course the second if always evaluates to false.

    Instead of looking for hacks, you better debug an analyze your code, see what the actual problems are.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Jun 2008
    Posts
    154

    Re: How to make debug messages

    Ohhhh!! I didnt see that hahahaha

  4. #4
    Join Date
    Jun 2008
    Posts
    154

    Re: How to make debug messages

    Oh wait! That was not my full code. I DO check to see if ParrySkill was greater, and yet it still never seems to happen.

    Code:
                    //Parry Ability true?
                    if (parry == true)
                    {
                        parryrate = parrySkillOpponent;
                        Random randParry = new Random();
                        parryroll = Math.Abs(randParry.Next(1, 100));
                        if (parrySkillOpponent < parryroll)
                        {
                            blockedFlag = false; //JUST TO MAKE SURE
                            if (attackrolled >= armorRatingOpponent)
                            {
                                armorFlag = false;
                                totaldamage = damage;
                            }
                            else
                            {
                                //Armor Blocked!!
                                armorFlag = true;
                                totaldamage = damage / 2;
                            }
                        }
                        // THEY PARRIED!!!
                        else if (parrySkillOpponent > parryroll)
                        {
                            #region //Counter Attack or no?
                            #endregion
    
                            totaldamage = damage / 3;
                            blockedFlag = true; //They Parried!
                        }

  5. #5
    Join Date
    Jun 2008
    Posts
    154

    Re: How to make debug messages

    FOUND THE PROBLEM!!!!

    my report function needed an extra catch, Parry was enabled and was used, but the report was getting re-written - so it never gave a report on whether there was a Parry or not.

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

Featured