Is this what you're looking for? It doesn't actually return a number unfortunately.

Code:
---------------------------------------------------
Identifier:              BattlesFought
Trigger requirements:    faction
Parameters:              logic token, quantity
Sample use:              BattlesFought = 6
Description:             How many battles has the player fought so far during this campaign?
Battle or Strat:         Either
Class:                   BATTLES_FOUGHT
Implemented:             Yes
Author:                  Guy
---------------------------------------------------