I think something like this would do (I mocked this together to illustrate the idea - you would have your actual events there):
[attachment=0:1t7xmqe4][/attachment:1t7xmqe4]
Since the TotalAttack only changes any time you change equipment you only need to sum the values when that happens.
Then, when you attack something use the TotalAttack global variable to subtract the damage.