12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292 |
- # shortgs
- !! make an autosave unless it is disabled
- if $ARGS[0] = 'autosave':
- if disable_autosave = 0:
- if mid($start_type, 1, 4) = 'city':
- savegame 'autosave_city_<<$week[week]>>.sav'
- elseif mid($start_type, 1, 3) = 'uni':
- savegame 'autosave_uni_<<$week[week]>>.sav'
- else
- savegame 'autosave_sg_<<$week[week]>>.sav'
- end
- end
- end
- !! following function counts the number of guys which PC slept with.
- !! use func('shortgs','guy') or func('shortgs','guy',X) for subset (X can be 'A','B','C','AB','AC','BC')
- if $ARGS[0] = 'guy':
- r_sht=0
- if $ARGS[1] = '': $temptask = 'ABC' else $temptask = $ARGS[1]
- :loop_shtty
- $temptaskchar = mid($temptask,1,1)
- $temptask = mid($temptask,2,len($temptask)-1)
- s_sht=0
- :loop_shya
- if s_sht<=dyneval("result = <<$temptaskchar>>arraynumber"):
- s_sht += 1
- if npc_sex['<<$temptaskchar>><<s_sht>>'] > 0: r_sht = r_sht + iif(npc_gender['<<$temptaskchar>><<s_sht>>'] = 0,1,0)
- jump 'loop_shya'
- end
- if len($temptask) > 0:jump 'loop_shtty'
- result = r_sht
- killvar 'r_sht'
- killvar '$temptask'
- killvar '$temptaskchar'
- killvar 's_sht'
- end &! --- guy ---
- !! following function counts the number of girls which PC slept with.
- !! use func('shortgs','girl') or func('shortgs','girl',X) for subset (X can be 'A','B','C','AB','AC','BC')
- if $ARGS[0] = 'girl':
- r_sht=0
- if $ARGS[1] = '': $temptask = 'ABC' else $temptask = $ARGS[1]
- :loop_shttl
- $temptaskchar = mid($temptask,1,1)
- $temptask = mid($temptask,2,len($temptask)-1)
- s_sht=0
- :loop_shl
- if s_sht<=dyneval("result = <<$temptaskchar>>arraynumber"):
- s_sht += 1
- if npc_sex['<<$temptaskchar>><<s_sht>>'] > 0: r_sht = r_sht + iif(npc_gender['<<$temptaskchar>><<s_sht>>'] = 1,1,0)
- jump 'loop_shl'
- end
- if len($temptask) > 0: jump 'loop_shttl'
- result = r_sht
- killvar 'r_sht'
- killvar '$temptask'
- killvar '$temptaskchar'
- killvar 's_sht'
- end &! --- girl ---
- !! following procedure should be used when PC gets naked, but it should be paired with the reverse procedure
- !! use gs 'shortgs','undress'
- if $ARGS[0] = 'undress':
- gs 'underwear', 'remove'
- gs 'clothing','strip'
- end &! --- undress ---
- !! reverse procedure, it can be modified for lose or stolen panties later.
- !! use gs 'shortgs','dress'
- if $ARGS[0] = 'dress':
- gs 'clothing','wear_last_worn'
- gs 'underwear', 'wear'
- end &! --- dress ---
- !! procedure, which prevents PC to leave a room naked.
- !! use gs 'shortgs','checkdress',' <<$loc>>,<<$loc_arg>> ' or equivalent
- if $ARGS[0] = 'checkdress':
- if $clothingworntype = 'nude':
- msg '<b><font color="red">You need to get dressed before going out.</font></b>'
- dynamic 'gt <<$ARGS[1]>>'
- end
- end &! --- checkdress ---
- !! this is an integer sqrt function
- !! call func('shortgs','sqrt', n)
- if $ARGS[0] = 'sqrt':
- sqrtnum = ARGS[1]
- if sqrtnum = 0: result = 0 & exit
- sqrtn = sqrtnum/2 + 1
- sqrtn1 = (sqrtn + sqrtnum / sqrtn) / 2
- :sqrtloop
- if sqrtn1 < sqrtn:
- sqrtn = sqrtn1
- sqrtn1 = (sqrtn + sqrtnum / sqrtn) / 2
- jump 'sqrtloop'
- end
- result = sqrtn
- end
- !! this function calculates modul of given arguments as it was coordinates in cartezian systeme
- !! use func('shortgs','modul',n1,n2,..n8)
- if $ARGS[0] = 'modul':
- 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]
- result = func('shortgs','sqrt',modul_sum)
- killvar 'modul_sum'
- end
- !! day of week 1 - Monday .. 7 - Sunday
- if $ARGS[0] = 'dow':
- if ARGS[1]=0:
- D_dow = day
- M_dow = month
- Y_dow = year
- else
- D_dow = ARGS[3]
- M_dow = ARGS[2]
- Y_dow = ARGS[1]
- end
- dow_a = (14 - M_dow) / 12
- dow_Y = Y_dow - dow_a
- dow_M = M_dow + 12*dow_a - 2
- dummy = (D_dow + dow_y + dow_y/4 - dow_y/100 + dow_y/400 + (31*dow_m)/12) mod 7
- if dummy = 0: dummy = 7
- result = dummy
- end
- !! day of year
- !! use xdoy = func('shortgs','doy',year,month,day)
- !! https://astronomy.stackexchange.com/questions/2407/calculate-day-of-the-year-for-a-given-date
- if $ARGS[0] = 'doy':
- doy_N1 = 275 * ARGS[2] / 9
- doy_N2 = (ARGS[2] + 9) / 12
- doy_N3 = 1 + (ARGS[1] - 4 * (ARGS[1] / 4) + 2) / 3
- result = doy_N1 - (doy_N2 * doy_N3) + ARGS[3] - 30
- end
- if $ARGS[0] = 'mk1':
- gs 'saveposition'
- *clr & cla
- $mk_subst['0'] = 'M' & $mk_subst['1'] = 'F' & $mk_subst['2'] = 'O' & $mk_subst['3'] = 'L' & $mk_subst['4'] = 'R' & $mk_subst['5'] = 'P'
- '<center><font face="courier" size=1>'
- '<table border = 1>'
- '<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>
- <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>'
- i = ArrSize('$MenCal')
- empty0 = week + 29 - i - 1
- empty1 = min(28,empty0)
- full1 = max(0,28 - empty0)
- empty2 = max(0,empty0-28)
- full2 = i - full1
- empty3 = 28 - empty2 - full2
- count=0
- $tabmc = '<tr>'
- :tabmcl1
- if empty1 > 0: empty1 -=1 & $tabmc +='<td> </td>' & jump 'tabmcl1'
- :tabmcl2
- if full1 > 0:
- full1 -=1
- if $MenCal[count]='0': $tabmc +='<td bgcolor="red"><<$mk_subst[$MenCal[count]]>></td>' else $tabmc +='<td><<$mk_subst[$MenCal[count]]>></td>'
- count +=1
- jump 'tabmcl1'
- end
- $tabmc += '</tr><tr>'
- :tabmcl3
- if empty2 > 0: empty2 -=1 & $tabmc +='<td> </td>' & jump 'tabmcl3'
- :tabmcl4
- if full2 > 0:
- full2 -=1
- if $MenCal[count]='0': $tabmc +='<td bgcolor="red"><<$mk_subst[$MenCal[count]]>></td>' else $tabmc +='<td><<$mk_subst[$MenCal[count]]>></td>'
- count +=1
- jump 'tabmcl4'
- end
- :tabmcl5
- if empty3 > 0: empty3 -=1 & $tabmc +='<td></td>' & jump 'tabmcl5'
- $tabmc += '</tr><table></font></center>'
- $tabmc
- act 'Back': gt 'restoreposition'
- end
- !! use gs 'shortgs','mk'
- if $ARGS[0] = 'mk':
- gs 'saveposition'
- *clr & cla
- copyarr '$MenCalCopy','$MenCal'
- length_of_month_field = arrsize('$MenCalCopy')
- if daystart - firstmens > 40:
- mensnotfound = 1
- i = 0
- :tabmcfm
- if $MenCalCopy[length_of_month_field-i] = '0' and $MenCalCopy[length_of_month_field-i-1] = '3': mensnotfound = 0
- i += 1
- if i < length_of_month_field and mensnotfound = 1: jump 'tabmcfm'
- if mensnotfound = 0:
- firstmens = daystart - i + 1
- end
- end
- i=1
- :tabmcc1
- if daystart - firstmens < 40:
- if (daystart - firstmens + i) = 28:
- $MenCalCopy[] = ' bgcolor="#df2020"'
- elseif (daystart - firstmens + i) = 29:
- $MenCalCopy[] = ' bgcolor="#df3030"'
- elseif (daystart - firstmens + i) = 30:
- $MenCalCopy[] = ' bgcolor="#df4040"'
- elseif (daystart - firstmens + i) = 12:
- $MenCalCopy[] = ' bgcolor="#d8ff00"'
- elseif (daystart - firstmens + i) = 13:
- $MenCalCopy[] = ' bgcolor="#d0ff00"'
- elseif (daystart - firstmens + i) = 14:
- $MenCalCopy[] = ' bgcolor="#c8ff00"'
- elseif (daystart - firstmens + i) = 15:
- $MenCalCopy[] = ' bgcolor="#c0ff00"'
- elseif (daystart - firstmens + i) = 16:
- $MenCalCopy[] = ' bgcolor="#d0ff00"'
- elseif (daystart - firstmens + i) = 12+28:
- $MenCalCopy[] = ' bgcolor="#d8ff00"'
- elseif (daystart - firstmens + i) = 13+28:
- $MenCalCopy[] = ' bgcolor="#d0ff00"'
- elseif (daystart - firstmens + i) = 14+28:
- $MenCalCopy[] = ' bgcolor="#c8ff00"'
- elseif (daystart - firstmens + i) = 15+28:
- $MenCalCopy[] = ' bgcolor="#c0ff00"'
- elseif (daystart - firstmens + i) = 16+28:
- $MenCalCopy[] = ' bgcolor="#d0ff00"'
- else
- $MenCalCopy[] = ''
- end
- i += 1
- if i < 40: jump 'tabmcc1'
- end
- i = length_of_month_field
- :tabmcc2
- if i > 0:
- if $MenCalCopy[i-1] = '2' and i = 1 : $MenCalCopy[i-1] = ' bgcolor="#c0ff00"'
- if $MenCalCopy[i-1] = '2' and $MenCalCopy[i-2] = '2': $MenCalCopy[i-1] = ' bgcolor="#c0ff00"'
- 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"'
- if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) < 12: $MenCalCopy[i-1] =''
- if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 12: $MenCalCopy[i-1] =' bgcolor="#b0ff00"'
- if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 13: $MenCalCopy[i-1] =' bgcolor="#a0ff00"'
- if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 14: $MenCalCopy[i-1] =' bgcolor="#90ff00"'
- if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) = 15: $MenCalCopy[i-1] =' bgcolor="#80ff00"'
- if $MenCalCopy[i-1] = '1' and (daystart - firstmens - length_of_month_field + i) > 15: $MenCalCopy[i-1] =''
- if $MenCalCopy[i-1] = '0': $MenCalCopy[i-1] =' bgcolor="#df2020"'
- if $MenCalCopy[i-1] = '3': $MenCalCopy[i-1] =''
- if $MenCalCopy[i-1] = '4': $MenCalCopy[i-1] =''
- if $MenCalCopy[i-1] = '5': $MenCalCopy[i-1] =''
- if $MenCalCopy[i-1] = '6': $MenCalCopy[i-1] =''
- i -= 1
- jump 'tabmcc2'
- end
- cur_day_doy = func('shortgs','doy',year,month,day)
- if month = 1:
- dif_days = cur_day_doy + 30
- prev_month = 12
- prev_month_length = 31
- else
- prev_month = month - 1
- dif_days = cur_day_doy - func('shortgs','doy',year,prev_month,1)
- prev_month_length = func('shortgs','doy',year,month,1) - func('shortgs','doy',year,prev_month,1)
- end
- first_month_first_day_week = week - (dif_days mod 7)
- first_month_first_day_index = length_of_month_field -1 - dif_days
- r = first_month_first_day_index
- if first_month_first_day_week < 1: first_month_first_day_week += 7
- i = 42
- :tabmc21
- $mk1_mdays[] = ' ' & i -= 1 & if i > 0: jump 'tabmc21'
- i = 0
- :tabmc21a
- $mk1_mdays[i+first_month_first_day_week-1] = $str(i+1)
- i += 1
- if i < prev_month_length: jump 'tabmc21a'
- $prev_month_name = $mid($monthName[prev_month],1,1) + '<br>' + $mid($monthName[prev_month],2,1) + '<br>' + $mid($monthName[prev_month],3,1)
- k = 0
- $tabmc ='<center><font face="courier" size=5>'
- $tabmc +='<table border = 1 cellspacing="0" cellpadding="5">'
- $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>'
- month_weeks = (first_month_first_day_week + prev_month_length + 5)/7 - 1
- i = month_weeks
- :tabmc22
- $tabmc +='<tr>'
- j = 7
- if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$prev_month_name>></td>'
- :tabmc23
- if j > 0:
- j -=1
- if $mk1_mdays[k]=' ':
- $tabmc +='<td><<$mk1_mdays[k]>></td>'
- else
- $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
- r +=1
- end
- k +=1
- jump 'tabmc23' & !<<$MenCalCopy[r]>>
- end
- if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc22'
- killvar '$mk1_mdays'
- killvar '$mk1_mdays_color'
- !! current month
- if month = 12:
- dif_days = day - 1
- cur_month = month
- cur_month_length = 31
- else
- dif_days = day - 1
- cur_month_length = func('shortgs','doy',year,month+1,1) - func('shortgs','doy',year,month,1)
- end
- second_month_first_day_week = week - (dif_days mod 7)
- second_month_first_day_index = length_of_month_field -1 - dif_days
- if second_month_first_day_week < 1: second_month_first_day_week += 7
- i = 42
- :tabmc31
- $mk1_mdays[] = ' ' & i -= 1 & if i > 0: jump 'tabmc31'
- i = 0
- :tabmc31a
- $mk1_mdays[i+second_month_first_day_week-1] = $str(i+1)
- i += 1
- if i < cur_month_length: jump 'tabmc31a'
- $cur_month_name = $mid($monthName[month],1,1) + '<br>' + $mid($monthName[month],2,1) + '<br>' + $mid($monthName[month],3,1)
- k = 0
- month_weeks = (second_month_first_day_week + cur_month_length + 5)/7 - 1
- i = month_weeks
- :tabmc32
- $tabmc +='<tr>'
- j = 7
- if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$cur_month_name>></td>'
- :tabmc33
- if j > 0:
- j -=1
- if $mk1_mdays[k]=' ':
- $tabmc +='<td><<$mk1_mdays[k]>></td>'
- else
- 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>'
- r +=1
- end
- k +=1
- jump 'tabmc33'
- end
- if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc32'
- killvar '$mk1_mdays'
- killvar '$mk1_mdays_color'
- !! next month
- if month = 12:
- dif_days = 31 - day + 1
- next_month = 1
- next_month_length = 31
- elseif month = 11:
- dif_days = 30 - day + 1
- next_month = 12
- next_month_length = 31
- else
- next_month = month + 1
- dif_days = cur_month_length - day + 1
- next_month_length = func('shortgs','doy',year,month+2,1) - func('shortgs','doy',year,month+1,1)
- end
- next_month_first_day_week = week + (dif_days mod 7)
- next_month_first_day_index = length_of_month_field -1 - dif_days
- if next_month_first_day_week < 1: next_month_first_day_week += 7
- i = 35
- :tabmc41
- $mk1_mdays[] = ' ' & i -= 1 & if i > 0: jump 'tabmc41'
- i = 0
- :tabmc41a
- $mk1_mdays[i+next_month_first_day_week-1] = $str(i+1)
- !! 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]]
- i += 1
- if i < next_month_length: jump 'tabmc41a'
- $next_month_name = $mid($monthName[next_month],1,1) + '<br>' + $mid($monthName[next_month],2,1) + '<br>' + $mid($monthName[next_month],3,1)
- k = 0
- month_weeks = (next_month_first_day_week + next_month_length + 5)/7 - 1
- i = month_weeks
- :tabmc42
- $tabmc +='<tr>'
- j = 7
- if i = month_weeks:$tabmc +='<td rowspan="<<month_weeks+1>>" align = "center"><<$next_month_name>></td>'
- :tabmc43
- if j > 0:
- j -=1
- if $mk1_mdays[k]=' ':
- $tabmc +='<td><<$mk1_mdays[k]>></td>'
- else
- $tabmc +='<td<<$MenCalCopy[r]>> ><<$mk1_mdays[k]>></td>'
- r +=1
- end
- k +=1
- jump 'tabmc43'
- end
- if i > 0: i -=1 & $tabmc +='</tr>' & jump 'tabmc42'
- killvar '$mk1_mdays'
- $tabmc += '</tr><table></font></center>'
- $tabmc
- act 'Back': gt 'restoreposition'
- end
- !! gs 'shortgs','fonts'
- if $ARGS[0] = 'fonts':
- if $ARGS[1] = 'refresh':
- jump 'fontsloop'
- else
- $dynamicreturn = $ARGS[1]
- $OpenPhraseSave = $ARGS[2]
- $ClosePhraseSave = $ARGS[3]
- end
- gs 'saveposition'
- $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'
- $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'
- i = 15
- :fontsloop0
- if $CurFont = $fontlist[i]: curfont = i
- if $CurColor = $fontcolor[i]: curcolor = i
- i -= 1
- if i > 0: jump 'fontsloop0'
- jump 'fontsloop1'
- :fontsloop
- $OpenPhrase = '<font size="<<CurFontSize>>" color="<<$CurColor>>" face="<<$CurFont>>" >'+$CurBold+$CurItalic
- $ClosePhrase = $CurItalicBack+$CurBoldBack+'</font>'
- :fontsloop1
- *clr & cla
- $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
- '<a href="exec: curfont = (curfont + 1) mod 16 & $CurFont = $fontlist[curfont] & gs ''shortgs'',''fonts'',''refresh'' ">Change the Font</a>'
- '<a href="exec: curcolor = (curcolor + 1) mod 16 & $CurColor = $fontcolor[curcolor] & gs ''shortgs'',''fonts'',''refresh'' ">Change the Color</a>'
- '<a href="exec:$CurBold = iif($CurBold ! ''<b>'',''<b>'','' '') & $CurBoldBack = iif($CurBold = ''<b>'',''</b>'','' '') & gs ''shortgs'',''fonts'',''refresh'' ">Change the BoldState</a>'
- '<a href="exec:$CurItalic = iif($CurItalic ! ''<i>'',''<i>'','' '') & $CurItalicBack = iif($CurItalic = ''<i>'',''</i>'','' '') & gs ''shortgs'',''fonts'',''refresh'' ">Change the ItalicState</a>'
- '<a href="exec:CurfontSize -= 1 & gs ''shortgs'',''fonts'',''refresh'' ">Decrease the Font</a>   <a href="exec:CurfontSize += 1 & gs ''shortgs'',''fonts'',''refresh'' ">Increase the font</a>'
- act 'Back':
- killvar '$fontlist'
- killvar '$fontcolor'
- dynamic '<<$OpenPhraseSave>> = $OpenPhrase'
- dynamic '<<$ClosePhraseSave>> = $ClosePhrase'
- if $dynamicreturn ! '': dynamic 'dynamic <<$dynamicreturn>>'
- gt 'restoreposition'
- end
- end
- !! use gs 'shortgs','ncp_update'
- if $ARGS[0] = 'ncp_update':
- copyarr 'copy_npc_QW','npc_QW'
- copyarr 'copy_npc_rel','npc_rel'
- copyarr 'copy_npc_love','npc_love'
- copyarr '$copy_npc_usedname','$npc_usedname'
- gs 'npcstatic1'
- gs 'npcstatic2'
- gs 'npcstatic3'
- gs 'npcstatic4'
- gs 'npcstatic5'
- gs 'npcstatic6'
- i = arrsize('copy_npc_QW')
- j = 1
- :loopnpcupdate
- $boy = 'A<<j>>'
- npc_QW[$boy] = copy_npc_QW[$boy]
- npc_rel[$boy] = copy_npc_rel[$boy]
- npc_love[$boy] = copy_npc_love[$boy]
- $npc_usedname[$boy] = $copy_npc_usedname[$boy]
- j += 1
- if j <= i: jump 'loopnpcupdate'
- killvar 'copy_npc_QW'
- killvar 'copy_npc_rel'
- killvar 'copy_npc_love'
- killvar '$copy_npc_usedname'
- end
- !! this function returns the numeric index of the array element which is indexed by string value.
- !! call func('shortgs', 'get_me_index', 'name of array','string index')
- !! 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.
- !! if the array consists such value, the fuction can mess the array content and return wrong value
- !! changed the value for detecting numeric element from -999 to -2147483648 (November 2020)
- if $ARGS[0] = 'get_me_index':
- $test = '<<$ARGS[1]>>[''<<$ARGS[2]>>'']'
- testas0 = arrsize('<<$ARGS[1]>>')
- if $mid($test,1,1)='$':
- $temp=dyneval('$result=<<$test>>')
- dynamic '<<$test>> = ''SearchTag'' '
- testas1 = arrsize('<<$ARGS[1]>>')
- if testas0 = testas1:
- res = dyneval('result = arrpos(''<<$ARGS[1]>>'',''SearchTag'')')
- dynamic '<<$test>> = $temp'
- else
- res = -1
- killvar '<<$ARGS[1]>>',testas0
- end
- else
- temp=dyneval('result=<<$test>>')
- dynamic '<<$test>> = -2147483648'
- testas1 = arrsize('<<$ARGS[1]>>')
- if testas0 = testas1:
- res = dyneval('result = arrpos(''<<$ARGS[1]>>'',-2147483648)')
- dynamic '<<$test>> = <<temp>>'
- else
- res = -1
- killvar '<<$ARGS[1]>>',testas0
- end
- end
- result = res
- end
- !! call gs 'shortgs', 'remove_array_element', 'name of array','string index'
- if $ARGS[0] = 'remove_array_element':
- killvar '<<$ARGS[1]>>',func('shortgs', 'get_me_index', $ARGS[1],$ARGS[2])
- end
- if $ARGS[0] = 'testsize':
- '$npc_dna = ' + arrsize('$npc_dna')
- '$npc_firstname = ' + arrsize('$npc_firstname')
- '$npc_lastname = ' + arrsize('$npc_lastname')
- '$npc_nickname = ' + arrsize('$npc_nickname')
- '$npc_notes = ' + arrsize('$npc_notes')
- '$npc_occupation = ' + arrsize('$npc_occupation')
- '$npc_perstype = ' + arrsize('$npc_perstype')
- '$npc_pic = ' + arrsize('$npc_pic')
- '$npc_thdick = ' + arrsize('$npc_thdick')
- '$npc_usedname = ' + arrsize('$npc_usedname')
- 'npc_apprnc = ' + arrsize('npc_apprnc')
- 'npc_bust = ' + arrsize('npc_bust')
- 'npc_outfit = ' + arrsize('npc_outfit')
- 'npc_style = ' + arrsize('npc_style')
- 'npc_dick = ' + arrsize('npc_dick')
- 'npc_dob = ' + arrsize('npc_dob')
- 'npc_drunk = ' + arrsize('npc_drunk')
- 'npc_gender = ' + arrsize('npc_gender')
- 'npc_haircol = ' + arrsize('npc_haircol')
- 'npc_height = ' + arrsize('npc_height')
- 'npc_horny = ' + arrsize('npc_horny')
- 'npc_intel = ' + arrsize('npc_intel')
- 'npc_love = ' + arrsize('npc_love')
- 'npc_QW = ' + arrsize('npc_QW')
- 'npc_rel = ' + arrsize('npc_rel')
- 'npc_sex = ' + arrsize('npc_sex')
- 'npc_sexskill = ' + arrsize('npc_sexskill')
- 'npc_spermpot = ' + arrsize('npc_spermpot')
- 'npc_herpes = ' + arrsize('npc_herpes')
- 'npc_syth = ' + arrsize('npc_syth')
- 'npc_gon = ' + arrsize('npc_gon')
- 'npc_thrush = ' + arrsize('npc_thrush')
- 'npc_apt_type = ' + arrsize('npc_apt_type')
- 'npc_apt_number = ' + arrsize('npc_apt_number')
- '$npc_apt_bedroom = ' + arrsize('$npc_apt_bedroom')
- '$npc_apt_kitchen = ' + arrsize('$npc_apt_kitchen')
- '$npc_apt_livingroom = ' + arrsize('$npc_apt_livingroom')
- '$npc_apt_bathroom = ' + arrsize('$npc_apt_bathroom')
- 'npc_perv = ' + arrsize('npc_perv')
- 'npc_finance = ' + arrsize('npc_finance')
- 'npc_humor = ' + arrsize('npc_humor')
- 'npc_fav_pos = ' + arrsize('npc_fav_pos')
- 'npc_tit_pref = ' + arrsize('npc_tit_pref')
- 'npc_addit = ' + arrsize('npc_addit')
- 'npc_doors = ' + arrsize('npc_doors')
- 'npc_goal = ' + arrsize('npc_goal')
- 'npc_fidelity = ' + arrsize('npc_fidelity')
- 'npc_lover_days = ' + arrsize('npc_lover_days')
- 'npc_lover_keys = ' + arrsize('npc_lover_keys')
- '$npc_index = ' + arrsize('$npc_index')
- end
- if $ARGS[0] = 'npctest':
- ' --- init --- '
- gs 'shortgs', 'testsize'
- gs 'npcgeneratec', 0, 'stranger', rand(18,45),1
- $npc_notes[$npclastgenerated]
- $npclastgenerated
- ' --- gen npc C --- '
- gs 'shortgs', 'testsize'
- gs 'npcpreservec', $npclastgenerated
- $npc_notes[$npclastsaved]
- $npclastsaved
- ' --- sav npc C to npc B --- '
- gs 'shortgs', 'testsize'
- gs 'npccleanc',$npclastsaved
- ' --- delete npc B --- '
- gs 'shortgs', 'testsize'
- end
- if $ARGS[0] = 'replace header':
- wait(ARGS[1])
- RH_Count = ARGS[2]
- $RH_temp = $MAINTXT
- :RH_label
- RH_temp_lenght = LEN($RH_temp)
- RH_temp_LFpos = STRPOS($RH_temp,'\n')
- $RH_temp = $MID($RH_temp, RH_temp_LFpos+1, RH_temp_lenght - RH_temp_LFpos)
- RH_Count -=1
- if RH_Count > 0: jump 'RH_label'
- *clr
- $ARGS[3] & $ARGS[4] & $ARGS[5] & $ARGS[6] & $ARGS[7]
- $RH_temp
- killvar '$RH_temp'
- killvar 'RH_Count'
- killvar 'RH_temp_lenght'
- killvar 'RH_temp_LFpos'
- end
- if $ARGS[0]='img msg':
- $shortgstemp = '<center><img height=280 src="<<$ARGS[1]>>"></center>'
- msg $shortgstemp
- killvar '$shortgstemp'
- end
- !! Used for dividing with accurate rounding up/down
- if $ARGS[0] = 'round_divide':
- !! ARGS[1] = value you want divided
- !! ARGS[2] = divider
- !! func('shortgs','round_divide', number, divider)
- !! func('shortgs','round_divide', 12345, 7)
- if ARGS[2] ! 0:
- temp_number = ARGS[1]/ARGS[2]
- 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
- result = temp_number
- killvar 'temp_number'
- else
- msg '<b>Error: No dividing by 0! You trying to make the universe disappear?</b>'
- end
- end
- !! Used for rounding numbers to the nearest multiple of ARGS[2]
- if $ARGS[0] = 'round_tool':
- !! ARGS[1] = value you want rounded
- !! ARGS[2] = nearest multiple to round to
- !! func('shortgs','round_tool', number, multiple)
- !! func('shortgs','round_tool', 12345, 10)
- if ARGS[2] ! 0:
- temp_multiple = ARGS[2]
- result = func('shortgs','round_divide', ARGS[1], ARGS[2]) * temp_multiple
- killvar 'temp_multiple'
- else
- msg '<b>Error: Can''t round to 0!</b>'
- end
- end
- !! Randomly picks one of the items plugged in
- !!
- !! Option 1: (has 6 input limit)
- !! $ARGS[1] = 'string' or 'number' to specify what youre plugging in (can also be blank for numbers)
- !! $ARGS[2-7] = strings or numbers to pick from, limited to 6
- !! Example 1: func('shortgs', 'rand_pick', 'string', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta')
- !! Example 2: func('shortgs', 'rand_pick', '', 2, 3, 5, 7, 11, 13)
- !!
- !! Option 2: (no limitations, has to be delimited)
- !! $ARGS[1] = 'delimit' - used for larger numbers of items to pick from
- !! $ARGS[2] = 'string' or 'number' to specify what youre plugging in (can also be blank for numbers)
- !! $ARGS[3] = Delimited string to parse
- !! $ARGS[4] = Delimiter used (Default = '|' pipe)
- !! Example 1: func('shortgs', 'rand_pick', 'delimit', 'string', 'alpha|beta|gamma|delta|epsilon|zeta')
- !! Example 2: func('shortgs', 'rand_pick', 'delimit', 'number', '1-12-123-1234-12345-123456', '-')
- !! Example 3: func('shortgs', 'rand_pick', 'delimit', '', '0.1.2.3.5.7.11', '.')
- if $ARGS[0] = 'rand_pick':
- if $ARGS[1] = 'delimit':
- if $ARGS[2] = 'string':
- gs 'shortgs', 'parse_string', '$rand_pick_temp', $ARGS[3], $ARGS[4]
- $result = $rand_pick_temp[rand(0, arrsize('$rand_pick_temp')-1)]
- killvar '$rand_pick_temp'
- else
- gs 'shortgs', 'parse_string', 'rand_pick_temp', $ARGS[3], $ARGS[4]
- result = rand_pick_temp[rand(0, arrsize('rand_pick_temp')-1)]
- killvar 'rand_pick_temp'
- end
- else
- if arrsize('ARGS') > 2:
- if $ARGS[1] = 'string':
- $result = $ARGS[rand(2, arrsize('$ARGS')-1)]
- else
- result = ARGS[rand(2, arrsize('ARGS')-1)]
- end
- else
- msg '<b>Error: ''rand_pick'' is missing ARGS</b>'
- end
- end
- end
- !! Parse delimited string into an array
- !! $ARGS[1] = ArrayName (has to include $ for string values)
- !! $ARGS[2] = Delimited string to parse
- !! $ARGS[3] = Delimiter used (Default = '|' pipe)
- !! Example 1: gs 'shortgs', 'parse_string', '$my_array', 'alpha|beta|gamma|delta|epsilon|zeta'
- !! Example 2: gs 'shortgs', 'parse_string', 'my_array', '1-12-123-1234-12345-123456', '-'
- if $ARGS[0] = 'parse_string':
- !! Some failsafes (blank array name, blank string or no delimiters in string)
- if $ARGS[1] ! '':
- if $ARGS[2] ! '' and instr($ARGS[2],iif($ARGS[3] = '', '|', $ARGS[3])) > 0:
- !! Set delimiter with default if needed
- if $ARGS[3] = '':
- $ParserTmpDelim = '|'
- else
- $ParserTmpDelim = $ARGS[3]
- end
- !! Clear temp array if needed
- killvar 'ParserTmpArr' & killvar '$ParserTmpArr'
- $ParserTmpStr = $ARGS[2]
- !! Loop through string until no more delimiters found
- :StringParser01
- ParserTmpIdx = instr($ParserTmpStr, $ParserTmpDelim)
- if ParserTmpIdx > 0:
- if mid($ARGS[1],1,1) = '$':
- $ParserTmpArr[] = mid($ParserTmpStr, 1, ParserTmpIdx-1)
- $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)
- else
- ParserTmpArr[] = val(mid($ParserTmpStr, 1, ParserTmpIdx-1))
- $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)
- end
- jump 'StringParser01'
- !! Get last part since no more delimiters were found and copy to the final array
- elseif mid($ARGS[1],1,1) = '$':
- $ParserTmpArr[] = $ParserTmpStr
- copyarr $ARGS[1], '$ParserTmpArr'
- else
- ParserTmpArr[] = val($ParserTmpStr)
- copyarr $ARGS[1], 'ParserTmpArr'
- end
- killvar '$ParserTmpDelim'
- killvar '$ParserTmpStr'
- killvar 'ParserTmpIdx'
- killvar 'ParserTmpArr'
- else
- msg '<b>Error: No delimited string found!</b>'
- end
- else
- msg '<b>Error: No array name found!</b>'
- end
- end
- if $ARGS[0] = 'clothing_state':
- if PCloswimwear = 1:
- 'You are wearing swimwear.'
- elseif PCloSport = 1:
- 'You are wearing gym clothing and shoes.'
- elseif $clothingworntype = 'nude' and $braworntype = 'none' and $pantyworntype = 'none':
- 'You are naked.'
- elseif $clothingworntype = 'nude' and $braworntype = 'none':
- 'You are just wearing panties.'
- elseif $clothingworntype = 'nude' and $pantyworntype = 'none':
- 'You are just wearing a bra.'
- elseif $clothingworntype = 'nude':
- 'You are in your underwear.'
- elseif $braworntype = 'none' and $pantyworntype = 'none' and PCloPanties ! 1 and PCloBra = 0:
- 'You are not wearing any underwear.'
- elseif $pantyworntype = 'none' and PCloPanties ! 1:
- 'You are not wearing panties'
- elseif PCloBra = 0:
- 'You are not wearing a bra'
- end
- end
- !! 2024-07-05 clothing_status - fct to determine clothing status
- !! v.01 - Initial release
- if $ARGS[0] = 'clothing_status':
- $apparel['panty'] = ''
- $apparel['bra'] = ''
- $apparel['status'] = ''
- !! Default scene exit checks
- if $pantyworntype = 'none': $apparel['panty'] = 'pantyless'
- if $braworntype = 'none': $apparel['bra'] = 'braless'
- if $clothingworntype = 'nude': $apparel['status'] = 'nude'
- !! Quest related clothing checks
- if $pantyworntype ! 'none' and $braworntype ! 'none': $apparel['status'] = 'underwear'
- if PCloSport = 1: $apparel['status'] = 'sport'
- if $clothingworntype = 'ballet_secrets' and $shoeworntype = 'ballet_secrets': $apparel['status'] = 'dance'
- if $clothingworntype = 'moncheri_gown' and $shoeworntype = 'moncheri_shoes': $apparel['status'] = 'ballgown'
- !! Failsafe
- if apparel['status'] = '':
- if apparel['panty'] ! '':
- apparel['status'] = apparel['panty']
- else
- apparel['status'] = apparel['bra']
- end
- end
- end
- !! Author - Hooded Silence
- !! Date created - 26 Aug 22
- !! Payment system - Used to pay for items in various game locations
- !! v. 02 - Refactoring to make usage simpler using the epayments array
- !! command syntax: gs 'shortgs','payments'
- !! All variabls are initiated at point of origin
- !!
- !! epayments[value] = cost of goods. Required
- !! $epayments[method] = how it''s to be paid cash or card. leave blank for both. Optional
- !! $epayments[description] = Item Description - What's been bought. Required
- !! $epayments[item_variable] = item variable to be purchased to be added to players inventory. Optional.
- !! epayments[quantity] = How many items to be added. Defaults to one - Optional.
- !! $epayments[loc] = Where do you want the character to go to, optional falls back to starting location if set. Optional
- !! $epayments[act] = If there's a specific act to return to. Optional
- !! $epayments[banner] = banner image for the sale. Optional
- !! Optional with no content are ignored.
- !! Use stock image for the purchase screen?
- if $ARGS[0] = 'payments':
- *clr & cla
- if epayments['value'] = 0:
- msg '<b>Error, Cash Value not set.</b>'
- end
- if $epayments['description'] = '':
- msg '<b>Error, Item Description not set.</b>'
- end
- !! Construct payment call
- if $epayments['item_variable'] ! '':
- $construct_cash = '<a href="exec: money -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
- $construct_card = '<a href="exec: karta -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
- else
- $construct_cash = '<a href="exec: $epayments[''method''] = ''cash'' & money -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
- $construct_card = '<a href="exec: $epayments[''method''] = ''card'' & karta -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
- end
- !Use stock image for the purchase screen?
- if $epayments['banner'] ! '':
- '<center><img <<$set_imgh>> src="images/' + $epayments['banner'] + '"></center>'
- end
- if ($epayments['method'] ! 'cash' and $epayments['method'] ! 'card') and (epayments['value'] <= money and epayments['value'] <= karta):
- 'How do you want to pay for the <<$epayments[''description'']>>? <<$construct_cash>> or <<$construct_card>>'
- elseif ($epayments['method'] = 'cash' or $epayments['method'] = '') and epayments['value'] <= money:
- 'Pay for the <<$epayments[''description'']>> with <<$construct_cash>>?'
- elseif ($epayments['method'] = 'card' or $epayments['method'] = '') and epayments['value'] <= karta:
- 'Pay for the <<$epayments[''description'']>> with your <<$construct_card>>?'
- else
- 'You don''t have enough money in your purse or bank account for this item.'
- end
- act 'Cancel Payment': gt $loc, $loc_arg
- end
- !! Payment complete
- if $ARGS[0] = 'paymentcomplete':
- *clr & cla
- 'Thank you for your custom. Please come again!'
- *nl
- 'You paid ' + epayments['value'] + '<b>₽</b>' + iif ($epayments['method'] = 'cash',' in cash', ' with your bank card') + ' for your ' + $epayments['description']
- gs 'stat'
- !! clean up all the variables
- killvar 'construct_cash'
- killvar 'construct_card'
- if $epayments['loc'] ! '':
- act 'Finish payment': gt $epayments['loc'], $epayments['loc_arg']
- else
- act 'Finish Payment': gt $loc, $loc_arg
- end
- end
- if $ARGS[0] = 'calendar_display':
- '<b><<$month>> <<day>></b>'
- '<b><<$week>></b>'
- '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
- end
- if $ARGS[0] = 'day_display':
- '<b><<$week>></b>'
- '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
- end
- if $ARGS[0] = 'time_display':
- '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
- end
- if $ARGS[0] = 'setloc':
- !! Sets the location variables based on $ARGS[1] = loc, $ARGS[2] = loc arg
- !! Primary key
- $prevloc = $loc
- $prevarg = $loc_arg
- $loc = $ARGS[1]
- $menu_loc = $ARGS[1]
- $locM = $ARGS[1]
- !! Secondary key
- $loc_arg = $ARGS[2]
- $menu_arg = $ARGS[2]
- $locM_arg = $ARGS[2]
- end
- !! generates n rand numbers and selects min or max (max for lucky or min for unlucky)
- !! use: func('shortgs' 'roll', 'lucky' x, y, n)
- !! where x and y set range and n sets amount of rolls
- !! example: func('shortgs' 'roll', 'lucky' 0, 5)
- !! example: func('shortgs' 'roll', 'unlucky' 0, 100, 5)
- if $ARGS[0] = 'roll':
- temp_roll = rand(ARGS[2], ARGS[3])
- shortgs_i = 1
- :roll
- temp_rand = rand(ARGS[2], ARGS[3])
- if $ARGS[1] = 'lucky' and temp_rand > temp_roll:
- temp_roll = temp_rand
- elseif $ARGS[1] = 'unlucky' and temp_rand < temp_roll:
- temp_roll = temp_rand
- end
- shortgs_i += 1
- if shortgs_i < ARGS[4]: jump 'roll'
- result = temp_roll
- killvar 'temp_roll'
- killvar 'temp_rand'
- end
- !! limits a number to a range
- !! use: func('shortgs', 'clamp', var, min, max)
- !! returns min if var < min, returns max if var > max
- !! otherwise returns var
- !! example: func('shortgs', 'clamp', var, 0, 100)
- if $ARGS[0] = 'clamp':
- result = min(max(ARGS[1], ARGS[2]), ARGS[3])
- end
- !! sets a stat or attribute level to a number
- !! use: gs 'shortgs', 'setStat', 'stat', number
- !! example: gs 'shortgs', 'setStat', 'stren', 70
- !! example: gs 'shortgs', 'setStat', 'inhib', 10
- if $ARGS[0] = 'setStat':
- temp_input = func('shortgs', 'clamp', ARGS[2], 0, 100)
- if temp_input > 1:
- temp_xpnxt = (func('_difficulty','getexpadj') * 73 * (temp_input - 1) * (temp_input - 1) / 2730) + 1
- else
- temp_xpnxt = temp_input
- end
- !! magik is based on `orgasm` variable thus the need for `_adj`
- if $ARGS[1] = 'magik':
- dynamic "<<$ARGS[1]>>_lvl = temp_input
- <<$ARGS[1]>>_adj = temp_xpnxt - orgasm
- <<$ARGS[1]>>_exp = orgasm + <<$ARGS[1]>>_adj
- <<$ARGS[1]>>_mem = <<$ARGS[1]>>_exp
- <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
- <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
- !! inhib needs its `_flr` set at `_lvl` and not `_lvl / 5`
- elseif $ARGS[1] = 'inhib':
- dynamic "<<$ARGS[1]>>_lvl = temp_input
- <<$ARGS[1]>>_exp = temp_xpnxt
- <<$ARGS[1]>>_mem = temp_xpnxt
- <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
- <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl"
- !! `stren` and `stren_plus` changes should also update strenbuf
- elseif $ARGS[1] = 'stren' or $ARGS[1] = 'stren_plus':
- dynamic "<<$ARGS[1]>>_lvl = temp_input
- <<$ARGS[1]>>_exp = temp_xpnxt
- <<$ARGS[1]>>_mem = temp_xpnxt
- <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
- <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
- strenbuf = stren_lvl + stren_plus_lvl
- gs 'body', 'DailyUpdate'
- elseif $ARGS[1] = 'agil' or $ARGS[1] = 'vital':
- dynamic "<<$ARGS[1]>>_lvl = temp_input
- <<$ARGS[1]>>_exp = temp_xpnxt
- <<$ARGS[1]>>_mem = temp_xpnxt
- <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
- <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5
- <<$ARGS[1]>>buf = <<$ARGS[1]>>_lvl"
- gs 'body', 'DailyUpdate'
- else
- dynamic "<<$ARGS[1]>>_lvl = temp_input
- <<$ARGS[1]>>_exp = temp_xpnxt
- <<$ARGS[1]>>_mem = temp_xpnxt
- <<$ARGS[1]>>_lvlst = <<$ARGS[1]>>_lvl
- <<$ARGS[1]>>_flr = <<$ARGS[1]>>_lvl / 5"
- end
- killvar 'temp_input' & killvar 'temp_xpnxt'
- end
- !! Recursively computes a simple exponent - https://en.wikipedia.org/wiki/Exponentiation_by_squaring
- !! use: func('shortgs', 's_pow', var, exp)
- !! returns var ^ exp
- !! exp must be an integer >= 0
- !! example: func('shortgs', 's_pow', 2, 3)
- if $ARGS[0] = 's_pow':
- if(ARGS[2] > 10) : msg('Warning: s_pow operations with large exponents may cause integer overflows. <<ARGS[1]>> ^ <<ARGS[2]>>')
- if(ARGS[2]) < 0:
- !! n ^(-m) = 0
- msg('Error: s_pow cannot accept negative exponents! <<ARGS[1]>> ^ <<ARGS[2]>>')
- elseif ARGS[2] = 0:
- result = 1
- elseif ARGS[2] = 1:
- result = ARGS[1]
- elseif (ARGS[2] mod 2) = 0:
- result = func('shortgs', 's_pow', ARGS[1] * ARGS[1], ARGS[2] / 2)
- elseif (ARGS[2] mod 2) ! 0:
- result = ARGS[1] * func('shortgs', 's_pow', ARGS[1] * ARGS[1], (ARGS[2] - 1) / 2)
- end
- end
- !! Improved exponent calculation based on - https://en.wikipedia.org/wiki/Exponentiation_by_squaring
- !! use: func('shortgs', 's_pow2', var, exp)
- !! returns var ^exp
- !! if exp < 0, returns 0
- !! example: func('shortgs', 's_pow2', 2, 3) -> 8
- if $ARGS[0] = 's_pow2':
- if ARGS[2] = 0:
- result = 1
- elseif ARGS[2] < 0:
- result = 0
- elseif ARGS[2] = 1:
- result = ARGS[1]
- elseif ARGS[2] = 2:
- result = ARGS[1] * ARGS[1]
- elseif ARGS[2] = 3:
- result = ARGS[1] * ARGS[1] * ARGS[1]
- elseif (ARGS[2] mod 2) = 0:
- result = func('shortgs', 's_pow2', ARGS[1] * ARGS[1], ARGS[2] / 2)
- else
- result = ARGS[1] * func('shortgs', 's_pow2', ARGS[1] * ARGS[1], ARGS[2] / 4)
- end
- end
- !! Takes multiple arrays and sorts them based on the first one.
- !! Sorts the key_array (which must only have value entries) in ascending order.
- !! gs 'shortgs', 'coupled_array_sort'. 'key_array', 'array1', 'array2', 'array3', ...
- !!
- !! String arrays must start with a $ otherwise the numeric values will be copied instead.
- !!
- !! examples:
- !! example 1: we want to sort a single array with values called values_array
- !! gs 'shortgs', 'coupled_array_sort', 'values_array'
- !! example 2: we have an array filled with days (called trigger_days), and a coupled array filled with npc_codes (called $trigger_npc_codes)
- !! gs 'shortgs', 'coupled_array_sort', 'trigger_days', '$trigger_npc_codes'
- if $ARGS[0] = 'coupled_array_sort':
- :shortgs_coupled_array_sort_loop_start
- if arrsize($ARGS[1]) > 0:
- shortgs_temp_pos = arrpos($ARGS[1], min($ARGS[1]))
- shortgs_args_index = 1
- :shortgs_casl_inner_start
- if $ARGS[shortgs_args_index] ! '':
- if arrsize($ARGS[shortgs_args_index]) > 0:
- if mid($ARGS[shortgs_args_index], 1, 1) = '$':
- dynamic '$shortgs_temp_array<<shortgs_args_index>>[] = <<$ARGS[shortgs_args_index]>>[shortgs_temp_pos]'
- else
- dynamic 'shortgs_temp_array<<shortgs_args_index>>[] = <<$ARGS[shortgs_args_index]>>[shortgs_temp_pos]'
- end
- killvar $ARGS[shortgs_args_index], shortgs_temp_pos
- shortgs_args_index += 1
- jump 'shortgs_casl_inner_start'
- end
- end
- jump 'shortgs_coupled_array_sort_loop_start'
- end
- shortgs_max_args_index = shortgs_args_index
- shortgs_args_index = 1
- :shortgs_casl_outer_start
- if shortgs_args_index < shortgs_max_args_index:
- dynamic 'copyarr(''<<$ARGS[shortgs_args_index]>>'', ''shortgs_temp_array<<shortgs_args_index>>'')'
- dynamic 'killvar ''shortgs_temp_array<<shortgs_args_index>>'' '
- shortgs_args_index += 1
- jump 'shortgs_casl_outer_start'
- end
- killvar 'shortgs_casl_inner_start'
- killvar 'shortgs_args_index'
- killvar 'shortgs_coupled_array_sort_loop_start'
- killvar 'shortgs_casl_outer_start'
- killvar 'shortgs_max_args_index'
- killvar 'shortgs_temp_pos'
- end
- !! converts decimal integer to hexadecimal string
- !! main use - convert rgb color to hex color (to use with HTML)
- ! use: func('shortgs', 'int_to_hex_str', number)
- ! example: func('shortgs', 'int_to_hex_str', 192)
- ! example: func('shortgs', 'int_to_hex_str', BColorBase)
- if $ARGS[0] = 'int_to_hex_str':
- :int_to_hex_loop
- $result = mid('0123456789ABCDEF', 1 + (ARGS[1] mod 16), 1) + $result
- ARGS[1] /= 16
- if ARGS[1] > 0: jump 'int_to_hex_loop'
- end
- !! converts hexadecimal string to decimal integer
- !! main use - convert hex color to rgb color (to use with HTML)
- ! use: func('shortgs', 'hex_str_to_int', $hex_string)
- ! example: func('shortgs', 'hex_str_to_int', 'A1C')
- ! example: func('shortgs', 'hex_str_to_int', $bcolor)
- if $ARGS[0] = 'hex_str_to_int':
- $ARGS[1] = $ucase($ARGS[1])
- shortgs_i = 1
- :hex_to_int_loop
- result = result * 16 + instr(1, '123456789ABCDEF', mid($ARGS[1], shortgs_i, 1))
- shortgs_i += 1
- if shortgs_i <= len($ARGS[1]): jump 'hex_to_int_loop'
- killvar 'shortgs_i'
- end
- !! converts ABGR integer (generated by rgb() func) to hex string
- !! OMITS ALPHA CHANNEL
- ! use: func('shortgs', 'rgb_to_hex', number)
- ! example: func('shortgs', 'rgb_to_hex', bcolor)
- ! example: func('shortgs', 'rgb_to_hex', lcolor)
- if $ARGS[0] = 'rgb_to_hex':
- $result = func('shortgs', 'int_to_hex_str', (ARGS[1] and 16711680) / 65536)
- $result = mid('00', 1, 2 - len($result)) + $result
- $result = func('shortgs', 'int_to_hex_str', (ARGS[1] and 65280) / 256) + $result
- $result = mid('0000', 1, 4 - len($result)) + $result
- $result = func('shortgs', 'int_to_hex_str', (ARGS[1] and 255)) + $result
- $result = '#' + mid('000000', 1, 6 - len($result)) + $result
- end
- !! Inverts a hexidecimal color (f.e. #31A4E2)
- !! func('shortgs', 'invert_color', $color)
- !! if you want to get either white or black, furthest away from the given color. Use:
- !! func('shortgs', 'invert_color', $color, 'bw')
- !! https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
- if $ARGS[0] = 'invert_color':
- if $ARGS[2] = 'bw':
- if func('shortgs', 'color_is_dark', $ARGS[1]) = 1:
- $result = '#FFFFFF'
- else
- $result = '#000000'
- end
- else
- $ARGS[1] = ucase(replace(trim($ARGS[1]), '#'))
- shortgs_r = 255 - func('shortgs', 'hex_str_to_int', mid($ARGS[1], 1, 2))
- shortgs_g = 255 - func('shortgs', 'hex_str_to_int', mid($ARGS[1], 3, 2))
- shortgs_b = 255 - func('shortgs', 'hex_str_to_int', mid($ARGS[1], 5, 2))
- $shortgs_r = func('shortgs', 'int_to_hex_str', shortgs_r)
- $shortgs_g = func('shortgs', 'int_to_hex_str', shortgs_g)
- $shortgs_b = func('shortgs', 'int_to_hex_str', shortgs_b)
- $shortgs_r = mid('0' + $shortgs_r, len($shortgs_r), 2)
- $shortgs_g = mid('0' + $shortgs_g, len($shortgs_g), 2)
- $shortgs_b = mid('0' + $shortgs_b, len($shortgs_b), 2)
- $result = '#' + $shortgs_r + $shortgs_g + $shortgs_b
- killvar 'shortgs_r'
- killvar 'shortgs_g'
- killvar 'shortgs_b'
- end
- end
- if $ARGS[0] = 'color_is_dark':
- $ARGS[1] = ucase(replace(trim($ARGS[1]), '#'))
- shortgs_cid_r = func('shortgs', 'hex_str_to_int', mid($ARGS[1], 1, 2))
- shortgs_cid_g = func('shortgs', 'hex_str_to_int', mid($ARGS[1], 3, 2))
- shortgs_cid_b = func('shortgs', 'hex_str_to_int', mid($ARGS[1], 5, 2))
- result = 2126 * shortgs_r * shortgs_r + 7152 * shortgs_g * shortgs_g + 722 * shortgs_b * shortgs_b
- result = iif(result > 136315346, 0, 1)
- killvar 'shortgs_cid_r'
- killvar 'shortgs_cid_g'
- killvar 'shortgs_cid_b'
- end
- !! func('shortgs', 'enumerate_list', '$arrname', {start}, {number}, {oxford_comma})
- !! returns a string with the array entries listed:
- !! $arr[0] = 'Sidisi' -> returns: 'Sidisi'
- !! $arr[1] = 'Eriette' -> returns: 'Sidisi and Eriette'
- !! $arr[2] = 'Dynaheir' -> returns: 'Sidisi, Eriette, and Dynaheir'
- !!
- !! ARGS[2] indicates where the enumeration start (Defaults to the first item)
- !! ARGS[3] indicates how many items are enumerated (Defaults to the end of the list)
- !! $ARGS[4] is the small separator (defaults to ', ')
- !! $ARGS[5] is the final separator for 2 items (defaults to ' and ')
- !! $ARGS[6] is the final seperator for more items (defaults to ', and ')
- if $ARGS[0] = 'enumerate_list':
- $temp_sgs_text = ''
- $sgs_arrname = $ARGS[1]
- if ARGS[2] = 0:
- temp_sgs_i = 0
- else
- temp_sgs_i = ARGS[2]
- end
- if ARGS[3] = 0:
- temp_sgs_max_i = arrsize($sgs_arrname)
- else
- temp_sgs_max_i = temp_sgs_i + ARGS[3]
- if temp_sgs_max_i > arrsize($sgs_arrname): temp_sgs_max_i = arrsize($sgs_arrname)
- end
- if $ARGS[4] = '':
- $temp_sgs_sep[0] = ', '
- else
- $temp_sgs_sep[0] = $ARGS[4]
- end
- if $ARGS[5] = '':
- $temp_sgs_sep[1] = ' and '
- else
- $temp_sgs_sep[1] = $ARGS[5]
- end
- if $ARGS[6] = '':
- $temp_sgs_sep[2] = ', and '
- else
- $temp_sgs_sep[2] = $ARGS[6]
- end
- if temp_sgs_max_i = 0:
- !!empty on purpose
- elseif temp_sgs_max_i = 1:
- dynamic '$temp_sgs_text = <<$sgs_arrname>>[0]'
- elseif temp_sgs_max_i = 2:
- dynamic '$temp_sgs_text = <<$sgs_arrname>>[0] + <<$temp_sgs_sep[1]>> + <<$sgs_arrname>>[1]'
- else
- temp_sgs_i = 0
- :sgs_enum_list
- dynamic '$temp_sgs_text += <<$sgs_arrname>>[<<temp_sgs_i>>]'
- temp_sgs_i += 1
- if temp_sgs_i < temp_sgs_max_i - 1: $temp_sgs_text += $temp_sgs_sep[0] & jump 'sgs_enum_list'
- dynamic '$temp_sgs_text += <<$temp_sgs_sep[2]>> + <<$sgs_arrname>>[<<temp_sgs_i>>]'
- killvar 'temp_sgs_i'
- end
- $result = $temp_sgs_text
- killvar '$temp_sgs_text'
- killvar '$sgs_arrname'
- killvar 'temp_sgs_max_i'
- end
- if $ARGS[0] = 'get_number_suffix':
- !! Get the selected day and apply an appropriate suffix - takes a valid day int from ARGS[1]
- if ARGS[1] < 0:
- query_day = (-ARGS[1]) mod 100
- else
- query_day = ARGS[1] mod 100
- end
- if query_day => 4 and query_day <= 20:
- $result = 'th'
- elseif query_day mod 10 = 1:
- $result = 'st'
- elseif query_day mod 10 = 2:
- $result = 'nd'
- elseif query_day mod 10 = 3:
- $result = 'rd'
- else
- $result = 'th'
- end
- killvar 'query_day'
- end
- if $ARGS[0] = 'convert_dob':
- !! Calculate NPC birthday and convert to human readable format
- temp_npc_birthday = (npc_dob['A<<ARGS[1]>>'] mod 100)
- $temp_day_suffix = func('shortgs', 'get_number_suffix', birthday)
- temp_npc_birthmonth = (npc_dob['A<<ARGS[1]>>'] / 100) mod 100
- temp_npc_birthyear = npc_dob['A<<ARGS[1]>>'] / 10000
- $result = '<<birthday>><<$temp_day_suffix>> ' + $monthName[birthmonth]+ ', ' + temp_npc_birthyear
- killvar 'temp_npc_birthday'
- killvar 'temp_npc_birthmonth'
- killvar 'temp_npc_birthyear'
- killvar 'temp_day_suffix'
- end
- --- shortgs ---------------------------------
|