:: shortgs
<<set $here = 'shortgs'>>
<<set $ARGS = $location_var[$here]>>
<!-- !! following function counts the number of guys which PC slept with.-->
<!-- !! use setup.func('shortgs','guy') or setup.func('shortgs','guy',X) for subset (X can be 'A','B','C','AB','AC','BC')-->
<<if $location_var[$here][0] == 'guy'>>
	<<set $r_sht = 0>>
	<!-- FAILED TO CONVERT
		if $larg(1) = '': $temptask = 'ABC' else $temptask = $larg(1)
	-----
		<<if $location_var[$here][1] == ''>>
		<!-- FAILED TO CONVERT
	$temptask = 'ABC' else $temptask = $larg(1)
-----
	<<set $temptask = ERROR: FAILED TO CONVERT LITERAL: """'ABC' else $temptask = $larg(1)""">>

-->
<<warn "CONVERSION ERROR e29413171426f807cd3b3d7f669446df">>

	<</if>>

	-->
	<<warn "CONVERSION ERROR d904c615217fa13c0723cc6b259d7caf">>
	<<warn 'JUMP MARKER ENCOUNTERED: :loop_shtty'>>
	<<set $temptaskchar = mid($temptask,1,1)>>
	<<set $temptask = mid($temptask,2,len($temptask)-1)>>
	<<set $s_sht = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :loop_shya'>>
	<<if $s_sht <= dyneval("result>>
		<<set $s_sht += 1>>
		<!-- FAILED TO CONVERT
			if npc_sex['<<$temptaskchar>><<s_sht>>'] > 0: r_sht = r_sht + iif(npc_gender['<<$temptaskchar>><<s_sht>>'] = 0,1,0)
		-----
			<<if ERROR: FAILED TO CONVERT LITERAL: """ERROR: FAILED TO CONVERT LITERAL: """npc_sex[$$temptaskchar"""""" +  << $s_sht>>
			<<set $r_sht = r_sht + iif(npc_gender[$$temptaskchar + 's_sht'] = 0,1,0)>>

		<</if>>

		-->
		<<warn "CONVERSION ERROR 9a9b2755252c9d8fccce2304ecb63fc0">>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump loop_shya'>>
	<</if>>
	<<if len($temptask) > 0>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump loop_shtty'>>

	<</if>>
	<<set $result = $r_sht>>
	<<set $r_sht to null>>
	<<set $temptask to null>>
	<<set $temptaskchar to null>>
	<<set $s_sht to null>>
<</if>>
<!-- !! following function counts the number of girls which PC slept with.-->
<!-- !! use setup.func('shortgs','girl') or setup.func('shortgs','girl',X) for subset (X can be 'A','B','C','AB','AC','BC')-->
<<if $location_var[$here][0] == 'girl'>>
	<<set $r_sht = 0>>
	<!-- FAILED TO CONVERT
		if $larg(1) = '': $temptask = 'ABC' else $temptask = $larg(1)
	-----
		<<if $location_var[$here][1] == ''>>
		<!-- FAILED TO CONVERT
	$temptask = 'ABC' else $temptask = $larg(1)
-----
	<<set $temptask = ERROR: FAILED TO CONVERT LITERAL: """'ABC' else $temptask = $larg(1)""">>

-->
<<warn "CONVERSION ERROR e29413171426f807cd3b3d7f669446df">>

	<</if>>

	-->
	<<warn "CONVERSION ERROR d904c615217fa13c0723cc6b259d7caf">>
	<<warn 'JUMP MARKER ENCOUNTERED: :loop_shttl'>>
	<<set $temptaskchar = mid($temptask,1,1)>>
	<<set $temptask = mid($temptask,2,len($temptask)-1)>>
	<<set $s_sht = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :loop_shl'>>
	<<if $s_sht <= dyneval("result>>
		<<set $s_sht += 1>>
		<!-- FAILED TO CONVERT
			if npc_sex['<<$temptaskchar>><<s_sht>>'] > 0: r_sht = r_sht + iif(npc_gender['<<$temptaskchar>><<s_sht>>'] = 1,1,0)
		-----
			<<if ERROR: FAILED TO CONVERT LITERAL: """ERROR: FAILED TO CONVERT LITERAL: """npc_sex[$$temptaskchar"""""" +  << $s_sht>>
			<<set $r_sht = r_sht + iif(npc_gender[$$temptaskchar + 's_sht'] = 1,1,0)>>

		<</if>>

		-->
		<<warn "CONVERSION ERROR 1327db05f9a20c717fade340ee014c0a">>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump loop_shl'>>
	<</if>>
	<<if len($temptask) > 0>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump loop_shttl'>>

	<</if>>
	<<set $result = $r_sht>>
	<<set $r_sht to null>>
	<<set $temptask to null>>
	<<set $temptaskchar to null>>
	<<set $s_sht to null>>
<</if>>
<!-- !! following procedure should be used when PC gets naked, but it should be paired with the reverse procedure-->
<!-- !! use gs 'shortgs','undress'-->
<<if $location_var[$here][0] == 'undress'>>
	<<gs 'underwear' 'remove'>>
	<<strip 'clothes'>>
<</if>>
<!-- !! reverse procedure, it can be modified for lose or stolen panties later.-->
<!-- !! use gs 'shortgs','dress'-->
<<if $location_var[$here][0] == 'dress'>>
	<<gs 'clothing' 'wear_last_worn'>>
	<<gs 'underwear' 'wear'>>
<</if>>
<!-- !! procedure, which prevents PC to leave a room naked.-->
<!-- !! use gs 'shortgs','checkdress',' <<$loc>>,<<$loc_arg>> '  or equivalent-->
<<if $location_var[$here][0] == 'checkdress'>>
	<<if $wardrobe.clothingworntype == 'nude'>>
		<<msg '<b><font color="red">You need to get dressed before going out.</font></b>'>>
		dynamic 'gt $larg(1)'
	<</if>>
<</if>>
<!-- !! this is an integer sqrt function-->
<!-- !! call parseInt(Math.sqrt(n)-->
<<if $location_var[$here][0] == 'sqrt'>>
	<<warn "USAGE OF sqrt is deprecated">>
	<<set $result = parseInt(Math.sqrt($larg(1)))>>
<</if>>
<!-- !! this function calculates modul of given arguments as it was coordinates in cartezian systeme-->
<!-- !! use modul(n1,n2,..n8)-->
<<if $location_var[$here][0] == 'modul'>>
	<<warn "USAGE OF modul is deprecated">>
	<<set _modul_sum to 0>>
	<<for _i = 1; _i <= 8; _i += 1>>
		<<if $larg(_i)>>
			<<set _modul_num to parseInt($larg(_i))>>
			<<set _modul_sum += _modul_num * _modul_num>>
		<</if>>
	<</for>>
	<<set $result = parseInt(Math.sqrt(_modul_sum))>>
<</if>>
<!-- !! day of week 1 - Monday .. 7 - Sunday-->
<<if $location_var[$here][0] == 'dow'>>
	<<if $location_var[$here][1] == 0>>
		<<set $D_dow = $time.day>>
		<<set $M_dow = $time.month>>
		<<set $Y_dow = $time.year>>
	<<else>>
		<<set $D_dow = $larg(3)>>
		<<set $M_dow = $larg(2)>>
		<<set $Y_dow = $larg(1)>>
	<</if>>
	<<set $dow_a = (14 - $M_dow) / 12>>
	<<set $dow_Y = $Y_dow - $dow_a>>
	<<set $dow_M = $M_dow + 12 * $dow_a - 2>>
	<<set $dummy = ($D_dow + $dow_y + $dow_y / 4 - $dow_y / 100 + $dow_y / 400 + (31 * $dow_m) / 12) % 7>>
	<<if getvar("$dummy") == 0>>
		<<set $dummy = 7>>

	<</if>>
	<<set $result = $dummy>>
<</if>>
<!-- !! day of year-->
<!-- !! use xdoy = setup.func('shortgs','doy',year,month,day)-->
<<if $location_var[$here][0] == 'doy'>>
	<<set $doy_N1 = 275 * $larg(2) / 9>>
	<<set $doy_N2 = ($larg(2) + 9) / 12>>
	<<set $doy_N3 = 1 + ($larg(1) - 4 * ($larg(1) / 4) + 2) / 3>>
	<<set $result = $doy_N1 - ($doy_N2 * $doy_N3) + $larg(3) - 30>>
<</if>>
<<if $location_var[$here][0] == 'mk1'>>
	<<gs 'saveposition'>>
	<<setinit $mk_subst['0'] = 'M'>> <<set $mk_subst['1'] = 'F'>> <<set $mk_subst['2'] = 'O'>> <<set $mk_subst['3'] = 'L'>> <<set $mk_subst['4'] = 'R'>> <<set $mk_subst['5'] = 'P'>>
	<center><font face="courier" size=1>
	<table border = 1>
	<!-- FAILED TO CONVERT
		'<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>
	-----
		ERROR: FAILED TO CONVERT LITERAL: """'<tr><th>Mon<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Tue<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Wen<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Thu<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Fri<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sat<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sun<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Mon<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Tue<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Wen<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Thu<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Fri<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sat<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sun<""" / ERROR: FAILED TO CONVERT LITERAL: """th>"""

	-->
	<<warn "CONVERSION ERROR 5f63b9b92bceeb27ef83a2bf87e8c0f0">>
	<!-- FAILED TO CONVERT
		<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>'
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<th>Mon<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Tue<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Wen<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Thu<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Fri<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sat<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sun<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Mon<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Tue<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Wen<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Thu<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Fri<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sat<""" / ERROR: FAILED TO CONVERT LITERAL: """th><th>Sun<""" / ERROR: FAILED TO CONVERT LITERAL: """th><""" / ERROR: FAILED TO CONVERT LITERAL: """tr>'"""

	-->
	<<warn "CONVERSION ERROR 86e3e0fd97254b25fb5f2d8502e817bc">>
	<<set $i = ArrSize('$MenCal')>>
	<<set $empty0 = $time.weekday + 29 - $i - 1>>
	<<set $empty1 = Math.min(28,empty0)>>
	<<set $full1 = Math.max(0,28 - empty0)>>
	<<set $empty2 = Math.max(0,empty0-28)>>
	<<set $full2 = $i - $full1>>
	<<set $empty3 = 28 - $empty2 - $full2>>
	<<set $count = 0>>
	<<set $tabmc = '<tr>'>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcl1'>>
	<<if getvar("$empty1") > 0>>
		<<setn $empty1 -= 1>> <<set $tabmc += '<td>&nbsp</td>'>>
	<</if>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcl2'>>
	<<if getvar("$full1") > 0>>
		<<set $full1 -= 1>>
		<<if $MenCal[$count] == '0'>>
			<<set $tabmc += '<td bgcolor="red">$mk_subst[$MenCal[$count]]</td>' else $tabmc +='<td>$mk_subst[$MenCal[$count]]</td>'>>

		<</if>>
		<<set $count += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmcl1'>>
	<</if>>
	<<set $tabmc += '</tr><tr>'>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcl3'>>
	<<if getvar("$empty2") > 0>>
		<<setn $empty2 -= 1>> <<set $tabmc += '<td>&nbsp</td>'>>
	<</if>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcl4'>>
	<<if getvar("$full2") > 0>>
		<<set $full2 -= 1>>
		<<if $MenCal[$count] == '0'>>
			<<set $tabmc += '<td bgcolor="red">$mk_subst[$MenCal[$count]]</td>' else $tabmc +='<td>$mk_subst[$MenCal[$count]]</td>'>>

		<</if>>
		<<set $count += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmcl4'>>
	<</if>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcl5'>>
	<<if getvar("$empty3") > 0>>
		<<setn $empty3 -= 1>> <<set $tabmc += '<td></td>'>>
	<</if>>
	<<set $tabmc += '</tr><table></font></center>'>>
	$tabmc
	<<act 'Back'>>
		<<gt 'restoreposition'>>
	<</act>>
<</if>>
<!-- !! use gs 'shortgs','mk'-->
<<if $location_var[$here][0] == 'mk'>>
	<<gs 'saveposition'>>
	copyarr '$MenCalCopy' , '$MenCal'
	<<set $length_of_month_field = arrsize('$MenCalCopy')>>
	<<if $time.daystart - getvar("$firstmens") > 40>>
		<<set $mensnotfound = 1>>
		<<set $i = 0>>
		<<warn 'JUMP MARKER ENCOUNTERED: :tabmcfm'>>
		<<if $MenCalCopy[$length_of_month_field - $i] == '0' and $MenCalCopy[$length_of_month_field - $i - 1] == '3'>>
			<<set $mensnotfound = 0>>

		<</if>>
		<<set $i += 1>>
		<<if $i < $length_of_month_field and getvar("$mensnotfound") == 1>>
			<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmcfm'>>

		<</if>>
		<<if getvar("$mensnotfound") == 0>>
			<<set $firstmens = $time.daystart - $i + 1>>
		<</if>>
	<</if>>
	<<set $i = 1>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcc1'>>
	<<if $time.daystart - getvar("$firstmens") < 40>>
		<<if ($time.daystart - $firstmens + $i) == 28>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#df2020"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 29>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#df3030"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 30>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#df4040"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 12>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#d8ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 13>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#d0ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 14>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#c8ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 15>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#c0ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 16>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#d0ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 12 + 28>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#d8ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 13 + 28>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#d0ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 14 + 28>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#c8ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 15 + 28>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#c0ff00"'>>
		<<elseif ($time.daystart - $firstmens + $i) == 16 + 28>>
			<<setinitpush "$MenCalCopy" ' bgcolor="#d0ff00"'>>
		<<else>>
			<<setinitpush "$MenCalCopy" ''>>
		<</if>>
		<<set $i += 1>>
		<<if getvar("$i") < 40>>
			<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmcc1'>>

		<</if>>
	<</if>>
	<<set $i = $length_of_month_field>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmcc2'>>
	<<if getvar("$i") > 0>>
		<<if $MenCalCopy[$i - 1] == '2' and getvar("$i") == 1>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#c0ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '2' and $MenCalCopy[$i - 2] == '2'>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#c0ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '2' and $MenCalCopy[$i - 2] == '1'>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#80ff00"'>> <<setinit $MenCalCopy[$i - 2] = ' bgcolor="#90ff00"'>> <<set $MenCalCopy[$i - 3] = ' bgcolor="#a0ff00"'>> <<set $MenCalCopy[$i - 4] = ' bgcolor="#b0ff00"'>> <<set $MenCalCopy[$i - 5] = ' bgcolor="#c0ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '1' and ($time.daystart - $firstmens - $length_of_month_field + $i) < 12>>
			<<setinit $MenCalCopy[$i - 1] = ''>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '1' and ($time.daystart - $firstmens - $length_of_month_field + $i) == 12>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#b0ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '1' and ($time.daystart - $firstmens - $length_of_month_field + $i) == 13>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#a0ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '1' and ($time.daystart - $firstmens - $length_of_month_field + $i) == 14>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#90ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '1' and ($time.daystart - $firstmens - $length_of_month_field + $i) == 15>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#80ff00"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '1' and ($time.daystart - $firstmens - $length_of_month_field + $i) > 15>>
			<<setinit $MenCalCopy[$i - 1] = ''>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '0'>>
			<<setinit $MenCalCopy[$i - 1] = ' bgcolor="#df2020"'>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '3'>>
			<<setinit $MenCalCopy[$i - 1] = ''>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '4'>>
			<<setinit $MenCalCopy[$i - 1] = ''>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '5'>>
			<<setinit $MenCalCopy[$i - 1] = ''>>

		<</if>>
		<<if $MenCalCopy[$i - 1] == '6'>>
			<<setinit $MenCalCopy[$i - 1] = ''>>

		<</if>>
		<<set $i -= 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmcc2'>>
	<</if>>
	<<set $cur_day_doy = setup.func('shortgs','doy',year,month,day)>>
	<<if $time.month == 1>>
		<<set $dif_days = $cur_day_doy + 30>>
		<<set $prev_month = 12>>
		<<set $prev_month_length = 31>>
	<<else>>
		<<set $prev_month = $time.month - 1>>
		<<set $dif_days = cur_day_doy - setup.func('shortgs','doy',year,prev_month,1)>>
		<<set $prev_month_length = setup.func('shortgs','doy',year,month,1) - setup.func('shortgs','doy',year,prev_month,1)>>
	<</if>>
	<<set $first_month_first_day_week = $time.weekday - ($dif_days % 7)>>
	<<set $first_month_first_day_index = $length_of_month_field - 1 - $dif_days>>
	<<set $r = $first_month_first_day_index>>
	<<if getvar("$first_month_first_day_week") < 1>>
		<<setn $first_month_first_day_week += 7>>

	<</if>>
	<<set $i = 42>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc21'>>
	<!-- FAILED TO CONVERT
		$mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc21'
	-----
		<<set ERROR: FAILED TO CONVERT LITERAL: """$mk1_mdays[]""" = '&nbsp'>> <<set $i -= 1>>

	-->
	<<warn "CONVERSION ERROR fb7ba7396dd82b2bae05c938f679f5f7">>
	<<set $i = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc21a'>>
	<<setinit $mk1_mdays[$i + $first_month_first_day_week - 1] = $str(i+1)>>
	<<set $i += 1>>
	<<if $i < $prev_month_length>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmc21a'>>

	<</if>>
	<<set $prev_month_name = mid($time.monthName[$prev_month],1,1) + '<br>' + $mid($time.monthName[$prev_month],2,1) + '<br>' + $mid($time.monthName[$prev_month],3,1)>>
	<<set $k = 0>>
	<<set $tabmc = '<center><font face="courier" size=5>'>>
	<<set $tabmc += '<table border = 1 cellspacing="0" cellpadding="5">'>>
	<<set $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>'>>
	<<set $time.month_weeks = ($first_month_first_day_week + $prev_month_length + 5) / 7 - 1>>
	<<set $i = $time.month_weeks>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc22'>>
	<<set $tabmc += '<tr>'>>
	<<set $j = 7>>
	<<if $i == $time.month_weeks>>
		<<set $tabmc += '<td rowspan="month_weeks+1" align = "center">$prev_month_name</td>'>>

	<</if>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc23'>>
	<<if getvar("$j") > 0>>
		<<set $j -= 1>>
		<<if $mk1_mdays[$k] == '&nbsp'>>
			<<set $tabmc += '<td>$mk1_mdays[$k]</td>'>>
		<<else>>
			<<set $tabmc += '<td$MenCalCopy[$r] >$mk1_mdays[$k]</td>'>>
			<<set $r += 1>>
		<</if>>
		<<set $k += 1>>
	<</if>>
	<<if getvar("$i") > 0>>
		<<setn $i -= 1>> <<set $tabmc += '</tr>'>>
	<</if>>
	<<set $mk1_mdays to null>>
	<<set $mk1_mdays_color to null>>
	<!-- !! current month-->
	<<if $time.month == 12>>
		<<set $dif_days = $time.day - 1>>
		<<set $cur_month = $time.month>>
		<<set $cur_month_length = 31>>
	<<else>>
		<<set $dif_days = $time.day - 1>>
		<<set $cur_month_length = setup.func('shortgs','doy',year,month+1,1) - setup.func('shortgs','doy',year,month,1)>>
	<</if>>
	<<set $second_month_first_day_week = $time.weekday - ($dif_days % 7)>>
	<<set $second_month_first_day_index = $length_of_month_field - 1 - $dif_days>>
	<<if getvar("$second_month_first_day_week") < 1>>
		<<setn $second_month_first_day_week += 7>>

	<</if>>
	<<set $i = 42>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc31'>>
	<!-- FAILED TO CONVERT
		$mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc31'
	-----
		<<set ERROR: FAILED TO CONVERT LITERAL: """$mk1_mdays[]""" = '&nbsp'>> <<set $i -= 1>>

	-->
	<<warn "CONVERSION ERROR 62757fff1d19a14ee56154777c744508">>
	<<set $i = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc31a'>>
	<<setinit $mk1_mdays[$i + $second_month_first_day_week - 1] = $str(i+1)>>
	<<set $i += 1>>
	<<if $i < $cur_month_length>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmc31a'>>

	<</if>>
	<<set $cur_month_name = mid($time.monthName[$time.month],1,1) + '<br>' + $mid($time.monthName[$time.month],2,1) + '<br>' + $mid($time.monthName[$time.month],3,1)>>
	<<set $k = 0>>
	<<set $time.month_weeks = ($second_month_first_day_week + $cur_month_length + 5) / 7 - 1>>
	<<set $i = $time.month_weeks>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc32'>>
	<<set $tabmc += '<tr>'>>
	<<set $j = 7>>
	<<if $i == $time.month_weeks>>
		<<set $tabmc += '<td rowspan="month_weeks+1" align = "center">$cur_month_name</td>'>>

	<</if>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc33'>>
	<<if getvar("$j") > 0>>
		<<set $j -= 1>>
		<<if $mk1_mdays[$k] == '&nbsp'>>
			<<set $tabmc += '<td>$mk1_mdays[$k]</td>'>>
		<<else>>
			<<if $time.day + $second_month_first_day_week - 2 == $k>>
				<<set $tabmc += '<td$MenCalCopy[$r] ><u><b>$mk1_mdays[$k]</b></u></td>' else $tabmc +='<td$MenCalCopy[$r] >$mk1_mdays[$k]</td>'>>

			<</if>>
			<<set $r += 1>>
		<</if>>
		<<set $k += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmc33'>>
	<</if>>
	<<if getvar("$i") > 0>>
		<<setn $i -= 1>> <<set $tabmc += '</tr>'>>
	<</if>>
	<<set $mk1_mdays to null>>
	<<set $mk1_mdays_color to null>>
	<!-- !! next month-->
	<<if $time.month == 12>>
		<<set $dif_days = 31 - $time.day + 1>>
		<<set $next_month = 1>>
		<<set $next_month_length = 31>>
	<<elseif $time.month == 11>>
		<<set $dif_days = 30 - $time.day + 1>>
		<<set $next_month = 12>>
		<<set $next_month_length = 31>>
	<<else>>
		<<set $next_month = $time.month + 1>>
		<<set $dif_days = $cur_month_length - $time.day + 1>>
		<<set $next_month_length = setup.func('shortgs','doy',year,month+2,1) - setup.func('shortgs','doy',year,month+1,1)>>
	<</if>>
	<<set $next_month_first_day_week = $time.weekday + ($dif_days % 7)>>
	<<set $next_month_first_day_index = $length_of_month_field - 1 - $dif_days>>
	<<if getvar("$next_month_first_day_week") < 1>>
		<<setn $next_month_first_day_week += 7>>

	<</if>>
	<<set $i = 35>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc41'>>
	<!-- FAILED TO CONVERT
		$mk1_mdays[] = '&nbsp' & i -= 1 & if i > 0: jump 'tabmc41'
	-----
		<<set ERROR: FAILED TO CONVERT LITERAL: """$mk1_mdays[]""" = '&nbsp'>> <<set $i -= 1>>

	-->
	<<warn "CONVERSION ERROR d309000a623d0f6b0074f8bdd52b32a4">>
	<<set $i = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc41a'>>
	<<setinit $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]]-->
	<<set $i += 1>>
	<<if $i < $next_month_length>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmc41a'>>

	<</if>>
	<<set $next_month_name = mid($time.monthName[$next_month],1,1) + '<br>' + $mid($time.monthName[$next_month],2,1) + '<br>' + $mid($time.monthName[$next_month],3,1)>>
	<<set $k = 0>>
	<<set $time.month_weeks = ($next_month_first_day_week + $next_month_length + 5) / 7 - 1>>
	<<set $i = $time.month_weeks>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc42'>>
	<<set $tabmc += '<tr>'>>
	<<set $j = 7>>
	<<if $i == $time.month_weeks>>
		<<set $tabmc += '<td rowspan="month_weeks+1" align = "center">$next_month_name</td>'>>

	<</if>>
	<<warn 'JUMP MARKER ENCOUNTERED: :tabmc43'>>
	<<if getvar("$j") > 0>>
		<<set $j -= 1>>
		<<if $mk1_mdays[$k] == '&nbsp'>>
			<<set $tabmc += '<td>$mk1_mdays[$k]</td>'>>
		<<else>>
			<<set $tabmc += '<td$MenCalCopy[$r] >$mk1_mdays[$k]</td>'>>
			<<set $r += 1>>
		<</if>>
		<<set $k += 1>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump tabmc43'>>
	<</if>>
	<<if getvar("$i") > 0>>
		<<setn $i -= 1>> <<set $tabmc += '</tr>'>>
	<</if>>
	<<set $mk1_mdays to null>>
	<<set $tabmc += '</tr><table></font></center>'>>
	$tabmc
	<<act 'Back'>>
		<<gt 'restoreposition'>>
	<</act>>
<</if>>
<!-- !! gs 'shortgs','fonts'-->
<<if $location_var[$here][0] == 'fonts'>>
	<<if $location_var[$here][1] == 'refresh'>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump fontsloop'>>
	<<else>>
		<<set $dynamicreturn = $location_var[$here][1]>>
		<<set $OpenPhraseSave = $location_var[$here][2]>>
		<<set $ClosePhraseSave = $location_var[$here][3]>>
	<</if>>
	<<gs 'saveposition'>>
	<<setinitpush "$fontlist[] = 'Lucida'>> <<set $fontlist[] = 'Ariel'>> <<set $fontlist[] = 'Tahoma'>> <<set $fontlist[] = 'Verdana'>> <<set $fontlist[] = 'Courier New'>> <<set $fontlist[] = 'Courier'>> <<set $fontlist[] = 'Georgia'>> <<set $fontlist[] = 'Times New Roman'>> <<set $fontlist[] = 'Garamond'>> <<set $fontlist[] = 'Bookman'>> <<set $fontlist[] = 'Times New Roman'>> <<set $fontlist[] = 'Times'>> <<set $fontlist[] = 'Comic Sans MS'>> <<set $fontlist[] = 'Trebuchet MS'>> <<set $fontlist[] = 'Impact'>> <<set $fontlist" 'BankGothic'>>
	<<setinitpush "$fontcolor[] = 'aqua'>> <<set $fontcolor[] = 'black'>> <<set $fontcolor[] = 'blue'>> <<set $fontcolor[] = 'magenta'>> <<set $fontcolor[] = 'green'>> <<set $fontcolor[] = 'gray'>> <<set $fontcolor[] = 'lime'>> <<set $fontcolor[] = 'maroon'>> <<set $fontcolor[] = 'navy'>> <<set $fontcolor[] = 'olive'>> <<set $fontcolor[] = 'purple'>> <<set $fontcolor[] = 'red'>> <<set $fontcolor[] = 'silver'>> <<set $fontcolor[] = 'teal'>> <<set $fontcolor[] = 'white'>> <<set $fontcolor" 'yellow'>>
	<<set $i = 15>>
	<<warn 'JUMP MARKER ENCOUNTERED: :fontsloop0'>>
	<<if $CurFont == $fontlist[$i]>>
		<<set $curfont = $i>>

	<</if>>
	<<if $CurColor == $fontcolor[$i]>>
		<<set $curcolor = $i>>

	<</if>>
	<<set $i -= 1>>
	<<if getvar("$i") > 0>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump fontsloop0'>>

	<</if>>
	<<warn 'JUMP COMMAND ENCOUNTERED: jump fontsloop1'>>
	<<warn 'JUMP MARKER ENCOUNTERED: :fontsloop'>>
	<<set $OpenPhrase = '<font size="CurFontSize" color="$CurColor" face="$CurFont" >' + $CurBold + $CurItalic>>
	<!-- FAILED TO CONVERT
		$ClosePhrase = $CurItalicBack+$CurBoldBack+'</font>'
	-----
		<<set $ClosePhrase = $CurItalicBack + $CurBoldBack + ERROR: FAILED TO CONVERT LITERAL: """'<""" / ERROR: FAILED TO CONVERT LITERAL: """font>'""">>

	-->
	<<warn "CONVERSION ERROR 61d419b857149392968094c5c264d45c">>
	<<warn 'JUMP MARKER ENCOUNTERED: :fontsloop1'>>
	<!-- FAILED TO CONVERT
		$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
	-----
		<<set $OpenPhrase + ERROR: FAILED TO CONVERT LITERAL: """'Current font is $CurFont Size <<CurFontSize>>""" , the color is $CurColor , ERROR: FAILED TO CONVERT LITERAL: """the Bold is <<iif($CurBold""" = '<b>','On','Off') and Italic is iif($CurItalic = '<i>','On','Off')' + $ClosePhrase>>

	-->
	<<warn "CONVERSION ERROR 0d9f1f3c6fb33783f939fc1c721a01de">>
	<<link "Change the Font">><<set $curfont = ($curfont + 1) % 16>> <<set $CurFont = $fontlist[$curfont]>> <<gs 'shortgs' 'fonts' 'refresh'>><</link>>
	<<link "Change the Color">><<set $curcolor = ($curcolor + 1) % 16>> <<set $CurColor = $fontcolor[$curcolor]>> <<gs 'shortgs' 'fonts' 'refresh'>><</link>>
	<<link "Change the BoldState">><<set $CurBold = iif($CurBold ! ''<b>'',''<b>'','' '')>> <<set $CurBoldBack = iif($CurBold = ''<b>'',''</b>'','' '')>> <<gs 'shortgs' 'fonts' 'refresh'>><</link>>
	<<link "Change the ItalicState">><<set $CurItalic = iif($CurItalic ! ''<i>'',''<i>'','' '')>> <<set $CurItalicBack = iif($CurItalic = ''<i>'',''</i>'','' '')>> <<gs 'shortgs' 'fonts' 'refresh'>><</link>>
	<<link "Decrease the Font">><<set $CurfontSize -  = 1>> <<gs 'shortgs' 'fonts' 'refresh'>><</link>>&nbsp&nbsp&nbsp<<link "Increase the font">><<set $CurfontSize +  = 1>> <<gs 'shortgs' 'fonts' 'refresh'>><</link>>
	<<actCLA 'Back'>>
		<<set $fontlist to null>>
		<<set $fontcolor to null>>
		<<set '+$OpenPhraseSave+' = $OpenPhrase>>
		<<set '+$ClosePhraseSave+' = $ClosePhrase>>
		<<if $dynamicreturn != ''>>
			dynamic 'dynamic $dynamicreturn'

		<</if>>
		<<gt 'restoreposition'>>
	<</actCLA>>
<</if>>
<!-- !! use gs 'shortgs','ncp_update'-->
<<if $location_var[$here][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'>>
	<<set $i = arrsize('copy_npc_QW')>>
	<<set $j = 1>>
	<<warn 'JUMP MARKER ENCOUNTERED: :loopnpcupdate'>>
	<<set $sex.npcId = 'Aj'>>
	<<set $npc($sex.npcId).QW = $copy_npc_QW[$sex.npcId]>>
	<<set $npc($sex.npcId).rel = $copy_npc_rel[$sex.npcId]>>
	<<set $npc($sex.npcId).love = $copy_npc_love[$sex.npcId]>>
	<<set $npc($sex.npcId).usedname = $copy_npc_usedname[$sex.npcId]>>
	<<set $j += 1>>
	<<if $j <= $i>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump loopnpcupdate'>>

	<</if>>
	<<set $copy_npc_QW to null>>
	<<set $copy_npc_rel to null>>
	<<set $copy_npc_love to null>>
	<<set $copy_npc_usedname to null>>
<</if>>
<!-- !! this function returns the numeric index of the array element which is indexed by string value.-->
<!-- !! call setup.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 $location_var[$here][0] == 'get_me_index'>>
	<<set $test = '$larg(1)[''+$larg(2)+'']'>>
	<<set $testas0 = arrsize('<<$larg(1)>>')>>
	<<if $mid($test,1,1) == '$'>>
		<<set $temp = dyneval('$result=<<$test>>')>>
		<<set '+$test+' = 'SearchTag'>>
		<<set $testas1 = arrsize('<<$larg(1)>>')>>
		<<if $testas0 == $testas1>>
			<<set $res = dyneval('$result = arrpos(''<<$larg(1)>>'',''SearchTag'')')>>
			<<set '+$test+' = $temp>>
		<<else>>
			<<set $res = -1>>
			<<setinit $larg(1) to null>> , $testas0
		<</if>>
	<<else>>
		<<set $temp = $test>>
		<<set $test = -2147483648>>
		<<set $testas1 = arrsize('$larg(1)')>>
		<<if $testas0 == $testas1>>
			<<set $res = dyneval('$result = arrpos(''<<$larg(1)>>'',-2147483648)')>>
			<<set $test = $temp>>
		<<else>>
			<<set $res = -1>>
			<<setinit $larg(1) to null>> , $testas0
		<</if>>
	<</if>>
	<<set $result = $res>>
<</if>>
<!-- !! call gs 'shortgs', 'remove_array_element', 'name of array','string index'-->
<<if $location_var[$here][0] == 'remove_array_element'>>
	killvar '<<$larg(1)>>',func('shortgs', 'get_me_index', $larg(1),$larg(2))
<</if>>
<<if $location_var[$here][0] == 'testsize'>>
	<<set '$npc_dna = ' + arrsize('$npc_dna')>>
	<<set '$npc_firstname = ' + arrsize('$npc_firstname')>>
	<<set '$npc_lastname = ' + arrsize('$npc_lastname')>>
	<<set '$npc_nickname = ' + arrsize('$npc_nickname')>>
	<<set '$npc_notes = ' + arrsize('$npc_notes')>>
	<<set '$npc_occupation = ' + arrsize('$npc_occupation')>>
	<<set '$npc_perstype = ' + arrsize('$npc_perstype')>>
	<<set '$npc_pic = ' + arrsize('$npc_pic')>>
	<<set '$npc_thdick = ' + arrsize('$npc_thdick')>>
	<<set '$npc_usedname = ' + arrsize('$npc_usedname')>>
	<<set 'npc_apprnc = ' + arrsize('npc_apprnc')>>
	<<set 'npc_bust = ' + arrsize('npc_bust')>>
	<<set 'npc_outfit = ' + arrsize('npc_outfit')>>
	<<set 'npc_style = ' + arrsize('npc_style')>>
	<<set 'npc_dick = ' + arrsize('npc_dick')>>
	<<set 'npc_dob = ' + arrsize('npc_dob')>>
	<<set 'npc_drunk = ' + arrsize('npc_drunk')>>
	<<set 'npc_gender = ' + arrsize('npc_gender')>>
	<<set 'npc_haircol = ' + arrsize('npc_haircol')>>
	<<set 'npc_height = ' + arrsize('npc_height')>>
	<<set 'npc_horny = ' + arrsize('npc_horny')>>
	<<set 'npc_intel = ' + arrsize('npc_intel')>>
	<<set 'npc_love = ' + arrsize('npc_love')>>
	<<set 'npc_QW = ' + arrsize('npc_QW')>>
	<<set 'npc_rel = ' + arrsize('npc_rel')>>
	<<set 'npc_sex = ' + arrsize('npc_sex')>>
	<<set 'npc_sexskill = ' + arrsize('npc_sexskill')>>
	<<set 'npc_spermpot = ' + arrsize('npc_spermpot')>>
	<<set 'npc_herpes = ' + arrsize('npc_herpes')>>
	<<set 'npc_syth = ' + arrsize('npc_syth')>>
	<<set 'npc_gon = ' + arrsize('npc_gon')>>
	<<set 'npc_thrush = ' + arrsize('npc_thrush')>>
	<<set 'npc_apt_type = ' + arrsize('npc_apt_type')>>
	<<set 'npc_apt_number = ' + arrsize('npc_apt_number')>>
	<<set '$npc_apt_bedroom = ' + arrsize('$npc_apt_bedroom')>>
	<<set '$npc_apt_kitchen = ' + arrsize('$npc_apt_kitchen')>>
	<<set '$npc_apt_livingroom = ' + arrsize('$npc_apt_livingroom')>>
	<<set '$npc_apt_bathroom = ' + arrsize('$npc_apt_bathroom')>>
	<<set 'npc_perv = ' + arrsize('npc_perv')>>
	<<set 'npc_finance = ' + arrsize('npc_finance')>>
	<<set 'npc_humor = ' + arrsize('npc_humor')>>
	<<set 'npc_fav_pos = ' + arrsize('npc_fav_pos')>>
	<<set 'npc_tit_pref = ' + arrsize('npc_tit_pref')>>
	<<set 'npc_addit = ' + arrsize('npc_addit')>>
	<<set 'npc_doors = ' + arrsize('npc_doors')>>
	<<set 'npc_goal = ' + arrsize('npc_goal')>>
	<<set 'npc_fidelity = ' + arrsize('npc_fidelity')>>
	<<set 'npc_lover_days = ' + arrsize('npc_lover_days')>>
	<<set 'npc_lover_keys = ' + arrsize('npc_lover_keys')>>
	<<set '$npc_index = ' + arrsize('$npc_index')>>
<</if>>
<<if $location_var[$here][0] == 'npctest'>>
	<p> --- init --- </p>
	<<gs 'shortgs' 'testsize'>>
	<<gs 'npcgeneratec' 0 'stranger' `rand(18,45)` 1>>
	<<=$npc($npclastgenerated).notes>>
	$npclastgenerated
	<p> --- gen npc C --- </p>
	<<gs 'shortgs' 'testsize'>>
	<<gs 'npcpreservec' $npclastgenerated>>
	<<=$npc($npclastsaved).notes>>
	$npclastsaved
	<p> --- sav npc C to npc B --- </p>
	<<gs 'shortgs' 'testsize'>>
	<<gs 'npccleanc' $npclastsaved>>
	<p> --- delete npc B --- </p>
	<<gs 'shortgs' 'testsize'>>
<</if>>
<<if $location_var[$here][0] == 'replace header'>>
	wait(ARGS[1])
	<<set $RH_Count = $larg(2)>>
	<<set $RH_temp = $MAINTXT>>
	<<warn 'JUMP MARKER ENCOUNTERED: :RH_label'>>
	<<set $RH_temp_lenght = LEN($RH_temp)>>
	<<set $RH_temp_LFpos = STRPOS($RH_temp,'\n')>>
	<<set $RH_temp = mid($RH_temp, RH_temp_LFpos+1, RH_temp_lenght - RH_temp_LFpos)>>
	<<set $RH_Count -= 1>>
	<<if getvar("$RH_Count") > 0>>
		<<warn 'JUMP COMMAND ENCOUNTERED: jump RH_label'>>

	<</if>>
	 	$RH_temp
	<<set $RH_temp to null>>
	<<set $RH_Count to null>>
	<<set $RH_temp_lenght to null>>
	<<set $RH_temp_LFpos to null>>
<</if>>
<<if $location_var[$here][0] == 'img msg'>>
	<<set $shortgstemp = '<center><img height=280 src="$larg(1)"></center>'>>
	<<msg $shortgstemp>>
	<<set $shortgstemp to null>>
<</if>>
<!-- !! Used for dividing with accurate rounding up/down-->
<<if $location_var[$here][0] == 'round_divide'>>
	<!-- !! ARGS[1] = value you want divided-->
	<!-- !! ARGS[2] = divider-->
	<!-- !!  setup.func('shortgs','round_divide', number, divider)-->
	<!-- !!  setup.func('shortgs','round_divide', 12345, 7)-->
	<<if $location_var[$here][2] != 0>>
		<<set $temp_number = $larg(1) / $larg(2)>>
		<<if ($location_var[$here][2] % 2 != 0 and $location_var[$here][1] % $location_var[$here][2] > $larg(2) / 2) or ($location_var[$here][2] % 2 == 0 and $location_var[$here][1] % $location_var[$here][2] >= $larg(2) / 2)>>
			<<setn $temp_number += 1>>

		<</if>>
		<<set $result = $temp_number>>
		<<set $temp_number to null>>
	<<else>>
		<<msg '<b>Error: No dividing by 0! You trying to make the universe disappear?</b>'>>
	<</if>>
<</if>>
<!-- !! Used for rounding numbers to the nearest multiple of ARGS[2]-->
<<if $location_var[$here][0] == 'round_tool'>>
	<!-- !! ARGS[1] = value you want rounded-->
	<!-- !! ARGS[2] = nearest multiple to round to-->
	<!-- !!  setup.func('shortgs','round_tool', number, multiple)-->
	<!-- !!  setup.func('shortgs','round_tool', 12345, 10)-->
	<<if $location_var[$here][2] != 0>>
		<<set $temp_multiple = $larg(2)>>
		<<set $result = setup.func('shortgs','round_divide', ARGS[1], ARGS[2]) * $temp_multiple>>
		<<set $temp_multiple to null>>
	<<else>>
		<<msg '<b>Error: Can""t round to 0!</b>'>>
	<</if>>
<</if>>
<!-- !! Randomly picks one of the items plugged in-->
<!-- !!-->
<!-- !!  Option 1: (has 6 input limit)-->
<!-- !!  $larg(1) =		'string' or 'number' to specify what youre plugging in (can also be blank for numbers)-->
<!-- !!  $larg(2-7) =	 strings or numbers to pick from, limited to 6-->
<!-- !!  Example 1: setup.func('shortgs', 'rand_pick', 'string', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta')-->
<!-- !!  Example 2: setup.func('shortgs', 'rand_pick', '', 2, 3, 5, 7, 11, 13)-->
<!-- !!-->
<!-- !!  Option 2: (no limitations, has to be delimited)-->
<!-- !! 	$larg(1) =		'delimit'  -  used for larger numbers of items to pick from-->
<!-- !!  $larg(2) =		'string' or 'number' to specify what youre plugging in (can also be blank for numbers)-->
<!-- !!  $larg(3) =		 Delimited string to parse-->
<!-- !!  $larg(4) =		 Delimiter used (Default = '|' pipe)-->
<!-- !!  Example 1: setup.func('shortgs', 'rand_pick', 'delimit', 'string', 'alpha|beta|gamma|delta|epsilon|zeta')-->
<!-- !!  Example 2: setup.func('shortgs', 'rand_pick', 'delimit', 'number', '1-12-123-1234-12345-123456', '-')-->
<!-- !!  Example 3: setup.func('shortgs', 'rand_pick', 'delimit', '', '0.1.2.3.5.7.11', '.')-->
<<if $location_var[$here][0] == 'rand_pick'>>
	<<if $location_var[$here][1] == 'delimit'>>
		<<if $location_var[$here][2] == 'string'>>
			<<gs 'shortgs' 'parse_string' '$rand_pick_temp' $location_var[$here][3] $location_var[$here][4]>>
			<<set $result = $rand_pick_temp[rand(0, arrsize('$rand_pick_temp')-1)]>>
			<<set $rand_pick_temp to null>>
		<<else>>
			<<gs 'shortgs' 'parse_string' 'rand_pick_temp' $location_var[$here][3] $location_var[$here][4]>>
			<<set $result = $rand_pick_temp[rand(0, arrsize('rand_pick_temp')-1)]>>
			<<set $rand_pick_temp to null>>
		<</if>>
	<<else>>
		<<if arrsize('ARGS') > 2>>
			<<if $location_var[$here][1] == 'string'>>
				<<set $result = $location_var[$here][rand(2, arrsize('$ARGS')-1)]>>
			<<else>>
				<<set $result = $larg(rand(2, arrsize('ARGS')-1))>>
			<</if>>
		<<else>>
			<<msg '<b>Error: ""rand_pick"" is missing ARGS</b>'>>
		<</if>>
	<</if>>
<</if>>
<!-- !! Parse delimited string into an array-->
<!-- !!	$larg(1) =		ArrayName (has to include $ for string values)-->
<!-- !!	$larg(2) =		Delimited string to parse-->
<!-- !!	$larg(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 $location_var[$here][0] == 'parse_string'>>
	<!-- !! Some failsafes (blank array name, blank string or no delimiters in string)-->
	<<if $location_var[$here][1] != ''>>
		<<if $location_var[$here][2] != '' and instr($larg(2) , iif(!$larg(3), '|', $larg(3)))>>
			<!-- !! Set delimiter with default if needed-->
			<<if $location_var[$here][3] == ''>>
				<<set $ParserTmpDelim = '|'>>
			<<else>>
				<<set $ParserTmpDelim = $location_var[$here][3]>>
			<</if>>
			<!-- !! Clear temp array if needed-->
			<<set $ParserTmpStr = $location_var[$here][2]>>
			<!-- !! Loop through string until no more delimiters found-->
			<<warn 'JUMP MARKER ENCOUNTERED: :StringParser01'>>
			<<set $ParserTmpIdx = instr($ParserTmpStr, $ParserTmpDelim)>>
			<<if getvar("$ParserTmpIdx") > 0>>
				<<if mid($larg(1),1,1) == '$'>>
					<<setinitpush "$ParserTmpArr" mid($ParserTmpStr, 1, ParserTmpIdx-1)>>
					<<set $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)>>
				<<else>>
					<<setinitpush "$ParserTmpArr" mid($ParserTmpStr, 1, ParserTmpIdx-1)>>
					<<set $ParserTmpStr = mid($ParserTmpStr, ParserTmpIdx+1)>>
				<</if>>
				<<warn 'JUMP COMMAND ENCOUNTERED: jump StringParser01'>>
				<!-- !! Get last part since no more delimiters were found and copy to the final array-->
			<<elseif mid($larg(1),1,1) == '$'>>
				<<setinitpush "$ParserTmpArr" $ParserTmpStr>>
				copyarr $larg(1) , '$ParserTmpArr'
			<<else>>
				<<setinitpush "$ParserTmpArr" $ParserTmpStr>>
				copyarr $larg(1) , 'ParserTmpArr'
			<</if>>
			<<set $ParserTmpDelim to null>>
			<<set $ParserTmpStr to null>>
			<<set $ParserTmpIdx to null>>
		<<else>>
			<<msg '<b>Error: No delimited string found!</b>'>>
		<</if>>
	<<else>>
		<<msg '<b>Error: No array name found!</b>'>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'clothing_state'>>
	<<if $wardrobe.clothes.type == 'swimwear'>>
		You are wearing swimwear.
	<<elseif $wardrobe.clothingworntype == 'danilovich_outfits' and $wardrobe.shoeworntype == 'danilovich'>>
		You are wearing gym clothing and shoes.
	<<elseif $wardrobe.clothingworntype == 'nude' and !$wardrobe.isWearingBra and !$wardrobe.isWearingPanties>>
		You are naked.
	<<elseif $wardrobe.clothingworntype == 'nude' and !$wardrobe.isWearingBra>>
		You are just wearing panties.
	<<elseif $wardrobe.clothingworntype == 'nude' and !$wardrobe.isWearingPanties>>
		You are just wearing a bra.
	<<elseif $wardrobe.clothingworntype == 'nude'>>
		You are in your underwear.
	<<elseif !$wardrobe.isWearingBra and !$wardrobe.isWearingPanties and $wardrobe.PCloPanties == 0 and $wardrobe.PCloBra == 0>>
		You are not wearing any underwear.
	<<elseif !$wardrobe.isWearingPanties and $wardrobe.PCloPanties == 0>>
		You are not wearing panties
	<<elseif $wardrobe.PCloBra == 0>>
		You are not wearing a bra
	<</if>>
<</if>>
<!-- !! 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 $location_var[$here][0] == 'payments'>>
	<<if getvar("$epayments['value']") == 0>>
		<<msg '<b>Error, Cash Value not set.</b>'>>
	<</if>>
	<<if $epayments['description'] == ''>>
		<<msg '<b>Error, Item Description not set.</b>'>>
	<</if>>
	<!-- !! Construct payment call-->
	<<if $epayments['item_variable'] != ''>>
		<!-- FAILED TO CONVERT
			$construct_cash = '<a href="exec: money -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
		-----
			<<set $construct_cash = ERROR: FAILED TO CONVERT LITERAL: """'<a href="exec: money""" - ERROR: FAILED TO CONVERT LITERAL: """= <<epayments['value']>>""">> <<setinit $epayments['item_variable'] += ERROR: FAILED TO CONVERT LITERAL: """<<epayments['quantity']>>""">> <<gs 'shortgs' 'paymentcomplete' ">Cash</a>'>>

		-->
		<<warn "CONVERSION ERROR a6c9bffc8492b189d43f74938100a6c4">>
		<!-- FAILED TO CONVERT
			$construct_card = '<a href="exec: karta -= <<epayments[''value'']>> & <<$epayments[''item_variable'']>> += <<epayments[''quantity'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
		-----
			<<set $construct_card = ERROR: FAILED TO CONVERT LITERAL: """'<a href="exec: karta""" - ERROR: FAILED TO CONVERT LITERAL: """= <<epayments['value']>>""">> <<setinit $epayments['item_variable'] += ERROR: FAILED TO CONVERT LITERAL: """<<epayments['quantity']>>""">> <<gs 'shortgs' 'paymentcomplete' ">Card</a>'>>

		-->
		<<warn "CONVERSION ERROR 0bf181fe0e861fe3cde8edf2a5af62a5">>
	<<else>>
		<!-- FAILED TO CONVERT
			$construct_cash = '<a href="exec: $epayments[''method''] = ''cash'' & money -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Cash</a>'
		-----
			<<set $construct_cash = '<a href="exec: $epayments['method'] = 'cash'>> <<set $finances.cash -= ERROR: FAILED TO CONVERT LITERAL: """<<epayments['value']>>""">> <<gs 'shortgs' 'paymentcomplete' ">Cash</a>'>>

		-->
		<<warn "CONVERSION ERROR 2270eebce3b4c2281a7b9213da6feefc">>
		<!-- FAILED TO CONVERT
			$construct_card = '<a href="exec: $epayments[''method''] = ''card'' & karta -= <<epayments[''value'']>> & gs ''shortgs'', ''paymentcomplete'' ">Card</a>'
		-----
			<<set $construct_card = '<a href="exec: $epayments['method'] = 'card'>> <<set $finances.bank -= ERROR: FAILED TO CONVERT LITERAL: """<<epayments['value']>>""">> <<gs 'shortgs' 'paymentcomplete' ">Card</a>'>>

		-->
		<<warn "CONVERSION ERROR 0cfbb97185bc01e1db4b5b2b2f55237b">>
	<</if>>
	<!-- !Use stock image for the purchase screen?-->
	<<if $epayments['banner'] != ''>>
		<center><img <<$set_imgh>> src="images/' + $epayments['banner'] +  '"></center>
	<</if>>
	<<if ($epayments['method'] != 'cash' and $epayments['method'] != 'card') and ($epayments['value'] <= $finances.cash and $epayments['value'] <= $finances.bankAvailable)>>
		<p>How do you want to pay for the $epayments['description']? $construct_cash or $construct_card</p>
	<<elseif ($epayments['method'] == 'cash' or $epayments['method'] == '') and $epayments['value'] <= $finances.cash>>
		<p>Pay for the $epayments['description'] with $construct_cash?</p>
	<<elseif ($epayments['method'] == 'card' or $epayments['method'] == '') and $epayments['value'] <= $finances.bankAvailable>>
		<p>Pay for the $epayments['description'] with your $construct_card?</p>
	<<else>>
		You don't have enough money in your purse or bank account for this item.
	<</if>>
	<<actCLA 'Cancel Payment'>>
		<<gt $location>>
	<</actCLA>>
<</if>>
<!-- !! Payment complete-->
<<if $location_var[$here][0] == 'paymentcomplete'>>
	<p>Thank you for your custom. Please come again!</p>
	<!-- FAILED TO CONVERT
		'You paid ' + epayments['value'] + '<b>₽</b>' + iif ($epayments['method']  = 'cash',' in cash', ' with your bank card') + ' for your ' + $epayments['description']
	-----
		<<set 'You paid ' + $epayments['value'] + ERROR: FAILED TO CONVERT LITERAL: """'<b>₽<""" / ERROR: FAILED TO CONVERT LITERAL: """b>'""" + iif ($epayments['method'] = 'cash',' in cash', ' with your bank card') + ' for your ' + $epayments['description']>>

	-->
	<<warn "CONVERSION ERROR 1f4bd8f31179128546ef082115fd4394">>
	<!-- !! clean up all the variables-->
	<<set $construct_cash to null>>
	<<set $construct_card to null>>
	<<if $epayments['loc'] != ''>>
		<<actCLA 'Finish payment'>>
			<<gt $epayments['loc'] $epayments['loc_arg']>>
		<</actCLA>>
	<<else>>
		<<actCLA 'Finish Payment'>>
			<<gt $location>>
		<</actCLA>>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'calendar_display'>>
	<b><<$time.month>> <<day>></b>
	<b><<$time.weekday>></b>
	<<if $time.minutes == 0>>
		<b><<hour>>:00</b>
	<<elseif $time.minutes < 10>>
		<b><<hour>>:0<<minut>></b>
	<<else>>
		<b><<hour>>:<<minut>></b>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'day_display'>>
	<b><<$time.weekday>></b>
	<<if $time.minutes == 0>>
		<b><<hour>>:00</b>
	<<elseif $time.minutes < 10>>
		<b><<hour>>:0<<minut>></b>
	<<else>>
		<b><<hour>>:<<minut>></b>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'time_display'>>
	<<if $time.minutes == 0>>
		<b><<hour>>:00</b>
	<<elseif $time.minutes < 10>>
		<b><<hour>>:0<<minut>></b>
	<<else>>
		<b><<hour>>:<<minut>></b>
	<</if>>
<</if>>
<<if $location_var[$here][0] == 'setloc'>>
	<<warn 'setloc is deprecated'>>
	<!-- !! Sets the location variables based on $larg(1) = loc, $larg(2) = loc arg-->
	<!-- !! Primary key-->
	<<set $loc = $location_var[$here][1]>>
	<<set $menu_loc = $location_var[$here][1]>>
	<<set $locM = $location_var[$here][1]>>
	<!-- !! Secondary key-->
	<<set $loc_arg = $location_var[$here][2]>>
	<<set $menu_arg = $location_var[$here][2]>>
	<<set $locM_arg = $location_var[$here][2]>>
	<!-- !! create loop from location array to determine region-->
	<!-- !!TBC-->
<</if>>
