
!set percents=!getscorepercent user=$uu
!set percnt=!linecnt $percents
!set per=0
!set av=0

!for i=1 to $percnt
 !set perc=!line $i of $percents
 !distribute words $perc into p1,p2
 !if $p2!=$empty
  !distribute item $[$p1/100],$[$p2/10] into x_,y_
  !set per=$[$per+($(w_$i))*$(f_$i)]
 !endif
!next i

!set examout=!examscore user=$uu
!for i in $activexams
 !set es_$i=!word $i of $examout
 !set per=$[$per+$(ew_$i)*$(es_$i)/10]
!next i

!if $totweight>0
 !set per=$[rint($scoremax*100*$per/$totweight)/100]
!else
 !set per=0
!endif

