# npccleanc !! {This code should be called to purge a specific NPC. It expects an ARGS[0] of the code of the C array.} $tempcclean = $ARGS[0] if mid($tempcclean, 1, 1) = 'C' and npc_firstname['$tempcclean'] > 0: !! {create arrays to loop through} ! {array for strings} $tmpStrArr[0] = 'npc_firstname' $tmpStrArr[] = 'npc_nickname' $tmpStrArr[] = 'npc_lastname' $tmpStrArr[] = 'npc_usedname' $tmpStrArr[] = 'npc_notes' $tmpStrArr[] = 'npc_thdick' $tmpStrArr[] = 'npc_pic' $tmpStrArr[] = 'npc_PersType' $tmpStrArr[] = 'npc_dna' $tmpStrArr[] = 'npc_occupation' ! {array for ints} $tmpIntArr[0] = 'npc_dob' $tmpIntArr[] = 'npc_intel' $tmpIntArr[] = 'npc_drunk' $tmpIntArr[] = 'npc_gender' $tmpIntArr[] = 'npc_dick' $tmpIntArr[] = 'npc_sexskill' $tmpIntArr[] = 'npc_spermpot' $tmpIntArr[] = 'npc_horny' $tmpIntArr[] = 'npc_apprnc' $tmpIntArr[] = 'npc_height' $tmpIntArr[] = 'npc_bust' $tmpIntArr[] = 'npc_haircol' $tmpIntArr[] = 'npc_QW' $tmpIntArr[] = 'npc_rel' $tmpIntArr[] = 'npc_love' $tmpIntArr[] = 'npc_outfit' $tmpIntArr[] = 'npc_herpes' $tmpIntArr[] = 'npc_syth' $tmpIntArr[] = 'npc_gon' $tmpIntArr[] = 'npc_thrush' $tmpIntArr[] = 'npc_style' ! {loop through the arrays to kill entries} tmpArrIndex = 0 :cleanupstrloop if tmpArrIndex < arrsize('$tmpStrArr'): tmpNpcIndex = arrpos(('<<$tmpStrArr[tmpArrIndex]>>'), val('<>')) if tmpNpcIndex >= 0: killvar '<<$tmpStrArr[tmpArrIndex]>>', tmpNpcIndex end tmpArrIndex += 1 jump 'cleanupstrloop' end tmpArrIndex = 0 :cleanupintloop if tmpArrIndex < arrsize('$tmpIntArr'): tmpNpcIndex = arrpos(('$<<$tmpIntArr[tmpArrIndex]>>'), '<>') if tmpNpcIndex >= 0: killvar ('$<<$tmpIntArr[tmpArrIndex]>>'), tmpNpcIndex end tmpArrIndex += 1 jump 'cleanupintloop' end ! {cleanup} killvar 'tmpArrIndex' killvar 'tmpNpcIndex' killvar 'tmpStrArr' killvar 'tmpIntArr' else ! {legacy code in case there is no corresponding index: just sets values to default} $npc_firstname[$tempcclean] = '' $npc_nickname[$tempcclean] = '' $npc_lastname[$tempcclean] = '' $npc_usedname[$tempcclean] = '' $npc_notes[$tempcclean] = '' npc_dob[$tempcclean] = 0 npc_intel[$tempcclean] = 0 npc_drunk[$tempcclean] = 0 npc_gender[$tempcclean] = 0 $npc_thdick[$tempcclean] = '' npc_dick[$tempcclean] = 0 npc_sexskill[$tempcclean] = 0 npc_spermpot[$tempcclean] = 0 npc_horny[$tempcclean] = 0 npc_apprnc[$tempcclean] = 0 npc_height[$tempcclean] = 0 npc_bust[$tempcclean] = 0 npc_haircol[$tempcclean] = 0 npc_QW[$tempcclean] = 0 npc_rel[$tempcclean] = 0 npc_love[$tempcclean] = 0 $npc_occupation[$tempcclean] = '' npc_outfit[$tempcclean] = 0 $npc_pic[$tempcclean] = '' npc_herpes[$tempcclean] = 0 npc_syth[$tempcclean] = 0 npc_gon[$tempcclean] = 0 npc_thrush[$tempcclean] = 0 npc_style[$tempcclean] = 0 $npc_PersType[$tempcclean] = '' $npc_dna[$tempcclean] = '' end i = arrsize('$cemptyarray') $cemptyarray[i] = $tempcclean :clean_sanity_loop i = arrsize('$cemptyarray') If i > 1 and $cemptyarray[0] = $cemptyarray[i]: killvar '$cemptyarray', i & jump 'clean_sanity_loop' killvar '$tempcclean' --- npccleanc ---------------------------------