Since this may interest others, I'll share my findings here. This is is the script I'm using (NOLAG_SOMcounter.sqf). The script refers to NOLAG_play1_1 wich is the min playable unit. You may replace it with player in a strict single player scenario.
while {NOLAG_andCounting} do
{
private ["_mainScope", "_numberOfCompletedMissions", "_numberOfFailedMissions"];
_mainScope = NOLAG_play1_1 getVariable "mainScope";
_numberOfCompletedMissions = (_mainScope getVariable "history") select 0;
_numberOfFailedMissions = (_mainScope getVariable "history") select 1;
sleep 1;
if (_numberOfFailedMissions > 0) then {NOLAG_somBad = true};
sleep 1;
if (_numberOfCompletedMissions > _numberOfFailedMissions) then {NOLAG_somGood = true};
sleep 1;
};
Counting the number of completed missions is easy. Notice however that a failed mission also qualifies as a COMPLETED mission, as well as a FAILED one. Hence the soultion where you will trigger a reward (NOLAG_somGood = true) if, and only if, the total number of completed missions exceeds the number of failed ones. If I just count completed missions a failure may result in a reward.
To trigger a negative effect I just need to count the number of failed missions. It seems that this variable will always remain equal to or lower than the number of completed missions.
Thank's Worldeater for all the help. Hope this is useful to some people.