:: pattest
<<set $here = 'pattest'>>
<<set $ARGS = $location_var[$here]>>
<!-- !! It is called like "gs 'pattest','Kolka'", or "gs 'pattest',$sex.npcId"-->
<!-- !! It needs some automatic call, usable when a named guy has cum in or on you, and only his cum is in/on the area (do not call this with "rapist", "unknown" or "gopnik")-->
<!-- !! Calls should be done with unique IDs 'A34' for Kolka etc.-->
<!-- !!	$ChildFath : array for names of the childs biological father. This should be the absolute truth, not readily available information for the characters.-->
<!-- !!	$ChildFathDNA : array for the DNA of the childs father-->
<!-- !!	$ChildThFath : array for the IDs of the childs believed father (can be different from the biological father and should be in form of ID ie. 'A34' or 'unknown' if Sveta has no idea) Do not use for pregnancy events as it is only updated when going to labor. This is probably the variable you want to work with when doing paternity tests, or if father reacts to physical traits not matching despite Sveta claiming they are the dad.-->
<!-- !! There needs to be an option to call it selectively when certain circumstances are met ($sex.npcId gives sample voluntarily).-->
<<if $location_var[$here][1] != 1 and getvar("$pattest") > 0>>
	<<set $j = 0>>
	p ''
	<<if getvar("$kid") > 0 and arrpos('surefather','0') != $kid>>
		<br>Select the child you want to compare with <<$larg(0)>>:<br>
		<<set $papa = $location_var[$here][0]>>
		<<warn 'JUMP MARKER ENCOUNTERED: :kiddieloop'>>
		<<setinit $kidid[$j] = $j>>
		<<set $value = $kidid[$j]>>
		<!-- FAILED TO CONVERT
			if surefather[j] = 0:pl '    <a href="exec:func(''pattest'', value, 1) & pattest -= 1 & gs ''stat''"><<$kidname[j]>></a>'
		-----
			<<if getvar("$surefather["+$j+"]") == 0>>
			<!-- FAILED TO CONVERT
	pl '    <a href="exec:func(''pattest'', value, 1) & pattest -= 1 & gs ''stat''"><<$kidname[$j]>></a>'
-----
	<<set ERROR: FAILED TO CONVERT LITERAL: """'    <a href""" = "exec:func(''pattest'', value, 1)>> <<setn $pattest -= 1>> <<gs 'stat'">$kidname[$j]</a>'>>

-->
<<warn "CONVERSION ERROR f8b5a572487c7754dbbda2228f46dd54">>

		<</if>>

		-->
		<<warn "CONVERSION ERROR 5e487b56937d9474942fdd48b290cb3b">>
		<<if $j < $kid - 1>>
			<<setn $j += 1>> 

		<</if>>
	<<elseif getvar("$kid") == 0>>
		<<msg 'You do not have children yet!'>>
	<<else>>
		<<msg 'You are sure about the father of every one of your children!'>>
	<</if>>
	<<set $j to null>>
	<<set $kidid to null>>
<<elseif $location_var[$here][1] != 1>>
	<<msg 'You do not have any paternity test to use!'>>
<</if>>
<<if $location_var[$here][1] == 1>>
	<<setinit $testresDay[$larg(0)] = 2147483647>>
	<!-- FAILED TO CONVERT
		if $ChildFath[ARGS[0]] = $papa:testresRes[ARGS[0]] = 1 else testresRes[ARGS[0]] = 0
	-----
		<<if $ChildFath[$location_var[$here][0]] == $papa>>
		<!-- FAILED TO CONVERT
	testresRes[ARGS[0]] = 1 else testresRes[ARGS[0]] = 0
-----
	<<setinit $testresRes[$larg(0)] = ERROR: FAILED TO CONVERT LITERAL: """1 else testresRes[$larg(0)] = 0""">>

-->
<<warn "CONVERSION ERROR 829e4df5569ca78c3990d085084a1cd4">>

	<</if>>

	-->
	<<warn "CONVERSION ERROR a1c2f65bc800aa44def4dd3ab064646a">>
	<<setinit $testresPotfath[$larg(0)] = $papa>>
	<<setinit $testresKid[$larg(0)] = $larg(0)>>
	<<setinit $purse_pattest[$larg(0)] = 1>>
	<<set $used_pattest += 1>>
	<<set $papa to null>>
