npccleanc.qsrc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # npccleanc
  2. !! {This code should be called to purge a specific NPC. It expects an ARGS[0] of the code of the C array.}
  3. $tempcclean = $ARGS[0]
  4. if mid($tempcclean, 1, 1) = 'C' and npc_firstname['$tempcclean'] > 0:
  5. !! {create arrays to loop through}
  6. ! {array for strings}
  7. $tmpStrArr[0] = 'npc_firstname'
  8. $tmpStrArr[] = 'npc_nickname'
  9. $tmpStrArr[] = 'npc_lastname'
  10. $tmpStrArr[] = 'npc_usedname'
  11. $tmpStrArr[] = 'npc_notes'
  12. $tmpStrArr[] = 'npc_thdick'
  13. $tmpStrArr[] = 'npc_pic'
  14. $tmpStrArr[] = 'npc_PersType'
  15. $tmpStrArr[] = 'npc_dna'
  16. $tmpStrArr[] = 'npc_occupation'
  17. ! {array for ints}
  18. $tmpIntArr[0] = 'npc_dob'
  19. $tmpIntArr[] = 'npc_intel'
  20. $tmpIntArr[] = 'npc_drunk'
  21. $tmpIntArr[] = 'npc_gender'
  22. $tmpIntArr[] = 'npc_dick'
  23. $tmpIntArr[] = 'npc_sexskill'
  24. $tmpIntArr[] = 'npc_spermpot'
  25. $tmpIntArr[] = 'npc_horny'
  26. $tmpIntArr[] = 'npc_apprnc'
  27. $tmpIntArr[] = 'npc_height'
  28. $tmpIntArr[] = 'npc_bust'
  29. $tmpIntArr[] = 'npc_haircol'
  30. $tmpIntArr[] = 'npc_QW'
  31. $tmpIntArr[] = 'npc_rel'
  32. $tmpIntArr[] = 'npc_love'
  33. $tmpIntArr[] = 'npc_outfit'
  34. $tmpIntArr[] = 'npc_herpes'
  35. $tmpIntArr[] = 'npc_syth'
  36. $tmpIntArr[] = 'npc_gon'
  37. $tmpIntArr[] = 'npc_thrush'
  38. $tmpIntArr[] = 'npc_style'
  39. ! {loop through the arrays to kill entries}
  40. tmpArrIndex = 0
  41. :cleanupstrloop
  42. if tmpArrIndex < arrsize('$tmpStrArr'):
  43. tmpNpcIndex = arrpos(('<<$tmpStrArr[tmpArrIndex]>>'), val('<<mid($tempcclean, 2)>>'))
  44. if tmpNpcIndex >= 0:
  45. killvar '<<$tmpStrArr[tmpArrIndex]>>', tmpNpcIndex
  46. end
  47. tmpArrIndex += 1
  48. jump 'cleanupstrloop'
  49. end
  50. tmpArrIndex = 0
  51. :cleanupintloop
  52. if tmpArrIndex < arrsize('$tmpIntArr'):
  53. tmpNpcIndex = arrpos(('$<<$tmpIntArr[tmpArrIndex]>>'), '<<mid($tempcclean, 2)>>')
  54. if tmpNpcIndex >= 0:
  55. killvar ('$<<$tmpIntArr[tmpArrIndex]>>'), tmpNpcIndex
  56. end
  57. tmpArrIndex += 1
  58. jump 'cleanupintloop'
  59. end
  60. ! {cleanup}
  61. killvar 'tmpArrIndex'
  62. killvar 'tmpNpcIndex'
  63. killvar 'tmpStrArr'
  64. killvar 'tmpIntArr'
  65. else
  66. ! {legacy code in case there is no corresponding index: just sets values to default}
  67. $npc_firstname[$tempcclean] = ''
  68. $npc_nickname[$tempcclean] = ''
  69. $npc_lastname[$tempcclean] = ''
  70. $npc_usedname[$tempcclean] = ''
  71. $npc_notes[$tempcclean] = ''
  72. npc_dob[$tempcclean] = 0
  73. npc_intel[$tempcclean] = 0
  74. npc_drunk[$tempcclean] = 0
  75. npc_gender[$tempcclean] = 0
  76. $npc_thdick[$tempcclean] = ''
  77. npc_dick[$tempcclean] = 0
  78. npc_sexskill[$tempcclean] = 0
  79. npc_spermpot[$tempcclean] = 0
  80. npc_horny[$tempcclean] = 0
  81. npc_apprnc[$tempcclean] = 0
  82. npc_height[$tempcclean] = 0
  83. npc_bust[$tempcclean] = 0
  84. npc_haircol[$tempcclean] = 0
  85. npc_QW[$tempcclean] = 0
  86. npc_rel[$tempcclean] = 0
  87. npc_love[$tempcclean] = 0
  88. $npc_occupation[$tempcclean] = ''
  89. npc_outfit[$tempcclean] = 0
  90. $npc_pic[$tempcclean] = ''
  91. npc_herpes[$tempcclean] = 0
  92. npc_syth[$tempcclean] = 0
  93. npc_gon[$tempcclean] = 0
  94. npc_thrush[$tempcclean] = 0
  95. npc_style[$tempcclean] = 0
  96. $npc_PersType[$tempcclean] = ''
  97. $npc_dna[$tempcclean] = ''
  98. end
  99. i = arrsize('$cemptyarray')
  100. $cemptyarray[i] = $tempcclean
  101. :clean_sanity_loop
  102. i = arrsize('$cemptyarray')
  103. If i > 1 and $cemptyarray[0] = $cemptyarray[i]: killvar '$cemptyarray', i & jump 'clean_sanity_loop'
  104. killvar '$tempcclean'
  105. --- npccleanc ---------------------------------