# npc

if $ARGS[0] = 'cleanarrays':
	i_gs_cl = 0
	:CiklNpcCleanLoop
	if i_gs_cl < arrsize('$npc_index'):
		if $npc_index[i_gs_cl] = $npclastgenerated : 			i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$cumarrnam', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$sparrnam', $npc_index[i_gs_cl]) >= 0 : 		i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$cumfthname', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$wombpotfath', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$wombName', $npc_index[i_gs_cl]) >= 0 : 		i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$cumfathlotto', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$ChildFath', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'
		if arrpos('$ChildThFath', $npc_index[i_gs_cl]) >= 0 : 	i_gs_cl += 1 & jump 'CiklNpcCleanLoop'

		if mid($npc_index[i_gs_cl],1,1) = 'C' or mid($npc_index[i_gs_cl],1,1) = 'b' :
			gs 'npccleanc',ucase($npc_index[i_gs_cl])
			jump 'CiklNpcCleanLoop'
		end
		i_gs_cl += 1
		jump 'CiklNpcCleanLoop'
	end
	killvar 'i_gs_cl'
end

if $ARGS[0] = 'age':
	currnpc_year = mid(npc_dob[$ARGS[1]], 1, 4)
	currnpc_month = mid(npc_dob[$ARGS[1]], 5, 2)
	currnpc_day = mid(npc_dob[$ARGS[1]], 7, 2)
	currnpc_age = year - currnpc_year
	if currnpc_month < month:
		currnpc_age -= 1
	elseif currnpc_month = month and currnpc_day < day:
		currnpc_age -= 1
	end
	RESULT = currnpc_age
	killvar 'currnpc_year'
	killvar 'currnpc_month'
	killvar 'currnpc_day'
	killvar 'currnpc_age'
end

if $ARGS[0] = 'intro':
	!! this procedure is designed for introduction of any npc either with standard or with custom description
	!! $ARGS[1] is ID number of npc... required parameter
	!! $ARGS[2] is an image path
	!! $ARGS[3] is a color name of the title  e.g. 'red'
	!! $ARGS[4] is $npc_notes replacement
	!! $ARGS[5] is an additional text
	!! ARGS[6] sets image path to video output - 0 = off - 1 = on
	!! Format: gs 'npc' 'intro', ARGS[1], $ARGS[2], $ARGS[3], $ARGS[4], $ARGS[5]
	!! Example: gs 'npc' 'intro', 'A23', '', 'green', '', 'Optional text here' <=== This would display Albina''s picture using the path in 'npcstatic1' with her name above it in green text followed by her default description and finally, your relationship level.
	!! Credit goes to rachels for coming up with the concept and initial code!!!

	*clear
	$static_num = $ARGS[1]

	if npc_rel[$static_num] < 20: $npc_cur_rel = 'You don''t get along at all with <<$npc_firstname[$static_num]>>.'
	if npc_rel[$static_num] >= 20 and npc_rel[$static_num] < 40: $npc_cur_rel = 'You don''t get along very well with <<$npc_firstname[$static_num]>>.'
	if npc_rel[$static_num] >= 40 and npc_rel[$static_num] < 60: $npc_cur_rel = 'You have a normal relationship with <<$npc_firstname[$static_num]>>.'
	if npc_rel[$static_num] >= 60 and npc_rel[$static_num] < 80: $npc_cur_rel = 'You have a good relationship with <<$npc_firstname[$static_num]>>.'
	if npc_rel[$static_num] >= 80: $npc_cur_rel = 'You have a great relationship with <<$npc_firstname[$static_num]>>.'

	if $ARGS[2] = '':
		$image_path = $npc_pic[$static_num]
	else
		$image_path = $ARGS[2]
	end

	if $ARGS[3] = '':
		$titlecolor ='maroon'
	else
		$titlecolor = $ARGS[3]
	end

	if $ARGS[4] = '':
		$description = $npc_notes[$static_num]
	else
		$description = $ARGS[4]
	end

	$apendix = $ARGS[5]

	'<center><b><font color = <<$titlecolor>>><<$npc_firstname[$static_num]>> <<$npc_lastname[$static_num]>></font></b></center>' & *nl
	if $image_path ! '':
		if ARGS[6] = 0:
			'<center><img <<$set_imgh>> src="<<$image_path>>"></center>' & *nl
		else
			'<center><video autoplay loop src="<<$image_path>>"></video></center>' & *nl
		end
	end
	if $description ! '' and $description ! ' ': $description + $npc_cur_rel
	if $apendix ! '' and $apendix ! ' ':$apendix

	killvar '$npc_cur_rel'
	killvar '$apendix'
	killvar '$description'
	killvar '$image_path'
end

--- npc ---------------------------------