<</if>>
<!-- !! Just shows the kid and the tested father-->
<!-- !! used: dynamic $send_test, <kidnumber>-->
<<setinit $testresKid[$cyc] = 0>>
<</END>>
<<if $cyc < $kid - 1>>
	<<setn $cyc += 1>> 

<</if>>
<<set $cyc to null>>
<<set $c2 to null>>
<!-- FAILED TO CONVERT
	}
-----
	ERROR: FAILED TO CONVERT LITERAL: """}"""

-->
<<warn "CONVERSION ERROR cbb184dd8e05c9709e5dcaedaa0495cf">>
:: test_purse_macro[widget]
<<widget 'test_purse'>>
	<<set $j = 0>>
	<<set $msg = 'Tests in your purse:'>>
	<<warn 'JUMP MARKER ENCOUNTERED: :pursekid'>>
	<<if getvar("$purse_pattest["+$j+"]") == 1>>
	<<set $msg += '<br>$testresPotfath[$j]'s test for fatherhood of $kidname[$j].'>>

<</if>>
	<<if $j < $kid - 1>>
	<<setn $j += 1>> 

<</if>>
	<<msg $msg>>
	<<set $msg to null>>
<</widget>>
:: send_test_macro[widget]
<<widget 'send_test'>>
	<<set $j = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :kloop'>>
	<<setinit $kidid[$j] = $j>>
	<!-- FAILED TO CONVERT
	if patpack[j] = 1:'    <a href="exec: testresDay[kidid[j]] = daystart+rand(5,7) & patpack[kidid[j]] = 0 & used_pattest -= 1 & money -= 20000">$kidname[j]</a>'
-----
	<<if getvar("$patpack["+$j+"]") == 1>>
	<!-- FAILED TO CONVERT
	'    <<link "$kidname[$j]">><<set $testresDay[$kidid[$j]] = daystart+rand(5,7)>> <<set $patpack[$kidid[$j]] = 0>> <<set $used_pattest -  = 1>> <<set $finances.cash -  = 20000>><</link>>'
-----
	<<set ERROR: FAILED TO CONVERT LITERAL: """'    <a href""" = "exec: testresDay[$kidid[$j]] = daystart+rand(5,7)>> <<setinit $patpack[$kidid[$j]] = 0>> <<setn $used_pattest -= 1>> <<set $finances.cash -= ERROR: FAILED TO CONVERT LITERAL: """20000">$kidname[$j]<""" / ERROR: FAILED TO CONVERT LITERAL: """a>'""">>

-->
<<warn "CONVERSION ERROR 37a4d6cf0fbdfa69426f3c5fd8d55183">>

<</if>>

-->
<<warn "CONVERSION ERROR 129a2eac7aff3bdbe746fc5411d2b6ae">>
	<<if $j < $kid - 1>>
	<<setn $j += 1>> 

<</if>>
	<<setinit $testresDay[_args[0]] = daystart+rand(5,7)>>
	<<setinit $purse_pattest[_args[0]] = 0>>
	<<set $used_pattest -= 1>>
<</widget>>
:: sms_testresult_macro[widget]
<<widget 'sms_testresult'>>
	<<set $cyc = 0>>
	<<warn 'JUMP MARKER ENCOUNTERED: :testloop'>>
	<<if getvar("$testresKid["+$cyc+"]") != 1>>
	<<setn $cyc += 1>> 

<</if>>
	<<if $time.daystart >= $testresDay[$cyc]>>
		<<set $c2 = arrsize('SMS_msg')>>
		<<setinit $SMS_msg[$c2] = 'Result of testing: <br>'>>
		<<if getvar("$testresRes["+$cyc+"]") == 1>>
		<<setinit $SMS_msg[$c2] += 'matching DNA' else $SMS_msg[$c2] += 'no DNA match'>>

	<</if>>
		<<setinit $SMS_msg[$c2] += '<br>between $testresPotfath[$cyc] and $kidname[$testresKid[$cyc]].'>>
<</widget>>
