TBC Defense stat

Very new to MACROs and would like help making a macro in TBC classic that shows my current defense stat (not skill) like when I go into the character sheet. That way as I am gearing I can just click my crushing blow check and then click a defense check to check for X out of 490. I took the crushing blow one and started to edit it. stopped after “490 defense” /script DEFAULT_CHAT_FRAME:AddMessage(“Need 490 defense. Currently at:”,0.8,0.8,1)
/script DEFAULT_CHAT_FRAME:AddMessage(GetDodgeChance()+GetBlockChance()+GetParryChance()+5+(GetCombatRating(CR_DEFENSE_SKILL)*150/355 + 20)*0.04,1,0.5,0)

/script DEFAULT_CHAT_FRAME:AddMessage("\124CFFCCCCFFNeed 490 defense. Currently at: \124CFFFF8000"..GetDodgeChance()+GetBlockChance()+GetParryChance()+5+(GetCombatRating(CR_DEFENSE_SKILL)*150/355 + 20)*0.04)

Thank you for the reply. I entered that in but I still got the same result as my crushing blow macro. It was telling me 47 when my char sheet shows 468.

Try:

    /script local _,d1=UnitDefense("player"); local d=20+d1; print(d)

and see if the variable d prints out to the correct value. Note that the 20 is assuming you talented into the defense talent fully in the prot tree. If not, adjust the 20 to the correct value for your toon.

EDIT: had a typo, so had to retype it.

My post was not about the math. Your OP seemed to me to be about an error from the double /script.

Sorry for the confusion. I just wanted a defense check like I have an avoidance check. I used the crushing blow macro as a starting point and tinkered around with it but for the life of me can’t get it so display what my total defense stat is like on my char sheet. I do know I can just check my char sheet but I’d like to have a macro for it.

/run local base,mod=UnitDefense("player")local pos=mod>0 and mod or 0 local neg=mod<0 and mod or 0; DEFAULT_CHAT_FRAME:AddMessage("\124CFFCCCCFFNeed 490 defense. Currently at: \124CFFFF8000"..max(0,base+pos+neg))

Math provided by Blizzard Paper Doll frame.

Worked like a charm! Thank you