Добавь параметр начального значения переменной цикла.
#logfile
// upper right
$S_CORR = 0
waitms(100 + $S_CORR)
keyDown(39)
waitms(1000 + $S_CORR)
keyUp(39)
waitms(100 + $S_CORR)
keyDown(38)
waitms(1000 + $S_CORR)
keyUp(38)
waitms(100 + $S_CORR)
RCLICK(849,525)
waitms(100 + $S_CORR)
LCLICK(849,525)
waitms(2000 + $S_CORR)
//colors
$arr[0]=263172
$arr[1]=197636
$arr[2]=197380
$arr[3]=197379
$arr[4]=131843
$arr[5]=131587
$arr[6]=131586
$arr[7]=197122
$arr[8]=262915
//black staff
$x[0]=930
$y[0]=449
$x1[0]=1323
$y1[0]=519
$x[1]=790
$y[1]=795
$x1[1]=828
$y1[1]=887
$x[2]=1089
$y[2]=342
$x1[2]=1229
$y1[2]=401
$x[3]=1217
$y[3]=142
$x1[3]=1267
$y1[3]=245
$x[4]=853
$y[4]=234
$x1[4]=935
$y1[4]=291
$x[5]=931
$y[5]=528
$x1[5]=1028
$y1[5]=627
$x[6]=652
$y[6]=93
$x1[6]=753
$y1[6]=165
$x[7]=1173
$y[7]=636
$x1[7]=1211
$y1[7]=755
GETSCREEN
FOR($c=0, $c < 8)
FOR($a=0, $a < 8)
$i[$a]=PXLCOUNT($x[$c],$y[$c], $x1[$c],$y1[$c], $arr[$a])
LOGWRITE ($i[$a])
IF($i[$a] > 0)
$b=$i[$a]
$a=8
$c=7
end_if
END_CYC
END_CYC
LOGWRITE ("Сообщение ",$b)
SCREENSHOTEX(0,0, $_xmax,$_ymax, $b, 0)
halt