gschool_randperson.qsrc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. # gschool_randperson
  2. !! arguments: <gender> <excluded_first_name> <grupTipeEnabled>...
  3. !! gender : 0 for male, 1 for female
  4. !! excluded_first_name : can be '' or you can provide result of previous invocation, so you can compose non-repeating pairs of people
  5. !! <grupTipeEnabled>... : 1 if you include grupTipe, 0 otherwise, look at examples below
  6. !!
  7. !! example:
  8. !! $rand_girl = func('gschool_randperson', 1, '', 1, 1, 0, 1, 0, 0)
  9. !! $rand_girl1 = func('gschool_randperson', 1, $rand_girl, 1, 1, 0, 1)
  10. !!
  11. !! Having grupTipes (social groups)
  12. !! 1 - cool kids
  13. !! 2 - jocks
  14. !! 3 - nerds
  15. !! 4 - Gopnik
  16. !! 5 - outcasts
  17. !! 6 - teachers
  18. !! examples above instruct to choose random person from: cool kids, jocks and gopniks
  19. !! NOTE that in $rand_girl1 zero values for outcasts and teachers are not defined - undefined values will be zero by language
  20. !! Thanks to that you can include new social group and you don''t need to make changes in all places
  21. if $ARGS[0] = 'person_generator':
  22. rand_person_ind = 0
  23. rand_filtered_ind = 0
  24. :filter_loop
  25. rand_person_ind = rand_person_ind + 1
  26. if rand_person_ind >= ARRSIZE('grupTipe') : jump 'outside_filter_loop'
  27. genderMatches = ARGS[0] = npcPol[rand_person_ind]
  28. nameIsNotRepeated = ARGS[1] <> $npc_firstname[$school_static_num[rand_person_ind]]
  29. grupTipeIsLegal = grupTipe[rand_person_ind] > 0
  30. grupTipeMatches = ARGS[grupTipe[rand_person_ind] + 1] = 1
  31. if genderMatches and nameIsNotRepeated and grupTipeIsLegal and grupTipeMatches :
  32. rand_filtered[rand_filtered_ind] = rand_person_ind
  33. rand_filtered_ind = rand_filtered_ind + 1
  34. end
  35. jump 'filter_loop'
  36. :outside_filter_loop
  37. if ARRSIZE('rand_filtered') > 0 :
  38. random_person = rand_filtered[rand(0,ARRSIZE('rand_filtered'))]
  39. $RESULT = $npc_firstname[$school_static_num[random_person]]
  40. else
  41. $rand_gender = IIF (ARGS[0] = 0, 'boy', 'girl')
  42. $RESULT = '<<$rand_gender>> you don''t know'
  43. end
  44. KILLVAR 'rand_person_ind'
  45. KILLVAR 'rand_filtered_ind'
  46. KILLVAR 'rand_filtered'
  47. KILLVAR '$rand_gender'
  48. KILLVAR 'random_person'
  49. KILLVAR 'genderMatches'
  50. KILLVAR 'nameIsNotRepeated'
  51. KILLVAR 'grupTipeIsLegal'
  52. KILLVAR 'grupTipeMatches'
  53. end
  54. if $ARGS[0] = 'couple_generator':
  55. :couple_jump
  56. couple_rand = rand(1,53)
  57. if couple_rand = 1:
  58. $rand_girl = 'Viktoriya'
  59. $rand_boy = 'Vanya'
  60. elseif couple_rand = 2:
  61. $rand_girl = 'Lina'
  62. $rand_boy = 'Ivan'
  63. elseif couple_rand = 3:
  64. $rand_girl = 'Stasya'
  65. $rand_boy = 'Andrey'
  66. elseif couple_rand = 4:
  67. $rand_girl = 'Lariska'
  68. $rand_boy = 'Ivan'
  69. elseif couple_rand = 5:
  70. $rand_girl = 'Lizaveta'
  71. $rand_boy = 'Andrey'
  72. elseif couple_rand = 6:
  73. $rand_girl = 'Lina'
  74. $rand_boy = 'Lazar'
  75. elseif couple_rand = 7:
  76. $rand_girl = 'Bella'
  77. $rand_boy = 'Lazar'
  78. elseif couple_rand = 8:
  79. $rand_girl = 'Lariska'
  80. $rand_boy = 'Lazar'
  81. elseif couple_rand = 9:
  82. $rand_girl = 'Irina'
  83. $rand_boy = 'Lazar'
  84. elseif couple_rand = 10:
  85. $rand_girl = 'Irina'
  86. $rand_boy = 'Dimka'
  87. elseif couple_rand = 11:
  88. $rand_girl = 'Anushka'
  89. $rand_boy = 'Marcus'
  90. elseif couple_rand = 12 and kotovLoveQW <= 0:
  91. $rand_girl = 'Pauline'
  92. $rand_boy = 'Vitek'
  93. elseif couple_rand = 13:
  94. $rand_girl = 'Pauline'
  95. $rand_boy = 'Dan'
  96. elseif couple_rand = 14:
  97. $rand_girl = 'Anushka'
  98. $rand_boy = 'Radomir'
  99. elseif couple_rand = 15:
  100. $rand_girl = 'Anushka'
  101. $rand_boy = 'Valentin'
  102. elseif couple_rand = 16:
  103. $rand_girl = 'Anushka'
  104. $rand_boy = 'Arkadi'
  105. elseif couple_rand = 17:
  106. $rand_girl = 'Alyona'
  107. $rand_boy = 'Valentin'
  108. elseif couple_rand = 18:
  109. $rand_girl = 'Alyona'
  110. $rand_boy = 'Arkadi'
  111. elseif couple_rand = 19:
  112. $rand_girl = 'Sonia'
  113. $rand_boy = 'Andrey'
  114. elseif couple_rand = 20:
  115. $rand_girl = 'Sonia'
  116. $rand_boy = 'Ivan'
  117. elseif couple_rand = 21:
  118. $rand_girl = 'Sonia'
  119. $rand_boy = 'Dimka'
  120. elseif couple_rand = 22:
  121. $rand_girl = 'Sonia'
  122. $rand_boy = 'Lazar'
  123. elseif couple_rand = 23:
  124. $rand_girl = 'Sonia'
  125. $rand_boy = 'Vasily'
  126. elseif couple_rand = 24:
  127. $rand_girl = 'Sonia'
  128. $rand_boy = 'Svyatoslav'
  129. elseif couple_rand = 25:
  130. $rand_girl = 'Sonia'
  131. $rand_boy = 'Erast'
  132. elseif couple_rand = 26 and fedorlove < 1:
  133. $rand_girl = 'Sonia'
  134. $rand_boy = 'Fedor'
  135. elseif couple_rand = 27:
  136. $rand_girl = 'Sonia'
  137. $rand_boy = 'Marcus'
  138. elseif couple_rand = 28 and kotovLoveQW <= 0:
  139. $rand_girl = 'Sonia'
  140. $rand_boy = 'Vitek'
  141. elseif couple_rand = 29:
  142. $rand_girl = 'Sonia'
  143. $rand_boy = 'Dan'
  144. elseif couple_rand = 30:
  145. $rand_girl = 'Sonia'
  146. $rand_boy = 'Radomir'
  147. elseif couple_rand = 31:
  148. $rand_girl = 'Sonia'
  149. $rand_boy = 'Valentin'
  150. elseif couple_rand = 32:
  151. $rand_girl = 'Sonia'
  152. $rand_boy = 'Arkadi'
  153. elseif couple_rand = 33:
  154. $rand_girl = 'Sonia'
  155. $rand_boy = 'Roman'
  156. elseif couple_rand = 34:
  157. $rand_girl = 'Pauline'
  158. $rand_boy = 'Radomir'
  159. elseif couple_rand = 35:
  160. $rand_girl = 'Anushka'
  161. $rand_boy = 'Lazar'
  162. elseif couple_rand = 36:
  163. $rand_girl = 'Anushka'
  164. $rand_boy = 'Ivan'
  165. elseif couple_rand = 37:
  166. $rand_girl = 'Anushka'
  167. $rand_boy = 'Lavrenti'
  168. elseif couple_rand = 38:
  169. $rand_girl = 'Alyona'
  170. $rand_boy = 'Lavrenti'
  171. elseif couple_rand = 39:
  172. $rand_girl = 'Albina'
  173. $rand_boy = 'Lazar'
  174. elseif couple_rand = 40:
  175. $rand_girl = 'Sonia'
  176. $rand_boy = 'Lavrenti'
  177. elseif couple_rand = 41:
  178. $rand_girl = 'Albina'
  179. $rand_boy = 'Radomir'
  180. elseif couple_rand = 42:
  181. $rand_girl = 'Lizaveta'
  182. $rand_boy = 'Lavrenti'
  183. elseif couple_rand = 43:
  184. $rand_girl = 'Christina'
  185. $rand_boy = 'Lazar'
  186. elseif couple_rand = 44:
  187. $rand_girl = 'Christina'
  188. $rand_boy = 'Ivan'
  189. elseif couple_rand = 45:
  190. $rand_girl = 'Lariska'
  191. $rand_boy = 'Ivan'
  192. elseif couple_rand = 46:
  193. $rand_girl = 'Lariska'
  194. $rand_boy = 'Radomir'
  195. elseif couple_rand = 47:
  196. $rand_girl = 'Lina'
  197. $rand_boy = 'Andrey'
  198. elseif couple_rand = 48:
  199. $rand_girl = 'Lina'
  200. $rand_boy = 'Svyatoslav'
  201. elseif couple_rand = 49:
  202. $rand_girl = 'Lina'
  203. $rand_boy = 'Radomir'
  204. elseif couple_rand = 50:
  205. $rand_girl = 'Pauline'
  206. $rand_boy = 'Radomir'
  207. elseif couple_rand = 51:
  208. $rand_girl = 'Lena'
  209. $rand_boy = 'Radomir'
  210. elseif couple_rand = 52:
  211. $rand_girl = 'Lena'
  212. $rand_boy = 'Lavrenti'
  213. elseif couple_rand = 53:
  214. $rand_girl = 'Sonia'
  215. $rand_boy = 'Niko'
  216. else
  217. jump 'couple_jump'
  218. end
  219. killvar 'couple_rand'
  220. end
  221. --- gschool_randperson ---------------------------------