roadmaster
Sorceror
Debugging Code by Line numbers ???
I am currently working on some scripts and i am adding debugging code to the scripts, Im sure theres probably a better way to do it but i am learning as i go and this is what i have so far. What i am wanting to do is to set it up so my second Console.WriteLine will tell what line # has caused a problem. What i have now works but if i add code further toward the top of the file then i will have to go back and change all debugging code after the modifications. So my question is, is there some method that can be used to report the line number of a problem in a Console.WriteLine? Such as in my try statement "mFEARankThree(npc);" doesnt work right so it runs my current catch but in the second WriteLine line# 64 may not always be correct if i add code and dont remember to change all of my debugging code. so what could i replace "line# 64" with that would report the problem line number?
thank you for your time and any effort you expend in helping me with this.
roadmaster
I am currently working on some scripts and i am adding debugging code to the scripts, Im sure theres probably a better way to do it but i am learning as i go and this is what i have so far. What i am wanting to do is to set it up so my second Console.WriteLine will tell what line # has caused a problem. What i have now works but if i add code further toward the top of the file then i will have to go back and change all debugging code after the modifications. So my question is, is there some method that can be used to report the line number of a problem in a Console.WriteLine? Such as in my try statement "mFEARankThree(npc);" doesnt work right so it runs my current catch but in the second WriteLine line# 64 may not always be correct if i add code and dont remember to change all of my debugging code. so what could i replace "line# 64" with that would report the problem line number?
Code:
else if(Drow.Rank == 3)
{
try //Debug check
{
mFEARankThree(npc);
}
catch
{
Console.WriteLine("*** Fatal Exception Caught ***");
Console.WriteLine("*** DrowEquipArmor.cs Line# 64 ***");
Console.WriteLine("*** Method Call to method mFEARankThree(npc) ***");
}
}
thank you for your time and any effort you expend in helping me with this.
roadmaster