# counter
if music_on <> music_on_prev or $music_theme <> $music_theme_prev:
	close $cur_theme[track[$music_theme_prev]]
	music_on_prev = music_on
	$music_theme_prev = $music_theme

	if $music_theme <>'':
		copyarr 'cur_theme', 'tracklist_<<$music_theme>>'
		track[$music_theme] = track[$music_theme]-1

		if track[$music_theme] < 0:track[$music_theme] = arrsize('cur_theme')
	end
end

if music_on = 1 and $music_theme <> '':
	if no isplay ($cur_theme[track[$music_theme]]):
		track[$music_theme] += 1

		if arrsize('cur_theme') <= track[$music_theme]:track[$music_theme] = 0
	end

	play $cur_theme[track[$music_theme]], volume
end

!race
if race_start = 1:
	bcolor = rgb(255, 255, 255)
	refint
	*clr

	if race_hit = 0:
		set race_miss += 1
		race_hit = 1
	end
		
	if $race1[race_row] <> ' ' and race_row > 0:race_hit = 0

	'<center><b><<$car>></b></center>'
	!interior of the vehicle and the line route
	*pl $showcar
	*p $race1[race_row]
		
	if $race1[race_row] = '<center>-------FINISH--------</center>':
		set race_start = 0
		!return timer
		settimer 500
		wait 2000
		!return point
		set $metka = 'finish'
		set $loc = 'RACE_COUNT'
		gt $loc, $metka
	end
		
	race_row += 1
end

--- counter ---------------------------------
