shortgs.qsrc 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. # shortgs
  2. !! make an autosave unless it is disabled
  3. if $ARGS[0] = 'autosave':
  4. if disable_autosave = 0:
  5. if mid($start_type, 1, 4) = 'city':
  6. savegame 'autosave_city.sav'
  7. elseif mid($start_type, 1, 3) = 'uni':
  8. savegame 'autosave_uni.sav'
  9. else
  10. savegame 'autosave_sg.sav'
  11. end
  12. end
  13. end
  14. !! following function counts the number of guys which PC slept with.
  15. !! use func('shortgs','guy') or func('shortgs','guy',X) for subset (X can be 'A','B','C','AB','AC','BC')
  16. if $ARGS[0] = 'guy':
  17. r_sht=0
  18. if $ARGS[1] = '': $temptask = 'ABC' else $temptask = $ARGS[1]
  19. :loop_shtty
  20. $temptaskchar = mid($temptask,1,1)
  21. $temptask = mid($temptask,2,len($temptask)-1)
  22. s_sht=0
  23. :loop_shya
  24. if s_sht<=dyneval("result = <<$temptaskchar>>arraynumber"):
  25. s_sht += 1
  26. if npc_sex['<<$temptaskchar>><<s_sht>>'] > 0: r_sht = r_sht + iif(npc_gender['<<$temptaskchar>><<s_sht>>'] = 0,1,0)
  27. jump 'loop_shya'
  28. end
  29. if len($temptask) > 0:jump 'loop_shtty'
  30. result = r_sht
  31. killvar 'r_sht'
  32. killvar '$temptask'
  33. killvar '$temptaskchar'
  34. killvar 's_sht'
  35. end &! --- guy ---
  36. !! following function counts the number of girls which PC slept with.
  37. !! use func('shortgs','girl') or func('shortgs','girl',X) for subset (X can be 'A','B','C','AB','AC','BC')
  38. if $ARGS[0] = 'girl':
  39. r_sht=0
  40. if $ARGS[1] = '': $temptask = 'ABC' else $temptask = $ARGS[1]
  41. :loop_shttl
  42. $temptaskchar = mid($temptask,1,1)
  43. $temptask = mid($temptask,2,len($temptask)-1)
  44. s_sht=0
  45. :loop_shl
  46. if s_sht<=dyneval("result = <<$temptaskchar>>arraynumber"):
  47. s_sht += 1
  48. if npc_sex['<<$temptaskchar>><<s_sht>>'] > 0: r_sht = r_sht + iif(npc_gender['<<$temptaskchar>><<s_sht>>'] = 1,1,0)
  49. jump 'loop_shl'
  50. end
  51. if len($temptask) > 0: jump 'loop_shttl'
  52. result = r_sht
  53. killvar 'r_sht'
  54. killvar '$temptask'
  55. killvar '$temptaskchar'
  56. killvar 's_sht'
  57. end &! --- girl ---
  58. !! following procedure should be used when PC gets naked, but it should be paired with the reverse procedure
  59. !! use gs 'shortgs','undress'
  60. if $ARGS[0] = 'undress':
  61. gs 'underwear', 'remove'
  62. gs 'clothing','strip'
  63. end &! --- undress ---
  64. !! reverse procedure, it can be modified for lose or stolen panties later.
  65. !! use gs 'shortgs','dress'
  66. if $ARGS[0] = 'dress':
  67. gs 'clothing','wear_last_worn'
  68. gs 'underwear', 'wear'
  69. end &! --- dress ---
  70. !! procedure, which prevents PC to leave a room naked.
  71. !! use gs 'shortgs','checkdress',' <<$loc>>,<<$loc_arg>> ' or equivalent
  72. if $ARGS[0] = 'checkdress':
  73. if $clothingworntype = 'nude':
  74. msg '<b><font color="red">You need to get dressed before going out.</font></b>'
  75. dynamic 'gt <<$ARGS[1]>>'
  76. end
  77. end &! --- checkdress ---
  78. !! this is an integer sqrt function
  79. !! call func('shortgs','sqrt', n)
  80. if $ARGS[0] = 'sqrt':
  81. sqrtnum = ARGS[1]
  82. if sqrtnum = 0: result = 0 & exit
  83. sqrtn = sqrtnum/2 + 1
  84. sqrtn1 = (sqrtn + sqrtnum / sqrtn) / 2
  85. :sqrtloop
  86. if sqrtn1 < sqrtn:
  87. sqrtn = sqrtn1
  88. sqrtn1 = (sqrtn + sqrtnum / sqrtn) / 2
  89. jump 'sqrtloop'
  90. end
  91. result = sqrtn
  92. end
  93. !! this function calculates modul of given arguments as it was coordinates in cartezian systeme
  94. !! use func('shortgs','modul',n1,n2,..n8)
  95. if $ARGS[0] = 'modul':
  96. modul_sum = ARGS[1]*ARGS[1]+ARGS[2]*ARGS[2]+ARGS[3]*ARGS[3]+ARGS[4]*ARGS[4]+ARGS[5]*ARGS[5]+ARGS[6]*ARGS[6]+ARGS[7]*ARGS[7]+ARGS[8]*ARGS[8]
  97. result = func('shortgs','sqrt',modul_sum)
  98. killvar 'modul_sum'
  99. end
  100. !! day of week 1 - Monday .. 7 - Sunday
  101. if $ARGS[0] = 'dow':
  102. if ARGS[1]=0:
  103. D_dow = day
  104. M_dow = month
  105. Y_dow = year
  106. else
  107. D_dow = ARGS[3]
  108. M_dow = ARGS[2]
  109. Y_dow = ARGS[1]
  110. end
  111. dow_a = (14 - M_dow) / 12
  112. dow_Y = Y_dow - dow_a
  113. dow_M = M_dow + 12*dow_a - 2
  114. dummy = (D_dow + dow_y + dow_y/4 - dow_y/100 + dow_y/400 + (31*dow_m)/12) mod 7
  115. if dummy = 0: dummy = 7
  116. result = dummy
  117. end
  118. !! day of year
  119. !! use xdoy = func('shortgs','doy',year,month,day)
  120. if $ARGS[0] = 'doy':
  121. doy_N1 = 275 * ARGS[2] / 9
  122. doy_N2 = (ARGS[2] + 9) / 12
  123. doy_N3 = 1 + (ARGS[1] - 4 * (ARGS[1] / 4) + 2) / 3
  124. result = doy_N1 - (doy_N2 * doy_N3) + ARGS[3] - 30
  125. end
  126. if $ARGS[0] = 'mk1':
  127. gs 'saveposition'
  128. *clr & cla
  129. $mk_subst['0'] = 'M' & $mk_subst['1'] = 'F' & $mk_subst['2'] = 'O' & $mk_subst['3'] = 'L' & $mk_subst['4'] = 'R' & $mk_subst['5'] = 'P'
  130. '<center><font face="courier" size=1>'
  131. '<table border = 1>'
  132. '<tr><th>Mon</th><th>Tue</th><th>Wen</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th><th>Mon</th><th>Tue</th><th>Wen</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th>
  133. <th>Mon</th><th>Tue</th><th>Wen</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th><th>Mon</th><th>Tue</th><th>Wen</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th></tr>'
  134. i = ArrSize('$MenCal')
  135. empty0 = week + 29 - i - 1
  136. empty1 = min(28,empty0)
  137. full1 = max(0,28 - empty0)
  138. empty2 = max(0,empty0-28)
  139. full2 = i - full1
  140. empty3 = 28 - empty2 - full2
  141. count=0
  142. $tabmc = '<tr>'
  143. :tabmcl1
  144. if empty1 > 0: empty1 -=1 & $tabmc +='<td>&nbsp</td>' & jump 'tabmcl1'
  145. :tabmcl2
  146. if full1 > 0:
  147. full1 -=1
  148. if $MenCal[count]='0': $tabmc +='<td bgcolor="red"><<$mk_subst[$MenCal[count]]>></td>' else $tabmc +='<td><<$mk_subst[$MenCal[count]]>></td>'
  149. count +=1
  150. jump 'tabmcl1'
  151. end
  152. $tabmc += '</tr><tr>'
  153. :tabmcl3
  154. if empty2 > 0: empty2 -=1 & $tabmc +='<td>&nbsp</td>' & jump 'tabmcl3'
  155. :tabmcl4
  156. if full2 > 0:
  157. full2 -=1
  158. if $MenCal[count]='0': $tabmc +='<td bgcolor="red"><<$mk_subst[$MenCal[count]]>></td>' else $tabmc +='<td><<$mk_subst[$MenCal[count]]>></td>'
  159. count +=1
  160. jump 'tabmcl4'
  161. end
  162. :tabmcl5
  163. if empty3 > 0: empty3 -=1 & $tabmc +='<td></td>' & jump 'tabmcl5'
  164. $tabmc += '</tr><table></font></center>'
  165. $tabmc
  166. act 'Back': gt 'restoreposition'
  167. end
  168. !! use gs 'shortgs','mk'
  169. if $ARGS[0] = 'mk':
  170. gs 'saveposition'
  171. *clr & cla
  172. copyarr '$MenCalCopy','$MenCal'
  173. length_of_month_field = arrsize('$MenCalCopy')
  174. if daystart - firstmens > 40:
  175. mensnotfound = 1
  176. i = 0
  177. :tabmcfm
  178. if $MenCalCopy[length_of_month_field-i] = '0' and $MenCalCopy[length_of_month_field-i-1] = '3': mensnotfound = 0
  179. i += 1
  180. if i < length_of_month_field and mensnotfound = 1: jump 'tabmcfm'
  181. if mensnotfound = 0:
  182. firstmens = daystart - i + 1
  183. end
  184. end
  185. i=1
  186. :tabmcc1
  187. if daystart - firstmens < 40:
  188. if (daystart - firstmens + i) = 28:
  189. $MenCalCopy[] = ' bgcolor="#df2020"'
  190. elseif (daystart - firstmens + i) = 29:
  191. $MenCalCopy[] = ' bgcolor="#df3030"'
  192. elseif (daystart - firstmens + i) = 30:
  193. $MenCalCopy[] = ' bgcolor="#df4040"'
  194. elseif (daystart - firstmens + i) = 12:
  195. $MenCalCopy[] = ' bgcolor="#d8ff00"'
  196. elseif (daystart - firstmens + i) = 13:
  197. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  198. elseif (daystart - firstmens + i) = 14:
  199. $MenCalCopy[] = ' bgcolor="#c8ff00"'
  200. elseif (daystart - firstmens + i) = 15:
  201. $MenCalCopy[] = ' bgcolor="#c0ff00"'
  202. elseif (daystart - firstmens + i) = 16:
  203. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  204. elseif (daystart - firstmens + i) = 12+28:
  205. $MenCalCopy[] = ' bgcolor="#d8ff00"'
  206. elseif (daystart - firstmens + i) = 13+28:
  207. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  208. elseif (daystart - firstmens + i) = 14+28:
  209. $MenCalCopy[] = ' bgcolor="#c8ff00"'
  210. elseif (daystart - firstmens + i) = 15+28:
  211. $MenCalCopy[] = ' bgcolor="#c0ff00"'
  212. elseif (daystart - firstmens + i) = 16+28:
  213. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  214. else
  215. $MenCalCopy[] = ''
  216. end
  217. i += 1
  218. if i < 40: jump 'tabmcc1'
  219. end
  220. i = length_of_month_field
  221. :tabmcc2
  222. if i > 0:
  223. if $MenCalCopy[i-1] = '2' and i = 1 : $MenCalCopy[i-1] = ' bgcolor="#c0ff00"'
  224. if $MenCalCopy[i-1] = '2' and $MenCalCopy[i-2] = '2': $MenCalCopy[i-1] = ' bgcolor="#c0ff00"'
  225. if $MenCalCopy[i-1] = '2' and $MenCalCopy[i-2] = '1': $MenCalCopy[i-1] = ' bgcolor="#80ff00"' & $MenCalCopy[i-2] = ' bgcolor="#90ff00"' & $MenCalCopy[i-3] = ' bgcolor="#a0ff00"' & $MenCalCopy[i-4] = ' bgcolor="#b0ff00"' & $MenCalCopy[i-5] = ' bgcolor="#c0ff00"'
  226. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) < 12: $MenCalCopy[i-1] =''
  227. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 12: $MenCalCopy[i-1] =' bgcolor="#b0ff00"'
  228. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 13: $MenCalCopy[i-1] =' bgcolor="#a0ff00"'
  229. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 14: $MenCalCopy[i-1] =' bgcolor="#90ff00"'
  230. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 15: $MenCalCopy[i-1] =' bgcolor="#80ff00"'
  231. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) > 15: $MenCalCopy[i-1] =''
  232. if $MenCalCopy[i-1] = '0': $MenCalCopy[i-1] =' bgcolor="#df2020"'
  233. if $MenCalCopy[i-1] = '3': $MenCalCopy[i-1] =''
  234. if $MenCalCopy[i-1] = '4': $MenCalCopy[i-1] =''
  235. if $MenCalCopy[i-1] = '5': $MenCalCopy[i-1] =''
  236. if $MenCalCopy[i-1] = '6': $MenCalCopy[i-1] =''
  237. i -= 1
  238. jump 'tabmcc2'
  239. end
  240. cur_day_doy = func('shortgs','doy',year,month,day)
  241. if month = 1:
  242. dif_days = cur_day_doy + 30
  243. prev_month = 12
  244. prev_month_length = 31
  245. else
  246. prev_month = month - 1
  247. dif_days = cur_day_doy - func('shortgs','doy',year,prev_month,1)
  248. prev_month_length = func('shortgs','doy',year,month,1) - func('shortgs','doy',year,prev_month,1)
  249. end
  250. first_month_first_day_week = week - (dif_days mod 7)
  251. first_month_first_day_index = length_of_month_field -1 - dif_days
  252. r = first_month_first_day_index
  253. if first_month_first_day_week < 1: first_month_first_day_week += 7
  254. i = 42
  255. :tabmc21
  256. $mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc21'
  257. i = 0
  258. :tabmc21a
  259. $mk1_mdays[i+first_month_first_day_week-1] = $str(i+1)
  260. i += 1
  261. if i < prev_month_length: jump 'tabmc21a'
  262. $prev_month_name = $mid($monthName[prev_month],1,1) + '<br>' + $mid($monthName[prev_month],2,1) + '<br>' + $mid($monthName[prev_month],3,1)
  263. k = 0
  264. $tabmc ='<center><font face="courier" size=5>'
  265. $tabmc +='<table border = 1 cellspacing="0" cellpadding="5">'
  266. $tabmc +='<tr><th>Month</th><th>Mon</th><th>Tue</th><th>Wen</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th></tr>'
  267. month_weeks = (first_month_first_day_week + prev_month_length + 5)/7 - 1
  268. i = month_weeks
  269. :tabmc22
  270. $tabmc +='<tr>'
  271. j = 7
  272. if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$prev_month_name>></td>'
  273. :tabmc23
  274. if j > 0:
  275. j -=1
  276. if $mk1_mdays[k]='&nbsp':
  277. $tabmc +='<td><<$mk1_mdays[k]>></td>'
  278. else
  279. $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
  280. r +=1
  281. end
  282. k +=1
  283. jump 'tabmc23' & !<<$MenCalCopy[r]>>
  284. end
  285. if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc22'
  286. killvar '$mk1_mdays'
  287. killvar '$mk1_mdays_color'
  288. !! current month
  289. if month = 12:
  290. dif_days = day - 1
  291. cur_month = month
  292. cur_month_length = 31
  293. else
  294. dif_days = day - 1
  295. cur_month_length = func('shortgs','doy',year,month+1,1) - func('shortgs','doy',year,month,1)
  296. end
  297. second_month_first_day_week = week - (dif_days mod 7)
  298. second_month_first_day_index = length_of_month_field -1 - dif_days
  299. if second_month_first_day_week < 1: second_month_first_day_week += 7
  300. i = 42
  301. :tabmc31
  302. $mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc31'
  303. i = 0
  304. :tabmc31a
  305. $mk1_mdays[i+second_month_first_day_week-1] = $str(i+1)
  306. i += 1
  307. if i < cur_month_length: jump 'tabmc31a'
  308. $cur_month_name = $mid($monthName[month],1,1) + '<br>' + $mid($monthName[month],2,1) + '<br>' + $mid($monthName[month],3,1)
  309. k = 0
  310. month_weeks = (second_month_first_day_week + cur_month_length + 5)/7 - 1
  311. i = month_weeks
  312. :tabmc32
  313. $tabmc +='<tr>'
  314. j = 7
  315. if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$cur_month_name>></td>'
  316. :tabmc33
  317. if j > 0:
  318. j -=1
  319. if $mk1_mdays[k]='&nbsp':
  320. $tabmc +='<td><<$mk1_mdays[k]>></td>'
  321. else
  322. if day + second_month_first_day_week - 2 = k: $tabmc +='<td<<$MenCalCopy[r]>> ><u><b><<$mk1_mdays[k]>></b></u></td>' else $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
  323. r +=1
  324. end
  325. k +=1
  326. jump 'tabmc33'
  327. end
  328. if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc32'
  329. killvar '$mk1_mdays'
  330. killvar '$mk1_mdays_color'
  331. !! next month
  332. if month = 12:
  333. dif_days = 31 - day + 1
  334. next_month = 1
  335. next_month_length = 31
  336. elseif month = 11:
  337. dif_days = 30 - day + 1
  338. next_month = 12
  339. next_month_length = 31
  340. else
  341. next_month = month + 1
  342. dif_days = cur_month_length - day + 1
  343. next_month_length = func('shortgs','doy',year,month+2,1) - func('shortgs','doy',year,month+1,1)
  344. end
  345. next_month_first_day_week = week + (dif_days mod 7)
  346. next_month_first_day_index = length_of_month_field -1 - dif_days
  347. if next_month_first_day_week < 1: next_month_first_day_week += 7
  348. i = 35
  349. :tabmc41
  350. $mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc41'
  351. i = 0
  352. :tabmc41a
  353. $mk1_mdays[i+next_month_first_day_week-1] = $str(i+1)
  354. !! if next_month_first_day_index + i >= 0: $mk1_mdays[i+next_month_first_day_week-1] += $mk_subst[$MenCal[second_month_first_day_index + i]]
  355. i += 1
  356. if i < next_month_length: jump 'tabmc41a'
  357. $next_month_name = $mid($monthName[next_month],1,1) + '<br>' + $mid($monthName[next_month],2,1) + '<br>' + $mid($monthName[next_month],3,1)
  358. k = 0
  359. month_weeks = (next_month_first_day_week + next_month_length + 5)/7 - 1
  360. i = month_weeks
  361. :tabmc42
  362. $tabmc +='<tr>'
  363. j = 7
  364. if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$next_month_name>></td>'
  365. :tabmc43
  366. if j > 0:
  367. j -=1
  368. if $mk1_mdays[k]='&nbsp':
  369. $tabmc +='<td><<$mk1_mdays[k]>></td>'
  370. else
  371. $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
  372. r +=1
  373. end
  374. k +=1
  375. jump 'tabmc43'
  376. end
  377. if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc42'
  378. killvar '$mk1_mdays'
  379. $tabmc += '</tr><table></font></center>'
  380. $tabmc
  381. act 'Back': gt 'restoreposition'
  382. end
  383. !! gs 'shortgs','fonts'
  384. if $ARGS[0] = 'fonts':
  385. if $ARGS[1] = 'refresh':
  386. jump 'fontsloop'
  387. else
  388. $dynamicreturn = $ARGS[1]
  389. $OpenPhraseSave = $ARGS[2]
  390. $ClosePhraseSave = $ARGS[3]
  391. end
  392. gs 'saveposition'
  393. $fontlist[] = 'Lucida' & $fontlist[] = 'Ariel' & $fontlist[] = 'Tahoma' & $fontlist[] = 'Verdana' & $fontlist[] = 'Courier New' & $fontlist[] = 'Courier' & $fontlist[] = 'Georgia' & $fontlist[] = 'Times New Roman' & $fontlist[] = 'Garamond' & $fontlist[] = 'Bookman' & $fontlist[] = 'Times New Roman' & $fontlist[] = 'Times' & $fontlist[] = 'Comic Sans MS' & $fontlist[] = 'Trebuchet MS' & $fontlist[] = 'Impact' & $fontlist[] = 'BankGothic'
  394. $fontcolor[] = 'aqua' & $fontcolor[] = 'black' & $fontcolor[] = 'blue' & $fontcolor[] = 'magenta' & $fontcolor[] = 'green' & $fontcolor[] = 'gray' & $fontcolor[] = 'lime' & $fontcolor[] = 'maroon' & $fontcolor[] = 'navy' & $fontcolor[] = 'olive' & $fontcolor[] = 'purple' & $fontcolor[] = 'red' & $fontcolor[] = 'silver' & $fontcolor[] = 'teal' & $fontcolor[] = 'white' & $fontcolor[] = 'yellow'
  395. i = 15
  396. :fontsloop0
  397. if $CurFont = $fontlist[i]: curfont = i
  398. if $CurColor = $fontcolor[i]: curcolor = i
  399. i -= 1
  400. if i > 0: jump 'fontsloop0'
  401. jump 'fontsloop1'
  402. :fontsloop
  403. $OpenPhrase = '<font size="<<CurFontSize>>" color="<<$CurColor>>" face="<<$CurFont>>" >'+$CurBold+$CurItalic
  404. $ClosePhrase = $CurItalicBack+$CurBoldBack+'</font>'
  405. :fontsloop1
  406. *clr & cla
  407. $OpenPhrase+'Current font is <<$CurFont>> Size <<CurFontSize>>, the color is <<$CurColor>>, the Bold is <<iif($CurBold = ''<b>'',''On'',''Off'')>> and Italic is <<iif($CurItalic = ''<i>'',''On'',''Off'')>>'+$ClosePhrase
  408. '<a href="exec: curfont = (curfont + 1) mod 16 & $CurFont = $fontlist[curfont] & gs ''shortgs'',''fonts'',''refresh'' ">Change the Font</a>'
  409. '<a href="exec: curcolor = (curcolor + 1) mod 16 & $CurColor = $fontcolor[curcolor] & gs ''shortgs'',''fonts'',''refresh'' ">Change the Color</a>'
  410. '<a href="exec:$CurBold = iif($CurBold ! ''<b>'',''<b>'','' '') & $CurBoldBack = iif($CurBold = ''<b>'',''</b>'','' '') & gs ''shortgs'',''fonts'',''refresh'' ">Change the BoldState</a>'
  411. '<a href="exec:$CurItalic = iif($CurItalic ! ''<i>'',''<i>'','' '') & $CurItalicBack = iif($CurItalic = ''<i>'',''</i>'','' '') & gs ''shortgs'',''fonts'',''refresh'' ">Change the ItalicState</a>'
  412. '<a href="exec:CurfontSize -= 1 & gs ''shortgs'',''fonts'',''refresh'' ">Decrease the Font</a>&nbsp&nbsp&nbsp<a href="exec:CurfontSize += 1 & gs ''shortgs'',''fonts'',''refresh'' ">Increase the font</a>'
  413. act 'Back':
  414. killvar '$fontlist'
  415. killvar '$fontcolor'
  416. dynamic '<<$OpenPhraseSave>> = $OpenPhrase'
  417. dynamic '<<$ClosePhraseSave>> = $ClosePhrase'
  418. if $dynamicreturn ! '': dynamic 'dynamic <<$dynamicreturn>>'
  419. gt 'restoreposition'
  420. end
  421. end
  422. !! use gs 'shortgs','ncp_update'
  423. if $ARGS[0] = 'ncp_update':
  424. copyarr 'copy_npc_QW','npc_QW'
  425. copyarr 'copy_npc_rel','npc_rel'
  426. copyarr 'copy_npc_love','npc_love'
  427. copyarr '$copy_npc_usedname','$npc_usedname'
  428. gs 'npcstatic1'
  429. gs 'npcstatic2'
  430. gs 'npcstatic3'
  431. gs 'npcstatic4'
  432. gs 'npcstatic5'
  433. gs 'npcstatic6'
  434. i = arrsize('copy_npc_QW')
  435. j = 1
  436. :loopnpcupdate
  437. $boy = 'A<<j>>'
  438. npc_QW[$boy] = copy_npc_QW[$boy]
  439. npc_rel[$boy] = copy_npc_rel[$boy]
  440. npc_love[$boy] = copy_npc_love[$boy]
  441. $npc_usedname[$boy] = $copy_npc_usedname[$boy]
  442. j += 1
  443. if j <= i: jump 'loopnpcupdate'
  444. killvar 'copy_npc_QW'
  445. killvar 'copy_npc_rel'
  446. killvar 'copy_npc_love'
  447. killvar '$copy_npc_usedname'
  448. end
  449. !! this function returns the numeric index of the array element which is indexed by string value.
  450. !! call func('shortgs', 'get_me_index', 'name of array','string index')
  451. !! the array can be both numeric or string: Be aware, for the search is used the value 'SearchTag' for string arrays and -2147483648 for numeric arrays.
  452. !! if the array consists such value, the fuction can mess the array content and return wrong value
  453. !! changed the value for detecting numeric element from -999 to -2147483648 (November 2020)
  454. if $ARGS[0] = 'get_me_index':
  455. $test = '<<$ARGS[1]>>[''<<$ARGS[2]>>'']'
  456. testas0 = arrsize('<<$ARGS[1]>>')
  457. if $mid($test,1,1)='$':
  458. $temp=dyneval('$result=<<$test>>')
  459. dynamic '<<$test>> = ''SearchTag'' '
  460. testas1 = arrsize('<<$ARGS[1]>>')
  461. if testas0 = testas1:
  462. res = dyneval('result = arrpos(''<<$ARGS[1]>>'',''SearchTag'')')
  463. dynamic '<<$test>> = $temp'
  464. else
  465. res = -1
  466. killvar '<<$ARGS[1]>>',testas0
  467. end
  468. else
  469. temp=dyneval('result=<<$test>>')
  470. dynamic '<<$test>> = -2147483648'
  471. testas1 = arrsize('<<$ARGS[1]>>')
  472. if testas0 = testas1:
  473. res = dyneval('result = arrpos(''<<$ARGS[1]>>'',-2147483648)')
  474. dynamic '<<$test>> = <<temp>>'
  475. else
  476. res = -1
  477. killvar '<<$ARGS[1]>>',testas0
  478. end
  479. end
  480. result = res
  481. end
  482. !! call gs 'shortgs', 'remove_array_element', 'name of array','string index'
  483. if $ARGS[0] = 'remove_array_element':
  484. killvar '<<$ARGS[1]>>',func('shortgs', 'get_me_index', $ARGS[1],$ARGS[2])
  485. end
  486. if $ARGS[0] = 'testsize':
  487. '$npc_dna = ' + arrsize('$npc_dna')
  488. '$npc_firstname = ' + arrsize('$npc_firstname')
  489. '$npc_lastname = ' + arrsize('$npc_lastname')
  490. '$npc_nickname = ' + arrsize('$npc_nickname')
  491. '$npc_notes = ' + arrsize('$npc_notes')
  492. '$npc_occupation = ' + arrsize('$npc_occupation')
  493. '$npc_perstype = ' + arrsize('$npc_perstype')
  494. '$npc_pic = ' + arrsize('$npc_pic')
  495. '$npc_thdick = ' + arrsize('$npc_thdick')
  496. '$npc_usedname = ' + arrsize('$npc_usedname')
  497. 'npc_apprnc = ' + arrsize('npc_apprnc')
  498. 'npc_bust = ' + arrsize('npc_bust')
  499. 'npc_outfit = ' + arrsize('npc_outfit')
  500. 'npc_style = ' + arrsize('npc_style')
  501. 'npc_dick = ' + arrsize('npc_dick')
  502. 'npc_dob = ' + arrsize('npc_dob')
  503. 'npc_drunk = ' + arrsize('npc_drunk')
  504. 'npc_gender = ' + arrsize('npc_gender')
  505. 'npc_haircol = ' + arrsize('npc_haircol')
  506. 'npc_height = ' + arrsize('npc_height')
  507. 'npc_horny = ' + arrsize('npc_horny')
  508. 'npc_intel = ' + arrsize('npc_intel')
  509. 'npc_love = ' + arrsize('npc_love')
  510. 'npc_QW = ' + arrsize('npc_QW')
  511. 'npc_rel = ' + arrsize('npc_rel')
  512. 'npc_sex = ' + arrsize('npc_sex')
  513. 'npc_sexskill = ' + arrsize('npc_sexskill')
  514. 'npc_spermpot = ' + arrsize('npc_spermpot')
  515. 'npc_herpes = ' + arrsize('npc_herpes')
  516. 'npc_syth = ' + arrsize('npc_syth')
  517. 'npc_gon = ' + arrsize('npc_gon')
  518. 'npc_thrush = ' + arrsize('npc_thrush')
  519. 'npc_apt_type = ' + arrsize('npc_apt_type')
  520. 'npc_apt_number = ' + arrsize('npc_apt_number')
  521. '$npc_apt_bedroom = ' + arrsize('$npc_apt_bedroom')
  522. '$npc_apt_kitchen = ' + arrsize('$npc_apt_kitchen')
  523. '$npc_apt_livingroom = ' + arrsize('$npc_apt_livingroom')
  524. '$npc_apt_bathroom = ' + arrsize('$npc_apt_bathroom')
  525. 'npc_perv = ' + arrsize('npc_perv')
  526. 'npc_finance = ' + arrsize('npc_finance')
  527. 'npc_humor = ' + arrsize('npc_humor')
  528. 'npc_fav_pos = ' + arrsize('npc_fav_pos')
  529. 'npc_tit_pref = ' + arrsize('npc_tit_pref')
  530. 'npc_addit = ' + arrsize('npc_addit')
  531. 'npc_doors = ' + arrsize('npc_doors')
  532. 'npc_goal = ' + arrsize('npc_goal')
  533. 'npc_fidelity = ' + arrsize('npc_fidelity')
  534. 'npc_lover_days = ' + arrsize('npc_lover_days')
  535. 'npc_lover_keys = ' + arrsize('npc_lover_keys')
  536. '$npc_index = ' + arrsize('$npc_index')
  537. end
  538. if $ARGS[0] = 'npctest':
  539. ' --- init --- '
  540. gs 'shortgs', 'testsize'
  541. gs 'npcgeneratec', 0, 'stranger', rand(18,45),1
  542. $npc_notes[$npclastgenerated]
  543. $npclastgenerated
  544. ' --- gen npc C --- '
  545. gs 'shortgs', 'testsize'
  546. gs 'npcpreservec', $npclastgenerated
  547. $npc_notes[$npclastsaved]
  548. $npclastsaved
  549. ' --- sav npc C to npc B --- '
  550. gs 'shortgs', 'testsize'
  551. gs 'npccleanc',$npclastsaved
  552. ' --- delete npc B --- '
  553. gs 'shortgs', 'testsize'
  554. end
  555. if $ARGS[0] = 'replace header':
  556. wait(ARGS[1])
  557. RH_Count = ARGS[2]
  558. $RH_temp = $MAINTXT
  559. :RH_label
  560. RH_temp_lenght = LEN($RH_temp)
  561. RH_temp_LFpos = STRPOS($RH_temp,'\n')
  562. $RH_temp = $MID($RH_temp, RH_temp_LFpos+1, RH_temp_lenght - RH_temp_LFpos)
  563. RH_Count -=1
  564. if RH_Count > 0: jump 'RH_label'
  565. *clr
  566. $ARGS[3] & $ARGS[4] & $ARGS[5] & $ARGS[6] & $ARGS[7]
  567. $RH_temp
  568. killvar '$RH_temp'
  569. killvar 'RH_Count'
  570. killvar 'RH_temp_lenght'
  571. killvar 'RH_temp_LFpos'
  572. end
  573. if $ARGS[0]='img msg':
  574. $shortgstemp = '<center><img height=280 src="<<$ARGS[1]>>"></center>'
  575. msg $shortgstemp
  576. killvar '$shortgstemp'
  577. end
  578. !! Used for dividing with accurate rounding up/down
  579. if $ARGS[0] = 'round_divide':
  580. !! ARGS[1] = value you want divided
  581. !! ARGS[2] = divider
  582. !! func('shortgs','round_divide', number, divider)
  583. !! func('shortgs','round_divide', 12345, 7)
  584. if ARGS[2] ! 0:
  585. temp_number = ARGS[1]/ARGS[2]
  586. if (ARGS[2] mod 2 ! 0 and ARGS[1] mod ARGS[2] > ARGS[2]/2) or (ARGS[2] mod 2 = 0 and ARGS[1] mod ARGS[2] >= ARGS[2]/2): temp_number += 1
  587. result = temp_number
  588. killvar 'temp_number'
  589. else
  590. msg '<b>Error: No dividing by 0! You trying to make the universe disappear?</b>'
  591. end
  592. end
  593. !! Used for rounding numbers to the nearest multiple of ARGS[2]
  594. if $ARGS[0] = 'round_tool':
  595. !! ARGS[1] = value you want rounded
  596. !! ARGS[2] = nearest multiple to round to
  597. !! func('shortgs','round_tool', number, multiple)
  598. !! func('shortgs','round_tool', 12345, 10)
  599. if ARGS[2] ! 0:
  600. temp_multiple = ARGS[2]
  601. result = func('shortgs','round_divide', ARGS[1], ARGS[2]) * temp_multiple
  602. killvar 'temp_multiple'
  603. else
  604. msg '<b>Error: Can''t round to 0!</b>'
  605. end
  606. end
  607. !! Randomly picks one of the items plugged in
  608. !!
  609. !! Option 1: (has 6 input limit)
  610. !! $ARGS[1] = 'string' or 'number' to specify what youre plugging in (can also be blank for numbers)
  611. !! $ARGS[2-7] = strings or numbers to pick from, limited to 6
  612. !! Example 1: func('shortgs', 'rand_pick', 'string', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta')
  613. !! Example 2: func('shortgs', 'rand_pick', '', 2, 3, 5, 7, 11, 13)
  614. !!
  615. !! Option 2: (no limitations, has to be delimited)
  616. !! $ARGS[1] = 'delimit' - used for larger numbers of items to pick from
  617. !! $ARGS[2] = 'string' or 'number' to specify what youre plugging in (can also be blank for numbers)
  618. !! $ARGS[3] = Delimited string to parse
  619. !! $ARGS[4] = Delimiter used (Default = '|' pipe)
  620. !! Example 1: func('shortgs', 'rand_pick', 'delimit', 'string', 'alpha|beta|gamma|delta|epsilon|zeta')
  621. !! Example 2: func('shortgs', 'rand_pick', 'delimit', 'number', '1-12-123-1234-12345-123456', '-')
  622. !! Example 3: func('shortgs', 'rand_pick', 'delimit', '', '0.1.2.3.5.7.11', '.')
  623. if $ARGS[0] = 'rand_pick':
  624. if $ARGS[1] = 'delimit':
  625. if $ARGS[2] = 'string':
  626. gs 'shortgs', 'parse_string', '$rand_pick_temp', $ARGS[3], $ARGS[4]
  627. $result = $rand_pick_temp[rand(0, arrsize('$rand_pick_temp')-1)]
  628. killvar '$rand_pick_temp'
  629. else
  630. gs 'shortgs', 'parse_string', 'rand_pick_temp', $ARGS[3], $ARGS[4]
  631. result = rand_pick_temp[rand(0, arrsize('rand_pick_temp')-1)]
  632. killvar 'rand_pick_temp'
  633. end
  634. else
  635. if arrsize('ARGS') > 2:
  636. if $ARGS[1] = 'string':
  637. $result = $ARGS[rand(2, arrsize('$ARGS')-1)]
  638. else
  639. result = ARGS[rand(2, arrsize('ARGS')-1)]
  640. end
  641. else
  642. msg '<b>Error: ''rand_pick'' is missing ARGS</b>'
  643. end
  644. end
  645. end
  646. !! Parse delimited string into an array
  647. !! $ARGS[1] = ArrayName (has to include $ for string values)
  648. !! $ARGS[2] = Delimited string to parse
  649. !! $ARGS[3] = Delimiter used (Default = '|' pipe)
  650. !! Example 1: gs 'shortgs', 'parse_string', '$my_array', 'alpha|beta|gamma|delta|epsilon|zeta'
  651. !! Example 2: gs 'shortgs', 'parse_string', 'my_array', '1-12-123-1234-12345-123456', '-'
  652. if $ARGS[0] = 'parse_string':
  653. !! Some failsafes (blank array name, blank string or no delimiters in string)
  654. if $ARGS[1] ! '':
  655. if $ARGS[2] ! '' and instr($ARGS[2],iif($ARGS[3] = '', '|', $ARGS[3])) > 0:
  656. !! Set delimiter with default if needed
  657. if $ARGS[3] = '':
  658. $ParserTmpDelim = '|'
  659. else
  660. $ParserTmpDelim = $ARGS[3]
  661. end
  662. !! Clear temp array if needed
  663. killvar 'ParserTmpArr' & killvar '$ParserTmpArr'
  664. $ParserTmpStr = $ARGS[2]
  665. !! Loop through string until no more delimiters found
  666. :StringParser01
  667. ParserTmpIdx = instr($ParserTmpStr, $ParserTmpDelim)
  668. if ParserTmpIdx > 0:
  669. if mid($ARGS[1],1,1) = '$':
  670. $ParserTmpArr[] = mid($ParserTmpStr, 1, ParserTmpIdx-1)
  671. $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)
  672. else
  673. ParserTmpArr[] = mid($ParserTmpStr, 1, ParserTmpIdx-1)
  674. $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)
  675. end
  676. jump 'StringParser01'
  677. !! Get last part since no more delimiters were found and copy to the final array
  678. elseif mid($ARGS[1],1,1) = '$':
  679. $ParserTmpArr[] = $ParserTmpStr
  680. copyarr $ARGS[1], '$ParserTmpArr'
  681. else
  682. ParserTmpArr[] = $ParserTmpStr
  683. copyarr $ARGS[1], 'ParserTmpArr'
  684. end
  685. killvar '$ParserTmpDelim'
  686. killvar '$ParserTmpStr'
  687. killvar 'ParserTmpIdx'
  688. killvar 'ParserTmpArr' & killvar '$ParserTmpArr'
  689. else
  690. msg '<b>Error: No delimited string found!</b>'
  691. end
  692. else
  693. msg '<b>Error: No array name found!</b>'
  694. end
  695. end
  696. if $ARGS[0] = 'clothing_state':
  697. if PCloswimwear = 1:
  698. 'You are wearing swimwear.'
  699. elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich':
  700. 'You are wearing gym clothing and shoes.'
  701. elseif $clothingworntype = 'nude' and $braworntype = 'none' and $pantyworntype = 'none':
  702. 'You are naked.'
  703. elseif $clothingworntype = 'nude' and $braworntype = 'none':
  704. 'You are just wearing panties.'
  705. elseif $clothingworntype = 'nude' and $pantyworntype = 'none':
  706. 'You are just wearing a bra.'
  707. elseif $clothingworntype = 'nude':
  708. 'You are in your underwear.'
  709. elseif $braworntype = 'none' and $pantyworntype = 'none' and PCloPanties = 0 and PCloBra = 0:
  710. 'You are not wearing any underwear.'
  711. elseif $pantyworntype = 'none' and PCloPanties = 0:
  712. 'You are not wearing panties'
  713. elseif PCloBra = 0:
  714. 'You are not wearing a bra'
  715. end
  716. end
  717. !! Author - Hooded Silence
  718. !! Date created - 26 Aug 22
  719. !! Payment system - Used to pay for items in various game locations
  720. !! v. 02 - Refactoring to make usage simpler using the epayments array
  721. !! command syntax: gs 'shortgs','payments'
  722. !! All variabls are initiated at point of origin
  723. !!
  724. !! epayments[value] = cost of goods. Required
  725. !! $epayments[method] = how it''s to be paid cash or card. leave blank for both. Optional
  726. !! $epayments[description] = Item Description - What's been bought. Required
  727. !! $epayments[item_variable] = item variable to be purchased to be added to players inventory. Optional.
  728. !! epayments[quantity] = How many items to be added. Defaults to one - Optional.
  729. !! $epayments[loc] = Where do you want the character to go to, optional falls back to starting location if set. Optional
  730. !! $epayments[act] = If there's a specific act to return to. Optional
  731. !! $epayments[banner] = banner image for the sale. Optional
  732. !! Optional with no content are ignored.
  733. !! Use stock image for the purchase screen?
  734. if $ARGS[0] = 'payments':
  735. *clr & cla
  736. if epayments['value'] = 0:
  737. msg '<b>Error, Cash Value not set.</b>'
  738. end
  739. if $epayments['description'] = '':
  740. msg '<b>Error, Item Description not set.</b>'
  741. end
  742. !! Construct payment call
  743. if $epayments['item_variable'] ! '':
  744. $construct_cash = '<a href="exec: money -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
  745. $construct_card = '<a href="exec: karta -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
  746. else
  747. $construct_cash = '<a href="exec: $epayments[''method''] = ''cash'' & money -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
  748. $construct_card = '<a href="exec: $epayments[''method''] = ''card'' & karta -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
  749. end
  750. !Use stock image for the purchase screen?
  751. if $epayments['banner'] ! '':
  752. '<center><img <<$set_imgh>> src="images/' + $epayments['banner'] + '"></center>'
  753. end
  754. if ($epayments['method'] ! 'cash' and $epayments['method'] ! 'card') and (epayments['value'] <= money and epayments['value'] <= karta + bankDebtLimit):
  755. 'How do you want to pay for the <<$epayments[''description'']>>? <<$construct_cash>> or <<$construct_card>>'
  756. elseif ($epayments['method'] = 'cash' or $epayments['method'] = '') and epayments['value'] <= money:
  757. 'Pay for the <<$epayments[''description'']>> with <<$construct_cash>>?'
  758. elseif ($epayments['method'] = 'card' or $epayments['method'] = '') and epayments['value'] <= karta + bankDebtLimit:
  759. 'Pay for the <<$epayments[''description'']>> with your <<$construct_card>>?'
  760. else
  761. 'You don''t have enough money in your purse or bank account for this item.'
  762. end
  763. act 'Cancel Payment': gt $loc, $loc_arg
  764. end
  765. !! Payment complete
  766. if $ARGS[0] = 'paymentcomplete':
  767. *clr & cla
  768. 'Thank you for your custom. Please come again!'
  769. *nl
  770. 'You paid ' + epayments['value'] + '<b>₽</b>' + iif ($epayments['method'] = 'cash',' in cash', ' with your bank card') + ' for your ' + $epayments['description']
  771. gs 'stat'
  772. !! clean up all the variables
  773. killvar 'construct_cash'
  774. killvar 'construct_card'
  775. if $epayments['loc'] ! '':
  776. act 'Finish payment': gt $epayments['loc'], $epayments['loc_arg']
  777. else
  778. act 'Finish Payment': gt $loc, $loc_arg
  779. end
  780. end
  781. if $ARGS[0] = 'calendar_display':
  782. '<b><<$month>> <<day>></b>'
  783. '<b><<$week>></b>'
  784. if minut = 0:
  785. '<b><<hour>>:00</b>'
  786. elseif minut < 10:
  787. '<b><<hour>>:0<<minut>></b>'
  788. else
  789. '<b><<hour>>:<<minut>></b>'
  790. end
  791. end
  792. if $ARGS[0] = 'day_display':
  793. '<b><<$week>></b>'
  794. if minut = 0:
  795. '<b><<hour>>:00</b>'
  796. elseif minut < 10:
  797. '<b><<hour>>:0<<minut>></b>'
  798. else
  799. '<b><<hour>>:<<minut>></b>'
  800. end
  801. end
  802. if $ARGS[0] = 'time_display':
  803. if minut = 0:
  804. '<b><<hour>>:00</b>'
  805. elseif minut < 10:
  806. '<b><<hour>>:0<<minut>></b>'
  807. else
  808. '<b><<hour>>:<<minut>></b>'
  809. end
  810. end
  811. if $ARGS[0] = 'setloc':
  812. !! Sets the location variables based on $ARGS[1] = loc, $ARGS[2] = loc arg
  813. !! Primary key
  814. $loc = $ARGS[1]
  815. $menu_loc = $ARGS[1]
  816. $locM = $ARGS[1]
  817. !! Secondary key
  818. $loc_arg = $ARGS[2]
  819. $menu_arg = $ARGS[2]
  820. $locM_arg = $ARGS[2]
  821. !! create loop from location array to determine region
  822. !!TBC
  823. end
  824. !! generates n rand numbers and selects min or max (max for lucky or min for unlucky)
  825. !! use: func('shortgs' 'roll', 'lucky' x, y, n)
  826. !! where x and y set range and n sets amount of rolls
  827. !! example: func('shortgs' 'roll', 'lucky' 0, 5)
  828. !! example: func('shortgs' 'roll', 'unlucky' 0, 100, 5)
  829. if $ARGS[0] = 'roll':
  830. temp_roll = rand(ARGS[2], ARGS[3])
  831. shortgs_i = 1
  832. :roll
  833. temp_rand = rand(ARGS[2], ARGS[3])
  834. if $ARGS[1] = 'lucky' and temp_rand > temp_roll:
  835. temp_roll = temp_rand
  836. elseif $ARGS[1] = 'unlucky' and temp_rand < temp_roll:
  837. temp_roll = temp_rand
  838. end
  839. shortgs_i += 1
  840. if shortgs_i < ARGS[4]: jump 'roll'
  841. result = temp_roll
  842. killvar 'temp_roll'
  843. killvar 'temp_rand'
  844. end
  845. !! limits a number to a range
  846. !! use: func('shortgs', 'clamp', var, min, max)
  847. !! returns min if var < min, returns max if var > max
  848. !! otherwise returns var
  849. !! example: func('shortgs', 'clamp', var, 0, 100)
  850. if $ARGS[0] = 'clamp':
  851. result = min(max(ARGS[1], ARGS[2]), ARGS[3])
  852. end
  853. !! sets a stat or attribute level to a number
  854. !! use: gs 'shortgs', 'setStat', 'stat', number
  855. !! example: gs 'shortgs', 'setStat', 'stren', 70
  856. !! example: gs 'shortgs', 'setStat', 'inhib', 10
  857. if $ARGS[0] = 'setStat':
  858. temp_input = func('shortgs', 'clamp', ARGS[2], 0, 100)
  859. if temp_input > 1:
  860. temp_xpnxt = (func('_difficulty','getexpadj') * (temp_input - 1) * (temp_input - 1) / 180) + 1
  861. end
  862. !! magik is based on `orgasm` variable thus the need for `_adj`
  863. if $ARGS[1] = 'magik':
  864. dynamic "<<$ARGS[1]>>_lvl = temp_input
  865. <<$ARGS[1]>>_adj = temp_xpnxt - orgasm
  866. <<$ARGS[1]>>_exp = orgasm + <<$ARGS[1]>>_adj
  867. <<$ARGS[1]>>_mem = <<$ARGS[1]>>_exp
  868. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  869. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
  870. !! inhib needs its `_flr` set at `_lvl` and not `_lvl / 5`
  871. elseif $ARGS[1] = 'inhib':
  872. dynamic "<<$ARGS[1]>>_lvl = temp_input
  873. <<$ARGS[1]>>_exp = temp_xpnxt
  874. <<$ARGS[1]>>_mem = temp_xpnxt
  875. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  876. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl"
  877. !! `stren` and `stren_plus` changes should also update strenbuf
  878. elseif $ARGS[1] = 'stren' or $ARGS[1] = 'stren_plus':
  879. dynamic "<<$ARGS[1]>>_lvl = temp_input
  880. <<$ARGS[1]>>_exp = temp_xpnxt
  881. <<$ARGS[1]>>_mem = temp_xpnxt
  882. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  883. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl"
  884. strenbuf = stren_lvl + stren_plus_lvl
  885. gs 'body', 'UpdateBodyImage'
  886. else
  887. dynamic "<<$ARGS[1]>>_lvl = temp_input
  888. <<$ARGS[1]>>_exp = temp_xpnxt
  889. <<$ARGS[1]>>_mem = temp_xpnxt
  890. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  891. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
  892. end
  893. killvar 'temp_input' & killvar 'temp_xpnxt'
  894. end
  895. !! Recursively computes a simple exponent - https://en.wikipedia.org/wiki/Exponentiation_by_squaring
  896. !! use: func('shortgs', 's_pow', var, exp)
  897. !! returns var ^ exp
  898. !! exp must be an integer >= 0
  899. !! example: func('shortgs', 's_pow', 2, 3)
  900. if $ARGS[0] = 's_pow':
  901. if(ARGS[2] > 10) : msg('Warning: s_pow operations with large exponents may cause integer overflows. <<ARGS[1]>> ^ <<ARGS[2]>>')
  902. if(ARGS[2]) < 0:
  903. !! n ^(-m) = 0
  904. msg('Error: s_pow cannot accept negative exponents! <<ARGS[1]>> ^ <<ARGS[2]>>')
  905. elseif ARGS[2] = 0:
  906. result = 1
  907. elseif ARGS[2] = 1:
  908. result = ARGS[1]
  909. elseif (ARGS[2] mod 2) = 0:
  910. result = func('shortgs', 's_pow', ARGS[1] * ARGS[1], ARGS[2] / 2)
  911. elseif (ARGS[2] mod 2) ! 0:
  912. result = ARGS[1] * func('shortgs', 's_pow', ARGS[1] * ARGS[1], (ARGS[2] - 1) / 2)
  913. end
  914. end
  915. !! Improved exponent calculation based on - https://en.wikipedia.org/wiki/Exponentiation_by_squaring
  916. !! use: func('shortgs', 's_pow2', var, exp)
  917. !! returns var ^exp
  918. !! if exp < 0, returns 0
  919. !! example: func('shortgs', 's_pow2', 2, 3) -> 8
  920. if $ARGS[0] = 's_pow2':
  921. if ARGS[2] = 0:
  922. result = 1
  923. elseif ARGS[2] < 0:
  924. result = 0
  925. elseif ARGS[2] = 1:
  926. result = ARGS[1]
  927. elseif ARGS[2] = 2:
  928. result = ARGS[1] * ARGS[1]
  929. elseif ARGS[2] = 3:
  930. result = ARGS[1] * ARGS[1] * ARGS[1]
  931. elseif (ARGS[2] mod 2) = 0:
  932. result = func('shortgs', 's_pow2', ARGS[1] * ARGS[1], ARGS[2] / 2)
  933. else
  934. result = ARGS[1] * func('shortgs', 's_pow2', ARGS[1] * ARGS[1], ARGS[2] / 4)
  935. end
  936. end
  937. !! Takes multiple arrays and sorts them based on the first one.
  938. !! Sorts the key_array (which must only have value entries) in ascending order.
  939. !! gs 'shortgs', 'coupled_array_sort'. 'key_array', 'array1', 'array2', 'array3', ...
  940. !!
  941. !! String arrays must start with a $ otherwise the numeric values will be copied instead.
  942. !!
  943. !! examples:
  944. !! example 1: we want to sort a single array with values called values_array
  945. !! gs 'shortgs', 'coupled_array_sort', 'values_array'
  946. !! example 2: we have an array filled with days (called trigger_days), and a coupled array filled with npc_codes (called $trigger_npc_codes)
  947. !! gs 'shortgs', 'coupled_array_sort', 'trigger_days', '$trigger_npc_codes'
  948. if $ARGS[0] = 'coupled_array_sort':
  949. :shortgs_coupled_array_sort_loop_start
  950. if arrsize($ARGS[1]) > 0:
  951. shortgs_temp_pos = arrpos($ARGS[1], min($ARGS[1]))
  952. shortgs_args_index = 1
  953. :shortgs_casl_inner_start
  954. if $ARGS[shortgs_args_index] ! '':
  955. if arrsize($ARGS[shortgs_args_index]) > 0:
  956. if mid($ARGS[shortgs_args_index], 1, 1) = '$':
  957. dynamic '$shortgs_temp_array<<shortgs_args_index>>[] = <<$ARGS[shortgs_args_index]>>[shortgs_temp_pos]'
  958. else
  959. dynamic 'shortgs_temp_array<<shortgs_args_index>>[] = <<$ARGS[shortgs_args_index]>>[shortgs_temp_pos]'
  960. end
  961. killvar $ARGS[shortgs_args_index], shortgs_temp_pos
  962. shortgs_args_index += 1
  963. jump 'shortgs_casl_inner_start'
  964. end
  965. end
  966. jump 'shortgs_coupled_array_sort_loop_start'
  967. end
  968. shortgs_max_args_index = shortgs_args_index
  969. shortgs_args_index = 1
  970. :shortgs_casl_outer_start
  971. if shortgs_args_index < shortgs_max_args_index:
  972. dynamic 'copyarr(''<<$ARGS[shortgs_args_index]>>'', ''shortgs_temp_array<<shortgs_args_index>>'')'
  973. dynamic 'killvar ''shortgs_temp_array<<shortgs_args_index>>'' '
  974. shortgs_args_index += 1
  975. jump 'shortgs_casl_outer_start'
  976. end
  977. killvar 'shortgs_casl_inner_start'
  978. killvar 'shortgs_args_index'
  979. killvar 'shortgs_coupled_array_sort_loop_start'
  980. killvar 'shortgs_casl_outer_start'
  981. killvar 'shortgs_max_args_index'
  982. killvar 'shortgs_temp_pos'
  983. end
  984. --- shortgs ---------------------------------