Click to See Complete Forum and Search --> : [RESOLVED] How to make debug messages


bixel
March 12th, 2009, 08:52 AM
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


//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?

cilu
March 12th, 2009, 09:02 AM
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.

bixel
March 12th, 2009, 09:09 AM
Ohhhh!! I didnt see that hahahaha

bixel
March 12th, 2009, 09:19 AM
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.


//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!
}

bixel
March 12th, 2009, 09:55 AM
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.