You can do that using <values> and/or <expressions> as well as a bit of conditional logic via event attribiutes (/ontrialbegin, /ontrialend, etc.).
Yes, I know that.
I have something like that:
<trial task>/ ontrialbegin = [if(trial.task.trialcount==0)values.start=script.elapsedtime else values.start=values.timeoflastresponse]/ ontrialbegin = [values.bcount = 0]/ ontrialend = [values.timeoflastresponse=script.elapsedtime]/ ontrialend = [values.timebetweenresponses=values.timeoflastresponse-values.start]/ ontrialend = [values.bcount = what should I type here?]/ stimulustimes = [0 = start]/ validresponse = ("b")/ responsetime = 0/ branch = [trial.task]</trial>
But don't know what to write in place of "what..."
#1: You *don't* want to reset that value to zero in every trial. You'll want to reset it at the beginning of a block (if at all).
#2: Simply increase it by one:
/ontrialend = [values.bcount += 1]