I think that you want to maintain several different counts, and only increment a count in a given loop if you receive a message relating to that particular count. So:
local count,senderID,msg = {0,0,0,0} --however many counts you need
rednet.open("side")
while true do --infinite loop
for i = 1,4 do print(count[i]) end --so you can see how high it has counted
senderID, msg = rednet.receive()
if conditionalstatement then
--somehow extract an index n
count[n] = count[n] + 1 --increment
end
end
I can't say exactly what conditionalstatement should be without knowing the format of the messages the turtles are sending, but it shouldn't be too hard. Getting the right index for each count is the thing, if you're using turtles with IDs of 1-4 (or some other sequential group of IDs) and sorting the counts by turtle, then it's super easy. If you want to extract some element of the message that specifies which count should be increased, then it is trickier but still very doable.