# npcpreservec
!! {It expects an Args containing a C array index}
!! {This initializes the array and acts as a gate to deny bad calls.}
$npctemp = $ARGS[0]

if mid($npctemp,1,1) = 'C':
	:npcsavebsanityloop
	i = 0
	$npclastsaved = 'B' + '<<barraynumber>>'
	$npctemparrb = 'B' + '<<(barraynumber)-(1)>>'
	if $npc_PersType[$npctemparrb] = '' and barraynumber > 0:
		barraynumber -= 1
		i = 1
	elseif $npc_PersType[$npclastsaved] = '':
		i = 0
	else
		barraynumber += 1
		i = 1
	end
	if i = 1: jump 'npcsavebsanityloop'
	barraynumber += 1
	
	! {This copies the array from Array C to Array B}
	$npc_firstname[$npclastsaved] = $npc_firstname[$npctemp]
	$npc_nickname[$npclastsaved] = $npc_nickname[$npctemp]
	$npc_lastname[$npclastsaved] = $npc_lastname[$npctemp]
	$npc_usedname[$npclastsaved] = $npc_usedname[$npctemp]
	$npc_notes[$npclastsaved] = $npc_notes[$npctemp]
	npc_dob[$npclastsaved] = npc_dob[$npctemp]
	npc_intel[$npclastsaved] = npc_intel[$npctemp]
	npc_drunk[$npclastsaved] = npc_drunk[$npctemp]
	npc_gender[$npclastsaved] = npc_gender[$npctemp]
	$npc_thdick[$npclastsaved] = $npc_thdick[$npctemp]
	npc_dick[$npclastsaved] = npc_dick[$npctemp]
	npc_sexskill[$npclastsaved] = npc_sexskill[$npctemp]
	npc_spermpot[$npclastsaved] = npc_spermpot[$npctemp]
	npc_horny[$npclastsaved] = npc_horny[$npctemp]
	npc_apprnc[$npclastsaved] = npc_apprnc[$npctemp]
	npc_height[$npclastsaved] = npc_height[$npctemp]
	npc_bust[$npclastsaved] = npc_bust[$npctemp]
	npc_haircol[$npclastsaved] = npc_haircol[$npctemp]
	npc_QW[$npclastsaved] = npc_QW[$npctemp]
	npc_rel[$npclastsaved] = npc_rel[$npctemp]
	npc_love[$npclastsaved] = npc_love[$npctemp]
	$npc_occupation[$npclastsaved] = $npc_occupation[$npctemp]
	npc_outfit[$npclastsaved] = npc_outfit[$npctemp]
	$npc_pic[$npclastsaved] = $npc_pic[$npctemp]
	npc_style[$npclastsaved] = npc_style[$npctemp]
	$npc_PersType[$npclastsaved] = $npc_PersType[$npctemp]
	$npc_dna[$npclastsaved] = $npc_dna[$npctemp]

	! {This checks the miscellanious arrays for the Entry and changes it to the new Array B.}
	:npctempmloop
	npctemp2 = arrpos('$cumarrnam', $npctemp)
	if npctemp2 >= 0: $cumarrnam[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$sparrnam', $npctemp)
	if npctemp2 >= 0: $sparrnam[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$cumfthname', $npctemp)
	if npctemp2 >= 0: $cumfthname[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$cumfthnames', $npctemp)
	if npctemp2 >= 0: $cumfthnames[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$wombpotfath', $npctemp)
	if npctemp2 >= 0: $wombpotfath[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$cumfathlotto', $npctemp)
	if npctemp2 >= 0: $cumfathlotto[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$ChildFath', $npctemp)
	if npctemp2 >= 0: $ChildFath[npctemp2] = $npclastsaved & jump 'npctempmloop'
	npctemp2 = arrpos('$ChildThFath', $npctemp)
	if npctemp2 >= 0: $ChildThFath[npctemp2] = $npclastsaved & jump 'npctempmloop'

	! {Thic checks Array A for the Entry and changes it to the new Array B. The parts commented out don''t work and need to be replaced with something that does.}
	if $pcs_firstpart = $npctemp: $pcs_firstpart = $npclastsaved
	if $pcs_lastpart = $npctemp: $pcs_lastpart = $npclastsaved
	
	! {This clears the Entry in Array C}
	gs 'npccleanc', $npctemp
end
!! Preserves npclastsavedn. Giving the last numerical B array saved.
npclastsavedn = mid($npclastsaved, 2)

killvar 'npctemp2'
killvar '$npctemp2'
killvar '$npctemp'

--- npcpreservec ---------------------------------

