The target_counter is the best way to go because scripting it can lead to a problem. One objective in my sp map is to destroy 12 imperial mainframes. I originally scripted the counting. After each mainframe is destroyed it would target the target_scriptrunner. I discovered a problem though, if the player destroys more than one at the same time the target_scriptrunner is only run once. On the other hand with a target_counter, you can use a detonator and destroy as many as you want at the same time and it'll keep count.
For variables, you have to declare and set them like this.
//Generated by BehavEd
declare ( /*@DECLARE_TYPE*/ FLOAT, "variablename" );
set ( "variablename", "0" );
To increment them:
set ( "variablename", "+1" );