shortgs.qsrc 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  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_<<$week[week]>>.sav'
  7. elseif mid($start_type, 1, 3) = 'uni':
  8. savegame 'autosave_uni_<<$week[week]>>.sav'
  9. else
  10. savegame 'autosave_sg_<<$week[week]>>.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. !! https://astronomy.stackexchange.com/questions/2407/calculate-day-of-the-year-for-a-given-date
  121. if $ARGS[0] = 'doy':
  122. doy_N1 = 275 * ARGS[2] / 9
  123. doy_N2 = (ARGS[2] + 9) / 12
  124. doy_N3 = 1 + (ARGS[1] - 4 * (ARGS[1] / 4) + 2) / 3
  125. result = doy_N1 - (doy_N2 * doy_N3) + ARGS[3] - 30
  126. end
  127. if $ARGS[0] = 'mk1':
  128. gs 'saveposition'
  129. *clr & cla
  130. $mk_subst['0'] = 'M' & $mk_subst['1'] = 'F' & $mk_subst['2'] = 'O' & $mk_subst['3'] = 'L' & $mk_subst['4'] = 'R' & $mk_subst['5'] = 'P'
  131. '<center><font face="courier" size=1>'
  132. '<table border = 1>'
  133. '<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>
  134. <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>'
  135. i = ArrSize('$MenCal')
  136. empty0 = week + 29 - i - 1
  137. empty1 = min(28,empty0)
  138. full1 = max(0,28 - empty0)
  139. empty2 = max(0,empty0-28)
  140. full2 = i - full1
  141. empty3 = 28 - empty2 - full2
  142. count=0
  143. $tabmc = '<tr>'
  144. :tabmcl1
  145. if empty1 > 0: empty1 -=1 & $tabmc +='<td>&nbsp</td>' & jump 'tabmcl1'
  146. :tabmcl2
  147. if full1 > 0:
  148. full1 -=1
  149. if $MenCal[count]='0': $tabmc +='<td bgcolor="red"><<$mk_subst[$MenCal[count]]>></td>' else $tabmc +='<td><<$mk_subst[$MenCal[count]]>></td>'
  150. count +=1
  151. jump 'tabmcl1'
  152. end
  153. $tabmc += '</tr><tr>'
  154. :tabmcl3
  155. if empty2 > 0: empty2 -=1 & $tabmc +='<td>&nbsp</td>' & jump 'tabmcl3'
  156. :tabmcl4
  157. if full2 > 0:
  158. full2 -=1
  159. if $MenCal[count]='0': $tabmc +='<td bgcolor="red"><<$mk_subst[$MenCal[count]]>></td>' else $tabmc +='<td><<$mk_subst[$MenCal[count]]>></td>'
  160. count +=1
  161. jump 'tabmcl4'
  162. end
  163. :tabmcl5
  164. if empty3 > 0: empty3 -=1 & $tabmc +='<td></td>' & jump 'tabmcl5'
  165. $tabmc += '</tr><table></font></center>'
  166. $tabmc
  167. act 'Back': gt 'restoreposition'
  168. end
  169. !! use gs 'shortgs','mk'
  170. if $ARGS[0] = 'mk':
  171. gs 'saveposition'
  172. *clr & cla
  173. copyarr '$MenCalCopy','$MenCal'
  174. length_of_month_field = arrsize('$MenCalCopy')
  175. if daystart - firstmens > 40:
  176. mensnotfound = 1
  177. i = 0
  178. :tabmcfm
  179. if $MenCalCopy[length_of_month_field-i] = '0' and $MenCalCopy[length_of_month_field-i-1] = '3': mensnotfound = 0
  180. i += 1
  181. if i < length_of_month_field and mensnotfound = 1: jump 'tabmcfm'
  182. if mensnotfound = 0:
  183. firstmens = daystart - i + 1
  184. end
  185. end
  186. i=1
  187. :tabmcc1
  188. if daystart - firstmens < 40:
  189. if (daystart - firstmens + i) = 28:
  190. $MenCalCopy[] = ' bgcolor="#df2020"'
  191. elseif (daystart - firstmens + i) = 29:
  192. $MenCalCopy[] = ' bgcolor="#df3030"'
  193. elseif (daystart - firstmens + i) = 30:
  194. $MenCalCopy[] = ' bgcolor="#df4040"'
  195. elseif (daystart - firstmens + i) = 12:
  196. $MenCalCopy[] = ' bgcolor="#d8ff00"'
  197. elseif (daystart - firstmens + i) = 13:
  198. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  199. elseif (daystart - firstmens + i) = 14:
  200. $MenCalCopy[] = ' bgcolor="#c8ff00"'
  201. elseif (daystart - firstmens + i) = 15:
  202. $MenCalCopy[] = ' bgcolor="#c0ff00"'
  203. elseif (daystart - firstmens + i) = 16:
  204. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  205. elseif (daystart - firstmens + i) = 12+28:
  206. $MenCalCopy[] = ' bgcolor="#d8ff00"'
  207. elseif (daystart - firstmens + i) = 13+28:
  208. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  209. elseif (daystart - firstmens + i) = 14+28:
  210. $MenCalCopy[] = ' bgcolor="#c8ff00"'
  211. elseif (daystart - firstmens + i) = 15+28:
  212. $MenCalCopy[] = ' bgcolor="#c0ff00"'
  213. elseif (daystart - firstmens + i) = 16+28:
  214. $MenCalCopy[] = ' bgcolor="#d0ff00"'
  215. else
  216. $MenCalCopy[] = ''
  217. end
  218. i += 1
  219. if i < 40: jump 'tabmcc1'
  220. end
  221. i = length_of_month_field
  222. :tabmcc2
  223. if i > 0:
  224. if $MenCalCopy[i-1] = '2' and i = 1 : $MenCalCopy[i-1] = ' bgcolor="#c0ff00"'
  225. if $MenCalCopy[i-1] = '2' and $MenCalCopy[i-2] = '2': $MenCalCopy[i-1] = ' bgcolor="#c0ff00"'
  226. 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"'
  227. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) < 12: $MenCalCopy[i-1] =''
  228. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 12: $MenCalCopy[i-1] =' bgcolor="#b0ff00"'
  229. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 13: $MenCalCopy[i-1] =' bgcolor="#a0ff00"'
  230. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 14: $MenCalCopy[i-1] =' bgcolor="#90ff00"'
  231. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 15: $MenCalCopy[i-1] =' bgcolor="#80ff00"'
  232. if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) > 15: $MenCalCopy[i-1] =''
  233. if $MenCalCopy[i-1] = '0': $MenCalCopy[i-1] =' bgcolor="#df2020"'
  234. if $MenCalCopy[i-1] = '3': $MenCalCopy[i-1] =''
  235. if $MenCalCopy[i-1] = '4': $MenCalCopy[i-1] =''
  236. if $MenCalCopy[i-1] = '5': $MenCalCopy[i-1] =''
  237. if $MenCalCopy[i-1] = '6': $MenCalCopy[i-1] =''
  238. i -= 1
  239. jump 'tabmcc2'
  240. end
  241. cur_day_doy = func('shortgs','doy',year,month,day)
  242. if month = 1:
  243. dif_days = cur_day_doy + 30
  244. prev_month = 12
  245. prev_month_length = 31
  246. else
  247. prev_month = month - 1
  248. dif_days = cur_day_doy - func('shortgs','doy',year,prev_month,1)
  249. prev_month_length = func('shortgs','doy',year,month,1) - func('shortgs','doy',year,prev_month,1)
  250. end
  251. first_month_first_day_week = week - (dif_days mod 7)
  252. first_month_first_day_index = length_of_month_field -1 - dif_days
  253. r = first_month_first_day_index
  254. if first_month_first_day_week < 1: first_month_first_day_week += 7
  255. i = 42
  256. :tabmc21
  257. $mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc21'
  258. i = 0
  259. :tabmc21a
  260. $mk1_mdays[i+first_month_first_day_week-1] = $str(i+1)
  261. i += 1
  262. if i < prev_month_length: jump 'tabmc21a'
  263. $prev_month_name = $mid($monthName[prev_month],1,1) + '<br>' + $mid($monthName[prev_month],2,1) + '<br>' + $mid($monthName[prev_month],3,1)
  264. k = 0
  265. $tabmc ='<center><font face="courier" size=5>'
  266. $tabmc +='<table border = 1 cellspacing="0" cellpadding="5">'
  267. $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>'
  268. month_weeks = (first_month_first_day_week + prev_month_length + 5)/7 - 1
  269. i = month_weeks
  270. :tabmc22
  271. $tabmc +='<tr>'
  272. j = 7
  273. if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$prev_month_name>></td>'
  274. :tabmc23
  275. if j > 0:
  276. j -=1
  277. if $mk1_mdays[k]='&nbsp':
  278. $tabmc +='<td><<$mk1_mdays[k]>></td>'
  279. else
  280. $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
  281. r +=1
  282. end
  283. k +=1
  284. jump 'tabmc23' & !<<$MenCalCopy[r]>>
  285. end
  286. if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc22'
  287. killvar '$mk1_mdays'
  288. killvar '$mk1_mdays_color'
  289. !! current month
  290. if month = 12:
  291. dif_days = day - 1
  292. cur_month = month
  293. cur_month_length = 31
  294. else
  295. dif_days = day - 1
  296. cur_month_length = func('shortgs','doy',year,month+1,1) - func('shortgs','doy',year,month,1)
  297. end
  298. second_month_first_day_week = week - (dif_days mod 7)
  299. second_month_first_day_index = length_of_month_field -1 - dif_days
  300. if second_month_first_day_week < 1: second_month_first_day_week += 7
  301. i = 42
  302. :tabmc31
  303. $mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc31'
  304. i = 0
  305. :tabmc31a
  306. $mk1_mdays[i+second_month_first_day_week-1] = $str(i+1)
  307. i += 1
  308. if i < cur_month_length: jump 'tabmc31a'
  309. $cur_month_name = $mid($monthName[month],1,1) + '<br>' + $mid($monthName[month],2,1) + '<br>' + $mid($monthName[month],3,1)
  310. k = 0
  311. month_weeks = (second_month_first_day_week + cur_month_length + 5)/7 - 1
  312. i = month_weeks
  313. :tabmc32
  314. $tabmc +='<tr>'
  315. j = 7
  316. if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$cur_month_name>></td>'
  317. :tabmc33
  318. if j > 0:
  319. j -=1
  320. if $mk1_mdays[k]='&nbsp':
  321. $tabmc +='<td><<$mk1_mdays[k]>></td>'
  322. else
  323. 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>'
  324. r +=1
  325. end
  326. k +=1
  327. jump 'tabmc33'
  328. end
  329. if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc32'
  330. killvar '$mk1_mdays'
  331. killvar '$mk1_mdays_color'
  332. !! next month
  333. if month = 12:
  334. dif_days = 31 - day + 1
  335. next_month = 1
  336. next_month_length = 31
  337. elseif month = 11:
  338. dif_days = 30 - day + 1
  339. next_month = 12
  340. next_month_length = 31
  341. else
  342. next_month = month + 1
  343. dif_days = cur_month_length - day + 1
  344. next_month_length = func('shortgs','doy',year,month+2,1) - func('shortgs','doy',year,month+1,1)
  345. end
  346. next_month_first_day_week = week + (dif_days mod 7)
  347. next_month_first_day_index = length_of_month_field -1 - dif_days
  348. if next_month_first_day_week < 1: next_month_first_day_week += 7
  349. i = 35
  350. :tabmc41
  351. $mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc41'
  352. i = 0
  353. :tabmc41a
  354. $mk1_mdays[i+next_month_first_day_week-1] = $str(i+1)
  355. !! 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]]
  356. i += 1
  357. if i < next_month_length: jump 'tabmc41a'
  358. $next_month_name = $mid($monthName[next_month],1,1) + '<br>' + $mid($monthName[next_month],2,1) + '<br>' + $mid($monthName[next_month],3,1)
  359. k = 0
  360. month_weeks = (next_month_first_day_week + next_month_length + 5)/7 - 1
  361. i = month_weeks
  362. :tabmc42
  363. $tabmc +='<tr>'
  364. j = 7
  365. if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$next_month_name>></td>'
  366. :tabmc43
  367. if j > 0:
  368. j -=1
  369. if $mk1_mdays[k]='&nbsp':
  370. $tabmc +='<td><<$mk1_mdays[k]>></td>'
  371. else
  372. $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
  373. r +=1
  374. end
  375. k +=1
  376. jump 'tabmc43'
  377. end
  378. if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc42'
  379. killvar '$mk1_mdays'
  380. $tabmc += '</tr><table></font></center>'
  381. $tabmc
  382. act 'Back': gt 'restoreposition'
  383. end
  384. !! gs 'shortgs','fonts'
  385. if $ARGS[0] = 'fonts':
  386. if $ARGS[1] = 'refresh':
  387. jump 'fontsloop'
  388. else
  389. $dynamicreturn = $ARGS[1]
  390. $OpenPhraseSave = $ARGS[2]
  391. $ClosePhraseSave = $ARGS[3]
  392. end
  393. gs 'saveposition'
  394. $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'
  395. $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'
  396. i = 15
  397. :fontsloop0
  398. if $CurFont = $fontlist[i]: curfont = i
  399. if $CurColor = $fontcolor[i]: curcolor = i
  400. i -= 1
  401. if i > 0: jump 'fontsloop0'
  402. jump 'fontsloop1'
  403. :fontsloop
  404. $OpenPhrase = '<font size="<<CurFontSize>>" color="<<$CurColor>>" face="<<$CurFont>>" >'+$CurBold+$CurItalic
  405. $ClosePhrase = $CurItalicBack+$CurBoldBack+'</font>'
  406. :fontsloop1
  407. *clr & cla
  408. $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
  409. '<a href="exec: curfont = (curfont + 1) mod 16 & $CurFont = $fontlist[curfont] & gs ''shortgs'',''fonts'',''refresh'' ">Change the Font</a>'
  410. '<a href="exec: curcolor = (curcolor + 1) mod 16 & $CurColor = $fontcolor[curcolor] & gs ''shortgs'',''fonts'',''refresh'' ">Change the Color</a>'
  411. '<a href="exec:$CurBold = iif($CurBold ! ''<b>'',''<b>'','' '') & $CurBoldBack = iif($CurBold = ''<b>'',''</b>'','' '') & gs ''shortgs'',''fonts'',''refresh'' ">Change the BoldState</a>'
  412. '<a href="exec:$CurItalic = iif($CurItalic ! ''<i>'',''<i>'','' '') & $CurItalicBack = iif($CurItalic = ''<i>'',''</i>'','' '') & gs ''shortgs'',''fonts'',''refresh'' ">Change the ItalicState</a>'
  413. '<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>'
  414. act 'Back':
  415. killvar '$fontlist'
  416. killvar '$fontcolor'
  417. dynamic '<<$OpenPhraseSave>> = $OpenPhrase'
  418. dynamic '<<$ClosePhraseSave>> = $ClosePhrase'
  419. if $dynamicreturn ! '': dynamic 'dynamic <<$dynamicreturn>>'
  420. gt 'restoreposition'
  421. end
  422. end
  423. !! use gs 'shortgs','ncp_update'
  424. if $ARGS[0] = 'ncp_update':
  425. copyarr 'copy_npc_QW','npc_QW'
  426. copyarr 'copy_npc_rel','npc_rel'
  427. copyarr 'copy_npc_love','npc_love'
  428. copyarr '$copy_npc_usedname','$npc_usedname'
  429. gs 'npcstatic1'
  430. gs 'npcstatic2'
  431. gs 'npcstatic3'
  432. gs 'npcstatic4'
  433. gs 'npcstatic5'
  434. gs 'npcstatic6'
  435. i = arrsize('copy_npc_QW')
  436. j = 1
  437. :loopnpcupdate
  438. $boy = 'A<<j>>'
  439. npc_QW[$boy] = copy_npc_QW[$boy]
  440. npc_rel[$boy] = copy_npc_rel[$boy]
  441. npc_love[$boy] = copy_npc_love[$boy]
  442. $npc_usedname[$boy] = $copy_npc_usedname[$boy]
  443. j += 1
  444. if j <= i: jump 'loopnpcupdate'
  445. killvar 'copy_npc_QW'
  446. killvar 'copy_npc_rel'
  447. killvar 'copy_npc_love'
  448. killvar '$copy_npc_usedname'
  449. end
  450. !! this function returns the numeric index of the array element which is indexed by string value.
  451. !! call func('shortgs', 'get_me_index', 'name of array','string index')
  452. !! 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.
  453. !! if the array consists such value, the fuction can mess the array content and return wrong value
  454. !! changed the value for detecting numeric element from -999 to -2147483648 (November 2020)
  455. if $ARGS[0] = 'get_me_index':
  456. $test = '<<$ARGS[1]>>[''<<$ARGS[2]>>'']'
  457. testas0 = arrsize('<<$ARGS[1]>>')
  458. if $mid($test,1,1)='$':
  459. $temp=dyneval('$result=<<$test>>')
  460. dynamic '<<$test>> = ''SearchTag'' '
  461. testas1 = arrsize('<<$ARGS[1]>>')
  462. if testas0 = testas1:
  463. res = dyneval('result = arrpos(''<<$ARGS[1]>>'',''SearchTag'')')
  464. dynamic '<<$test>> = $temp'
  465. else
  466. res = -1
  467. killvar '<<$ARGS[1]>>',testas0
  468. end
  469. else
  470. temp=dyneval('result=<<$test>>')
  471. dynamic '<<$test>> = -2147483648'
  472. testas1 = arrsize('<<$ARGS[1]>>')
  473. if testas0 = testas1:
  474. res = dyneval('result = arrpos(''<<$ARGS[1]>>'',-2147483648)')
  475. dynamic '<<$test>> = <<temp>>'
  476. else
  477. res = -1
  478. killvar '<<$ARGS[1]>>',testas0
  479. end
  480. end
  481. result = res
  482. end
  483. !! call gs 'shortgs', 'remove_array_element', 'name of array','string index'
  484. if $ARGS[0] = 'remove_array_element':
  485. killvar '<<$ARGS[1]>>',func('shortgs', 'get_me_index', $ARGS[1],$ARGS[2])
  486. end
  487. if $ARGS[0] = 'testsize':
  488. '$npc_dna = ' + arrsize('$npc_dna')
  489. '$npc_firstname = ' + arrsize('$npc_firstname')
  490. '$npc_lastname = ' + arrsize('$npc_lastname')
  491. '$npc_nickname = ' + arrsize('$npc_nickname')
  492. '$npc_notes = ' + arrsize('$npc_notes')
  493. '$npc_occupation = ' + arrsize('$npc_occupation')
  494. '$npc_perstype = ' + arrsize('$npc_perstype')
  495. '$npc_pic = ' + arrsize('$npc_pic')
  496. '$npc_thdick = ' + arrsize('$npc_thdick')
  497. '$npc_usedname = ' + arrsize('$npc_usedname')
  498. 'npc_apprnc = ' + arrsize('npc_apprnc')
  499. 'npc_bust = ' + arrsize('npc_bust')
  500. 'npc_outfit = ' + arrsize('npc_outfit')
  501. 'npc_style = ' + arrsize('npc_style')
  502. 'npc_dick = ' + arrsize('npc_dick')
  503. 'npc_dob = ' + arrsize('npc_dob')
  504. 'npc_drunk = ' + arrsize('npc_drunk')
  505. 'npc_gender = ' + arrsize('npc_gender')
  506. 'npc_haircol = ' + arrsize('npc_haircol')
  507. 'npc_height = ' + arrsize('npc_height')
  508. 'npc_horny = ' + arrsize('npc_horny')
  509. 'npc_intel = ' + arrsize('npc_intel')
  510. 'npc_love = ' + arrsize('npc_love')
  511. 'npc_QW = ' + arrsize('npc_QW')
  512. 'npc_rel = ' + arrsize('npc_rel')
  513. 'npc_sex = ' + arrsize('npc_sex')
  514. 'npc_sexskill = ' + arrsize('npc_sexskill')
  515. 'npc_spermpot = ' + arrsize('npc_spermpot')
  516. 'npc_herpes = ' + arrsize('npc_herpes')
  517. 'npc_syth = ' + arrsize('npc_syth')
  518. 'npc_gon = ' + arrsize('npc_gon')
  519. 'npc_thrush = ' + arrsize('npc_thrush')
  520. 'npc_apt_type = ' + arrsize('npc_apt_type')
  521. 'npc_apt_number = ' + arrsize('npc_apt_number')
  522. '$npc_apt_bedroom = ' + arrsize('$npc_apt_bedroom')
  523. '$npc_apt_kitchen = ' + arrsize('$npc_apt_kitchen')
  524. '$npc_apt_livingroom = ' + arrsize('$npc_apt_livingroom')
  525. '$npc_apt_bathroom = ' + arrsize('$npc_apt_bathroom')
  526. 'npc_perv = ' + arrsize('npc_perv')
  527. 'npc_finance = ' + arrsize('npc_finance')
  528. 'npc_humor = ' + arrsize('npc_humor')
  529. 'npc_fav_pos = ' + arrsize('npc_fav_pos')
  530. 'npc_tit_pref = ' + arrsize('npc_tit_pref')
  531. 'npc_addit = ' + arrsize('npc_addit')
  532. 'npc_doors = ' + arrsize('npc_doors')
  533. 'npc_goal = ' + arrsize('npc_goal')
  534. 'npc_fidelity = ' + arrsize('npc_fidelity')
  535. 'npc_lover_days = ' + arrsize('npc_lover_days')
  536. 'npc_lover_keys = ' + arrsize('npc_lover_keys')
  537. '$npc_index = ' + arrsize('$npc_index')
  538. end
  539. if $ARGS[0] = 'npctest':
  540. ' --- init --- '
  541. gs 'shortgs', 'testsize'
  542. gs 'npcgeneratec', 0, 'stranger', rand(18,45),1
  543. $npc_notes[$npclastgenerated]
  544. $npclastgenerated
  545. ' --- gen npc C --- '
  546. gs 'shortgs', 'testsize'
  547. gs 'npcpreservec', $npclastgenerated
  548. $npc_notes[$npclastsaved]
  549. $npclastsaved
  550. ' --- sav npc C to npc B --- '
  551. gs 'shortgs', 'testsize'
  552. gs 'npccleanc',$npclastsaved
  553. ' --- delete npc B --- '
  554. gs 'shortgs', 'testsize'
  555. end
  556. if $ARGS[0] = 'replace header':
  557. wait(ARGS[1])
  558. RH_Count = ARGS[2]
  559. $RH_temp = $MAINTXT
  560. :RH_label
  561. RH_temp_lenght = LEN($RH_temp)
  562. RH_temp_LFpos = STRPOS($RH_temp,'\n')
  563. $RH_temp = $MID($RH_temp, RH_temp_LFpos+1, RH_temp_lenght - RH_temp_LFpos)
  564. RH_Count -=1
  565. if RH_Count > 0: jump 'RH_label'
  566. *clr
  567. $ARGS[3] & $ARGS[4] & $ARGS[5] & $ARGS[6] & $ARGS[7]
  568. $RH_temp
  569. killvar '$RH_temp'
  570. killvar 'RH_Count'
  571. killvar 'RH_temp_lenght'
  572. killvar 'RH_temp_LFpos'
  573. end
  574. if $ARGS[0]='img msg':
  575. $shortgstemp = '<center><img height=280 src="<<$ARGS[1]>>"></center>'
  576. msg $shortgstemp
  577. killvar '$shortgstemp'
  578. end
  579. !! Used for dividing with accurate rounding up/down
  580. if $ARGS[0] = 'round_divide':
  581. !! ARGS[1] = value you want divided
  582. !! ARGS[2] = divider
  583. !! func('shortgs','round_divide', number, divider)
  584. !! func('shortgs','round_divide', 12345, 7)
  585. if ARGS[2] ! 0:
  586. temp_number = ARGS[1]/ARGS[2]
  587. 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
  588. result = temp_number
  589. killvar 'temp_number'
  590. else
  591. msg '<b>Error: No dividing by 0! You trying to make the universe disappear?</b>'
  592. end
  593. end
  594. !! Used for rounding numbers to the nearest multiple of ARGS[2]
  595. if $ARGS[0] = 'round_tool':
  596. !! ARGS[1] = value you want rounded
  597. !! ARGS[2] = nearest multiple to round to
  598. !! func('shortgs','round_tool', number, multiple)
  599. !! func('shortgs','round_tool', 12345, 10)
  600. if ARGS[2] ! 0:
  601. temp_multiple = ARGS[2]
  602. result = func('shortgs','round_divide', ARGS[1], ARGS[2]) * temp_multiple
  603. killvar 'temp_multiple'
  604. else
  605. msg '<b>Error: Can''t round to 0!</b>'
  606. end
  607. end
  608. !! Randomly picks one of the items plugged in
  609. !!
  610. !! Option 1: (has 6 input limit)
  611. !! $ARGS[1] = 'string' or 'number' to specify what youre plugging in (can also be blank for numbers)
  612. !! $ARGS[2-7] = strings or numbers to pick from, limited to 6
  613. !! Example 1: func('shortgs', 'rand_pick', 'string', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta')
  614. !! Example 2: func('shortgs', 'rand_pick', '', 2, 3, 5, 7, 11, 13)
  615. !!
  616. !! Option 2: (no limitations, has to be delimited)
  617. !! $ARGS[1] = 'delimit' - used for larger numbers of items to pick from
  618. !! $ARGS[2] = 'string' or 'number' to specify what youre plugging in (can also be blank for numbers)
  619. !! $ARGS[3] = Delimited string to parse
  620. !! $ARGS[4] = Delimiter used (Default = '|' pipe)
  621. !! Example 1: func('shortgs', 'rand_pick', 'delimit', 'string', 'alpha|beta|gamma|delta|epsilon|zeta')
  622. !! Example 2: func('shortgs', 'rand_pick', 'delimit', 'number', '1-12-123-1234-12345-123456', '-')
  623. !! Example 3: func('shortgs', 'rand_pick', 'delimit', '', '0.1.2.3.5.7.11', '.')
  624. if $ARGS[0] = 'rand_pick':
  625. if $ARGS[1] = 'delimit':
  626. if $ARGS[2] = 'string':
  627. gs 'shortgs', 'parse_string', '$rand_pick_temp', $ARGS[3], $ARGS[4]
  628. $result = $rand_pick_temp[rand(0, arrsize('$rand_pick_temp')-1)]
  629. killvar '$rand_pick_temp'
  630. else
  631. gs 'shortgs', 'parse_string', 'rand_pick_temp', $ARGS[3], $ARGS[4]
  632. result = rand_pick_temp[rand(0, arrsize('rand_pick_temp')-1)]
  633. killvar 'rand_pick_temp'
  634. end
  635. else
  636. if arrsize('ARGS') > 2:
  637. if $ARGS[1] = 'string':
  638. $result = $ARGS[rand(2, arrsize('$ARGS')-1)]
  639. else
  640. result = ARGS[rand(2, arrsize('ARGS')-1)]
  641. end
  642. else
  643. msg '<b>Error: ''rand_pick'' is missing ARGS</b>'
  644. end
  645. end
  646. end
  647. !! Parse delimited string into an array
  648. !! $ARGS[1] = ArrayName (has to include $ for string values)
  649. !! $ARGS[2] = Delimited string to parse
  650. !! $ARGS[3] = Delimiter used (Default = '|' pipe)
  651. !! Example 1: gs 'shortgs', 'parse_string', '$my_array', 'alpha|beta|gamma|delta|epsilon|zeta'
  652. !! Example 2: gs 'shortgs', 'parse_string', 'my_array', '1-12-123-1234-12345-123456', '-'
  653. if $ARGS[0] = 'parse_string':
  654. !! Some failsafes (blank array name, blank string or no delimiters in string)
  655. if $ARGS[1] ! '':
  656. if $ARGS[2] ! '' and instr($ARGS[2],iif($ARGS[3] = '', '|', $ARGS[3])) > 0:
  657. !! Set delimiter with default if needed
  658. if $ARGS[3] = '':
  659. $ParserTmpDelim = '|'
  660. else
  661. $ParserTmpDelim = $ARGS[3]
  662. end
  663. !! Clear temp array if needed
  664. killvar 'ParserTmpArr' & killvar '$ParserTmpArr'
  665. $ParserTmpStr = $ARGS[2]
  666. !! Loop through string until no more delimiters found
  667. :StringParser01
  668. ParserTmpIdx = instr($ParserTmpStr, $ParserTmpDelim)
  669. if ParserTmpIdx > 0:
  670. if mid($ARGS[1],1,1) = '$':
  671. $ParserTmpArr[] = mid($ParserTmpStr, 1, ParserTmpIdx-1)
  672. $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)
  673. else
  674. ParserTmpArr[] = val(mid($ParserTmpStr, 1, ParserTmpIdx-1))
  675. $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)
  676. end
  677. jump 'StringParser01'
  678. !! Get last part since no more delimiters were found and copy to the final array
  679. elseif mid($ARGS[1],1,1) = '$':
  680. $ParserTmpArr[] = $ParserTmpStr
  681. copyarr $ARGS[1], '$ParserTmpArr'
  682. else
  683. ParserTmpArr[] = val($ParserTmpStr)
  684. copyarr $ARGS[1], 'ParserTmpArr'
  685. end
  686. killvar '$ParserTmpDelim'
  687. killvar '$ParserTmpStr'
  688. killvar 'ParserTmpIdx'
  689. killvar 'ParserTmpArr'
  690. else
  691. msg '<b>Error: No delimited string found!</b>'
  692. end
  693. else
  694. msg '<b>Error: No array name found!</b>'
  695. end
  696. end
  697. if $ARGS[0] = 'clothing_state':
  698. if PCloswimwear = 1:
  699. 'You are wearing swimwear.'
  700. elseif PCloSport = 1:
  701. 'You are wearing gym clothing and shoes.'
  702. elseif $clothingworntype = 'nude' and $braworntype = 'none' and $pantyworntype = 'none':
  703. 'You are naked.'
  704. elseif $clothingworntype = 'nude' and $braworntype = 'none':
  705. 'You are just wearing panties.'
  706. elseif $clothingworntype = 'nude' and $pantyworntype = 'none':
  707. 'You are just wearing a bra.'
  708. elseif $clothingworntype = 'nude':
  709. 'You are in your underwear.'
  710. elseif $braworntype = 'none' and $pantyworntype = 'none' and PCloPanties ! 1 and PCloBra = 0:
  711. 'You are not wearing any underwear.'
  712. elseif $pantyworntype = 'none' and PCloPanties ! 1:
  713. 'You are not wearing panties'
  714. elseif PCloBra = 0:
  715. 'You are not wearing a bra'
  716. end
  717. end
  718. !! 2024-07-05 clothing_status - fct to determine clothing status
  719. !! v.01 - Initial release
  720. if $ARGS[0] = 'clothing_status':
  721. $apparel['panty'] = ''
  722. $apparel['bra'] = ''
  723. $apparel['status'] = ''
  724. !! Default scene exit checks
  725. if $pantyworntype = 'none': $apparel['panty'] = 'pantyless'
  726. if $braworntype = 'none': $apparel['bra'] = 'braless'
  727. if $clothingworntype = 'nude': $apparel['status'] = 'nude'
  728. !! Quest related clothing checks
  729. if $pantyworntype ! 'none' and $braworntype ! 'none': $apparel['status'] = 'underwear'
  730. if PCloSport = 1: $apparel['status'] = 'sport'
  731. if $clothingworntype = 'ballet_secrets' and $shoeworntype = 'ballet_secrets': $apparel['status'] = 'dance'
  732. if $clothingworntype = 'moncheri_gown' and $shoeworntype = 'moncheri_shoes': $apparel['status'] = 'ballgown'
  733. !! Failsafe
  734. if apparel['status'] = '':
  735. if apparel['panty'] ! '':
  736. apparel['status'] = apparel['panty']
  737. else
  738. apparel['status'] = apparel['bra']
  739. end
  740. end
  741. end
  742. !! Author - Hooded Silence
  743. !! Date created - 26 Aug 22
  744. !! Payment system - Used to pay for items in various game locations
  745. !! v. 02 - Refactoring to make usage simpler using the epayments array
  746. !! command syntax: gs 'shortgs','payments'
  747. !! All variabls are initiated at point of origin
  748. !!
  749. !! epayments[value] = cost of goods. Required
  750. !! $epayments[method] = how it''s to be paid cash or card. leave blank for both. Optional
  751. !! $epayments[description] = Item Description - What's been bought. Required
  752. !! $epayments[item_variable] = item variable to be purchased to be added to players inventory. Optional.
  753. !! epayments[quantity] = How many items to be added. Defaults to one - Optional.
  754. !! $epayments[loc] = Where do you want the character to go to, optional falls back to starting location if set. Optional
  755. !! $epayments[act] = If there's a specific act to return to. Optional
  756. !! $epayments[banner] = banner image for the sale. Optional
  757. !! Optional with no content are ignored.
  758. !! Use stock image for the purchase screen?
  759. if $ARGS[0] = 'payments':
  760. *clr & cla
  761. if epayments['value'] = 0:
  762. msg '<b>Error, Cash Value not set.</b>'
  763. end
  764. if $epayments['description'] = '':
  765. msg '<b>Error, Item Description not set.</b>'
  766. end
  767. !! Construct payment call
  768. if $epayments['item_variable'] ! '':
  769. $construct_cash = '<a href="exec: money -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
  770. $construct_card = '<a href="exec: karta -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
  771. else
  772. $construct_cash = '<a href="exec: $epayments[''method''] = ''cash'' & money -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
  773. $construct_card = '<a href="exec: $epayments[''method''] = ''card'' & karta -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
  774. end
  775. !Use stock image for the purchase screen?
  776. if $epayments['banner'] ! '':
  777. '<center><img <<$set_imgh>> src="images/' + $epayments['banner'] + '"></center>'
  778. end
  779. if ($epayments['method'] ! 'cash' and $epayments['method'] ! 'card') and (epayments['value'] <= money and epayments['value'] <= karta):
  780. 'How do you want to pay for the <<$epayments[''description'']>>? <<$construct_cash>> or <<$construct_card>>'
  781. elseif ($epayments['method'] = 'cash' or $epayments['method'] = '') and epayments['value'] <= money:
  782. 'Pay for the <<$epayments[''description'']>> with <<$construct_cash>>?'
  783. elseif ($epayments['method'] = 'card' or $epayments['method'] = '') and epayments['value'] <= karta:
  784. 'Pay for the <<$epayments[''description'']>> with your <<$construct_card>>?'
  785. else
  786. 'You don''t have enough money in your purse or bank account for this item.'
  787. end
  788. act 'Cancel Payment': gt $loc, $loc_arg
  789. end
  790. !! Payment complete
  791. if $ARGS[0] = 'paymentcomplete':
  792. *clr & cla
  793. 'Thank you for your custom. Please come again!'
  794. *nl
  795. 'You paid ' + epayments['value'] + '<b>₽</b>' + iif ($epayments['method'] = 'cash',' in cash', ' with your bank card') + ' for your ' + $epayments['description']
  796. gs 'stat'
  797. !! clean up all the variables
  798. killvar 'construct_cash'
  799. killvar 'construct_card'
  800. if $epayments['loc'] ! '':
  801. act 'Finish payment': gt $epayments['loc'], $epayments['loc_arg']
  802. else
  803. act 'Finish Payment': gt $loc, $loc_arg
  804. end
  805. end
  806. if $ARGS[0] = 'calendar_display':
  807. '<b><<$month>> <<day>></b>'
  808. '<b><<$week>></b>'
  809. '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
  810. end
  811. if $ARGS[0] = 'day_display':
  812. '<b><<$week>></b>'
  813. '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
  814. end
  815. if $ARGS[0] = 'time_display':
  816. '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
  817. end
  818. if $ARGS[0] = 'setloc':
  819. !! Sets the location variables based on $ARGS[1] = loc, $ARGS[2] = loc arg
  820. !! Primary key
  821. $prevloc = $loc
  822. $prevarg = $loc_arg
  823. $loc = $ARGS[1]
  824. $menu_loc = $ARGS[1]
  825. $locM = $ARGS[1]
  826. !! Secondary key
  827. $loc_arg = $ARGS[2]
  828. $menu_arg = $ARGS[2]
  829. $locM_arg = $ARGS[2]
  830. end
  831. !! generates n rand numbers and selects min or max (max for lucky or min for unlucky)
  832. !! use: func('shortgs' 'roll', 'lucky' x, y, n)
  833. !! where x and y set range and n sets amount of rolls
  834. !! example: func('shortgs' 'roll', 'lucky' 0, 5)
  835. !! example: func('shortgs' 'roll', 'unlucky' 0, 100, 5)
  836. if $ARGS[0] = 'roll':
  837. temp_roll = rand(ARGS[2], ARGS[3])
  838. shortgs_i = 1
  839. :roll
  840. temp_rand = rand(ARGS[2], ARGS[3])
  841. if $ARGS[1] = 'lucky' and temp_rand > temp_roll:
  842. temp_roll = temp_rand
  843. elseif $ARGS[1] = 'unlucky' and temp_rand < temp_roll:
  844. temp_roll = temp_rand
  845. end
  846. shortgs_i += 1
  847. if shortgs_i < ARGS[4]: jump 'roll'
  848. result = temp_roll
  849. killvar 'temp_roll'
  850. killvar 'temp_rand'
  851. end
  852. !! limits a number to a range
  853. !! use: func('shortgs', 'clamp', var, min, max)
  854. !! returns min if var < min, returns max if var > max
  855. !! otherwise returns var
  856. !! example: func('shortgs', 'clamp', var, 0, 100)
  857. if $ARGS[0] = 'clamp':
  858. result = min(max(ARGS[1], ARGS[2]), ARGS[3])
  859. end
  860. !! sets a stat or attribute level to a number
  861. !! use: gs 'shortgs', 'setStat', 'stat', number
  862. !! example: gs 'shortgs', 'setStat', 'stren', 70
  863. !! example: gs 'shortgs', 'setStat', 'inhib', 10
  864. if $ARGS[0] = 'setStat':
  865. temp_input = func('shortgs', 'clamp', ARGS[2], 0, 100)
  866. if temp_input > 1:
  867. temp_xpnxt = (func('_difficulty','getexpadj') * 73 * (temp_input - 1) * (temp_input - 1) / 2730) + 1
  868. else
  869. temp_xpnxt = temp_input
  870. end
  871. !! magik is based on `orgasm` variable thus the need for `_adj`
  872. if $ARGS[1] = 'magik':
  873. dynamic "<<$ARGS[1]>>_lvl = temp_input
  874. <<$ARGS[1]>>_adj = temp_xpnxt - orgasm
  875. <<$ARGS[1]>>_exp = orgasm + <<$ARGS[1]>>_adj
  876. <<$ARGS[1]>>_mem = <<$ARGS[1]>>_exp
  877. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  878. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
  879. !! inhib needs its `_flr` set at `_lvl` and not `_lvl / 5`
  880. elseif $ARGS[1] = 'inhib':
  881. dynamic "<<$ARGS[1]>>_lvl = temp_input
  882. <<$ARGS[1]>>_exp = temp_xpnxt
  883. <<$ARGS[1]>>_mem = temp_xpnxt
  884. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  885. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl"
  886. !! `stren` and `stren_plus` changes should also update strenbuf
  887. elseif $ARGS[1] = 'stren' or $ARGS[1] = 'stren_plus':
  888. dynamic "<<$ARGS[1]>>_lvl = temp_input
  889. <<$ARGS[1]>>_exp = temp_xpnxt
  890. <<$ARGS[1]>>_mem = temp_xpnxt
  891. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  892. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
  893. strenbuf = stren_lvl + stren_plus_lvl
  894. gs 'body', 'DailyUpdate'
  895. elseif $ARGS[1] = 'agil' or $ARGS[1] = 'vital':
  896. dynamic "<<$ARGS[1]>>_lvl = temp_input
  897. <<$ARGS[1]>>_exp = temp_xpnxt
  898. <<$ARGS[1]>>_mem = temp_xpnxt
  899. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  900. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5
  901. <<$ARGS[1]>>buf = <<$ARGS[1]>>_lvl"
  902. gs 'body', 'DailyUpdate'
  903. else
  904. dynamic "<<$ARGS[1]>>_lvl = temp_input
  905. <<$ARGS[1]>>_exp = temp_xpnxt
  906. <<$ARGS[1]>>_mem = temp_xpnxt
  907. <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
  908. <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
  909. end
  910. killvar 'temp_input' & killvar 'temp_xpnxt'
  911. end
  912. !! Recursively computes a simple exponent - https://en.wikipedia.org/wiki/Exponentiation_by_squaring
  913. !! use: func('shortgs', 's_pow', var, exp)
  914. !! returns var ^ exp
  915. !! exp must be an integer >= 0
  916. !! example: func('shortgs', 's_pow', 2, 3)
  917. if $ARGS[0] = 's_pow':
  918. if(ARGS[2] > 10) : msg('Warning: s_pow operations with large exponents may cause integer overflows. <<ARGS[1]>> ^ <<ARGS[2]>>')
  919. if(ARGS[2]) < 0:
  920. !! n ^(-m) = 0
  921. msg('Error: s_pow cannot accept negative exponents! <<ARGS[1]>> ^ <<ARGS[2]>>')
  922. elseif ARGS[2] = 0:
  923. result = 1
  924. elseif ARGS[2] = 1:
  925. result = ARGS[1]
  926. elseif (ARGS[2] mod 2) = 0:
  927. result = func('shortgs', 's_pow', ARGS[1] * ARGS[1], ARGS[2] / 2)
  928. elseif (ARGS[2] mod 2) ! 0:
  929. result = ARGS[1] * func('shortgs', 's_pow', ARGS[1] * ARGS[1], (ARGS[2] - 1) / 2)
  930. end
  931. end
  932. !! Improved exponent calculation based on - https://en.wikipedia.org/wiki/Exponentiation_by_squaring
  933. !! use: func('shortgs', 's_pow2', var, exp)
  934. !! returns var ^exp
  935. !! if exp < 0, returns 0
  936. !! example: func('shortgs', 's_pow2', 2, 3) -> 8
  937. if $ARGS[0] = 's_pow2':
  938. if ARGS[2] = 0:
  939. result = 1
  940. elseif ARGS[2] < 0:
  941. result = 0
  942. elseif ARGS[2] = 1:
  943. result = ARGS[1]
  944. elseif ARGS[2] = 2:
  945. result = ARGS[1] * ARGS[1]
  946. elseif ARGS[2] = 3:
  947. result = ARGS[1] * ARGS[1] * ARGS[1]
  948. elseif (ARGS[2] mod 2) = 0:
  949. result = func('shortgs', 's_pow2', ARGS[1] * ARGS[1], ARGS[2] / 2)
  950. else
  951. result = ARGS[1] * func('shortgs', 's_pow2', ARGS[1] * ARGS[1], ARGS[2] / 4)
  952. end
  953. end
  954. !! Takes multiple arrays and sorts them based on the first one.
  955. !! Sorts the key_array (which must only have value entries) in ascending order.
  956. !! gs 'shortgs', 'coupled_array_sort'. 'key_array', 'array1', 'array2', 'array3', ...
  957. !!
  958. !! String arrays must start with a $ otherwise the numeric values will be copied instead.
  959. !!
  960. !! examples:
  961. !! example 1: we want to sort a single array with values called values_array
  962. !! gs 'shortgs', 'coupled_array_sort', 'values_array'
  963. !! example 2: we have an array filled with days (called trigger_days), and a coupled array filled with npc_codes (called $trigger_npc_codes)
  964. !! gs 'shortgs', 'coupled_array_sort', 'trigger_days', '$trigger_npc_codes'
  965. if $ARGS[0] = 'coupled_array_sort':
  966. :shortgs_coupled_array_sort_loop_start
  967. if arrsize($ARGS[1]) > 0:
  968. shortgs_temp_pos = arrpos($ARGS[1], min($ARGS[1]))
  969. shortgs_args_index = 1
  970. :shortgs_casl_inner_start
  971. if $ARGS[shortgs_args_index] ! '':
  972. if arrsize($ARGS[shortgs_args_index]) > 0:
  973. if mid($ARGS[shortgs_args_index], 1, 1) = '$':
  974. dynamic '$shortgs_temp_array<<shortgs_args_index>>[] = <<$ARGS[shortgs_args_index]>>[shortgs_temp_pos]'
  975. else
  976. dynamic 'shortgs_temp_array<<shortgs_args_index>>[] = <<$ARGS[shortgs_args_index]>>[shortgs_temp_pos]'
  977. end
  978. killvar $ARGS[shortgs_args_index], shortgs_temp_pos
  979. shortgs_args_index += 1
  980. jump 'shortgs_casl_inner_start'
  981. end
  982. end
  983. jump 'shortgs_coupled_array_sort_loop_start'
  984. end
  985. shortgs_max_args_index = shortgs_args_index
  986. shortgs_args_index = 1
  987. :shortgs_casl_outer_start
  988. if shortgs_args_index < shortgs_max_args_index:
  989. dynamic 'copyarr(''<<$ARGS[shortgs_args_index]>>'', ''shortgs_temp_array<<shortgs_args_index>>'')'
  990. dynamic 'killvar ''shortgs_temp_array<<shortgs_args_index>>'' '
  991. shortgs_args_index += 1
  992. jump 'shortgs_casl_outer_start'
  993. end
  994. killvar 'shortgs_casl_inner_start'
  995. killvar 'shortgs_args_index'
  996. killvar 'shortgs_coupled_array_sort_loop_start'
  997. killvar 'shortgs_casl_outer_start'
  998. killvar 'shortgs_max_args_index'
  999. killvar 'shortgs_temp_pos'
  1000. end
  1001. !! converts decimal integer to hexadecimal string
  1002. !! main use - convert rgb color to hex color (to use with HTML)
  1003. ! use: func('shortgs', 'int_to_hex_str', number)
  1004. ! example: func('shortgs', 'int_to_hex_str', 192)
  1005. ! example: func('shortgs', 'int_to_hex_str', BColorBase)
  1006. if $ARGS[0] = 'int_to_hex_str':
  1007. :int_to_hex_loop
  1008. $result = mid('0123456789ABCDEF', 1 + (ARGS[1] mod 16), 1) + $result
  1009. ARGS[1] /= 16
  1010. if ARGS[1] > 0: jump 'int_to_hex_loop'
  1011. end
  1012. !! converts hexadecimal string to decimal integer
  1013. !! main use - convert hex color to rgb color (to use with HTML)
  1014. ! use: func('shortgs', 'hex_str_to_int', $hex_string)
  1015. ! example: func('shortgs', 'hex_str_to_int', 'A1C')
  1016. ! example: func('shortgs', 'hex_str_to_int', $bcolor)
  1017. if $ARGS[0] = 'hex_str_to_int':
  1018. $ARGS[1] = $ucase($ARGS[1])
  1019. shortgs_i = 1
  1020. :hex_to_int_loop
  1021. result = result * 16 + instr(1, '123456789ABCDEF', mid($ARGS[1], shortgs_i, 1))
  1022. shortgs_i += 1
  1023. if shortgs_i <= len($ARGS[1]): jump 'hex_to_int_loop'
  1024. killvar 'shortgs_i'
  1025. end
  1026. !! converts ABGR integer (generated by rgb() func) to hex string
  1027. !! OMITS ALPHA CHANNEL
  1028. ! use: func('shortgs', 'rgb_to_hex', number)
  1029. ! example: func('shortgs', 'rgb_to_hex', bcolor)
  1030. ! example: func('shortgs', 'rgb_to_hex', lcolor)
  1031. if $ARGS[0] = 'rgb_to_hex':
  1032. $result = func('shortgs', 'int_to_hex_str', (ARGS[1] and 16711680) / 65536)
  1033. $result = mid('00', 1, 2 - len($result)) + $result
  1034. $result = func('shortgs', 'int_to_hex_str', (ARGS[1] and 65280) / 256) + $result
  1035. $result = mid('0000', 1, 4 - len($result)) + $result
  1036. $result = func('shortgs', 'int_to_hex_str', (ARGS[1] and 255)) + $result
  1037. $result = '#' + mid('000000', 1, 6 - len($result)) + $result
  1038. end
  1039. !! Inverts a hexidecimal color (f.e. #31A4E2)
  1040. !! func('shortgs', 'invert_color', $color)
  1041. !! if you want to get either white or black, furthest away from the given color. Use:
  1042. !! func('shortgs', 'invert_color', $color, 'bw')
  1043. !! https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
  1044. if $ARGS[0] = 'invert_color':
  1045. if $ARGS[2] = 'bw':
  1046. if func('shortgs', 'color_is_dark', $ARGS[1]) = 1:
  1047. $result = '#FFFFFF'
  1048. else
  1049. $result = '#000000'
  1050. end
  1051. else
  1052. $ARGS[1] = ucase(replace(trim($ARGS[1]), '#'))
  1053. shortgs_r = 255 - func('shortgs', 'hex_str_to_int', mid($ARGS[1], 1, 2))
  1054. shortgs_g = 255 - func('shortgs', 'hex_str_to_int', mid($ARGS[1], 3, 2))
  1055. shortgs_b = 255 - func('shortgs', 'hex_str_to_int', mid($ARGS[1], 5, 2))
  1056. $shortgs_r = func('shortgs', 'int_to_hex_str', shortgs_r)
  1057. $shortgs_g = func('shortgs', 'int_to_hex_str', shortgs_g)
  1058. $shortgs_b = func('shortgs', 'int_to_hex_str', shortgs_b)
  1059. $shortgs_r = mid('0' + $shortgs_r, len($shortgs_r), 2)
  1060. $shortgs_g = mid('0' + $shortgs_g, len($shortgs_g), 2)
  1061. $shortgs_b = mid('0' + $shortgs_b, len($shortgs_b), 2)
  1062. $result = '#' + $shortgs_r + $shortgs_g + $shortgs_b
  1063. killvar 'shortgs_r'
  1064. killvar 'shortgs_g'
  1065. killvar 'shortgs_b'
  1066. end
  1067. end
  1068. if $ARGS[0] = 'color_is_dark':
  1069. $ARGS[1] = ucase(replace(trim($ARGS[1]), '#'))
  1070. shortgs_cid_r = func('shortgs', 'hex_str_to_int', mid($ARGS[1], 1, 2))
  1071. shortgs_cid_g = func('shortgs', 'hex_str_to_int', mid($ARGS[1], 3, 2))
  1072. shortgs_cid_b = func('shortgs', 'hex_str_to_int', mid($ARGS[1], 5, 2))
  1073. result = 2126 * shortgs_r * shortgs_r + 7152 * shortgs_g * shortgs_g + 722 * shortgs_b * shortgs_b
  1074. result = iif(result > 136315346, 0, 1)
  1075. killvar 'shortgs_cid_r'
  1076. killvar 'shortgs_cid_g'
  1077. killvar 'shortgs_cid_b'
  1078. end
  1079. !! func('shortgs', 'enumerate_list', '$arrname', {start}, {number}, {oxford_comma})
  1080. !! returns a string with the array entries listed:
  1081. !! $arr[0] = 'Sidisi' -> returns: 'Sidisi'
  1082. !! $arr[1] = 'Eriette' -> returns: 'Sidisi and Eriette'
  1083. !! $arr[2] = 'Dynaheir' -> returns: 'Sidisi, Eriette, and Dynaheir'
  1084. !!
  1085. !! ARGS[2] indicates where the enumeration start (Defaults to the first item)
  1086. !! ARGS[3] indicates how many items are enumerated (Defaults to the end of the list)
  1087. !! $ARGS[4] is the small separator (defaults to ', ')
  1088. !! $ARGS[5] is the final separator for 2 items (defaults to ' and ')
  1089. !! $ARGS[6] is the final seperator for more items (defaults to ', and ')
  1090. if $ARGS[0] = 'enumerate_list':
  1091. $temp_sgs_text = ''
  1092. $sgs_arrname = $ARGS[1]
  1093. if ARGS[2] = 0:
  1094. temp_sgs_i = 0
  1095. else
  1096. temp_sgs_i = ARGS[2]
  1097. end
  1098. if ARGS[3] = 0:
  1099. temp_sgs_max_i = arrsize($sgs_arrname)
  1100. else
  1101. temp_sgs_max_i = temp_sgs_i + ARGS[3]
  1102. if temp_sgs_max_i > arrsize($sgs_arrname): temp_sgs_max_i = arrsize($sgs_arrname)
  1103. end
  1104. if $ARGS[4] = '':
  1105. $temp_sgs_sep[0] = ', '
  1106. else
  1107. $temp_sgs_sep[0] = $ARGS[4]
  1108. end
  1109. if $ARGS[5] = '':
  1110. $temp_sgs_sep[1] = ' and '
  1111. else
  1112. $temp_sgs_sep[1] = $ARGS[5]
  1113. end
  1114. if $ARGS[6] = '':
  1115. $temp_sgs_sep[2] = ', and '
  1116. else
  1117. $temp_sgs_sep[2] = $ARGS[6]
  1118. end
  1119. if temp_sgs_max_i = 0:
  1120. !!empty on purpose
  1121. elseif temp_sgs_max_i = 1:
  1122. dynamic '$temp_sgs_text = <<$sgs_arrname>>[0]'
  1123. elseif temp_sgs_max_i = 2:
  1124. dynamic '$temp_sgs_text = <<$sgs_arrname>>[0] + <<$temp_sgs_sep[1]>> + <<$sgs_arrname>>[1]'
  1125. else
  1126. temp_sgs_i = 0
  1127. :sgs_enum_list
  1128. dynamic '$temp_sgs_text += <<$sgs_arrname>>[<<temp_sgs_i>>]'
  1129. temp_sgs_i += 1
  1130. if temp_sgs_i < temp_sgs_max_i - 1: $temp_sgs_text += $temp_sgs_sep[0] & jump 'sgs_enum_list'
  1131. dynamic '$temp_sgs_text += <<$temp_sgs_sep[2]>> + <<$sgs_arrname>>[<<temp_sgs_i>>]'
  1132. killvar 'temp_sgs_i'
  1133. end
  1134. $result = $temp_sgs_text
  1135. killvar '$temp_sgs_text'
  1136. killvar '$sgs_arrname'
  1137. killvar 'temp_sgs_max_i'
  1138. end
  1139. if $ARGS[0] = 'get_number_suffix':
  1140. !! Get the selected day and apply an appropriate suffix - takes a valid day int from ARGS[1]
  1141. if ARGS[1] < 0:
  1142. query_day = (-ARGS[1]) mod 100
  1143. else
  1144. query_day = ARGS[1] mod 100
  1145. end
  1146. if query_day => 4 and query_day <= 20:
  1147. $result = 'th'
  1148. elseif query_day mod 10 = 1:
  1149. $result = 'st'
  1150. elseif query_day mod 10 = 2:
  1151. $result = 'nd'
  1152. elseif query_day mod 10 = 3:
  1153. $result = 'rd'
  1154. else
  1155. $result = 'th'
  1156. end
  1157. killvar 'query_day'
  1158. end
  1159. if $ARGS[0] = 'convert_dob':
  1160. !! Calculate NPC birthday and convert to human readable format
  1161. temp_npc_birthday = (npc_dob['A<<ARGS[1]>>'] mod 100)
  1162. $temp_day_suffix = func('shortgs', 'get_number_suffix', birthday)
  1163. temp_npc_birthmonth = (npc_dob['A<<ARGS[1]>>'] / 100) mod 100
  1164. temp_npc_birthyear = npc_dob['A<<ARGS[1]>>'] / 10000
  1165. $result = '<<birthday>><<$temp_day_suffix>> ' + $monthName[birthmonth]+ ', ' + temp_npc_birthyear
  1166. killvar 'temp_npc_birthday'
  1167. killvar 'temp_npc_birthmonth'
  1168. killvar 'temp_npc_birthyear'
  1169. killvar 'temp_day_suffix'
  1170. end
  1171. --- shortgs ---------------------------------