# notification

if $ARGS[0] = 'counter':
	!! DEBUG:
	!!'<<$notification_message[0]>>; <<notification_shown[0]>>; <<_n_timer>>'

	if $notification_message[0] ! '' and notification_shown[0] = 1: _n_timer += 1
	if _n_timer > 5:
		gs 'notification', 'update_display'
		killvar '$notification_message', 0
		killvar 'notification_shown', 0
		_n_timer = 0
	end
end

if $ARGS[0] = 'update_display':
	if $notification_message[1] ! '':
		$stat_msg = replace($stat_msg, $notification_message[0], $notification_message[1])
		notification_shown[1] = 1
	else
		$stat_msg = replace($stat_msg, $notification_message[0])
	end
	clr & pl '<<$stat_msg>>'
end

!! adds a notification to the queue
!! message string can contain html tags like format or maybe even links
!! i think links should work, or an image with link embedded in it
!! theoretically all the techniques used in stat_display should work
!! use: gs 'notification', 'add', 'message string'
if $ARGS[0] = 'add':
	$temp_notification_message = '<table><tr><td><<$ARGS[1]>></td></tr></table>'

	$notification_message[] = $temp_notification_message
	$notification_log[] = '<<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>> <<day>><<$date_suffix>> <<$month>> <<year>>'+$temp_notification_message

	killvar '$temp_notification_message'

	if arrsize('$notification_log') > 30: killvar '$notification_log', 0
end

--- notification ---------------------------------