code:
:: Bully Detention [nobr]
<<effects>>
<<pass10>>

Whitney drags you along the corridor straight to Leighton's office. <<He>> barges the door open and enters, still clutching your collar. "Good, the perv isn't here yet." <<He>> shoves you beneath a desk and sits down. As soon as you've struggled to your knees <<he>> grabs the back of your hair and forces your face
<<if $pronoun is "m">>into <<his>> crotch. <<His>> fly is already open.
<<else>>up <<his>> skirt. <<Hes>> not wearing panties.
<</if>>

<<if $penis isnot "none">>
You feel <<his>> penis erect against your cheek.
<<else>>
<<His>> pussy is already wet.
<</if>>

<<endevent>><<leighton>><<person1>>

You hear someone enter the room. "You again," says Leighton. "What was it this time?"

<<endevent>><<whitney>><<person1>>

"I didn't do nothing," Whitney replies.

<<He>> yanks your hair beneath the desk and rubs your mouth against <<his>> <<if $penis isnot "none">>penis<<else>>pussy<</if>>.

<<click [[Lick grudgingly|Bully Detention Oral]]>><<set $phase to 0>><<gtrauma60>><<gstress60>><<set $whitneydom += 1>><<set $submissive += 1>><<set $molestationstart to 1>><</click>><<gtrauma>><<gstress>><<gdom>>

<<if $promiscuity gte 55>>
<<click [[Lick enthusiastically|Bully Detention Oral]]>><<set $phase to 1>><<set $whitneydom += 1>><<set $submissive += 1>><<set $sexstart to 1>><</click>><<promiscuous4>><<gdom>>

<</if>>
<<if $whitneyromance is 1>>
<<click [[Lick lovingly|Bully Detention Oral]]>><<set $phase to 2>><<gtrauma60>><<set $whitneydom += 1>><<set $whitneylove += 1>><<set $submissive += 1>><<set $sexstart to 1>><</click>><<promiscuous1>><<gtrauma>><<glove>><<gdom>>

<</if>>
<<click [[Refuse|Bully Detention Refuse]]>><<gstress60>><<detention40>><<set $whitneydom -= 1>><</click>><<gdelinquency>><<gstress>><<ldom>>

:: Bully Detention Oral [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>>

<<set $enemyanger to 70>>
		<<if $penis isnot "none">>
		You try to get away with just licking the tip, but <<he>> shoves your lips against it.
		<<else>>
		You try to get away with some light licking, but <<he>> shoves your lips against <<his>> entrance.
		<</if>>

<<npcoral>><<set $lefthand to "hair">><<set $righthand to "none">><<set $head to "grappled">><<set $mouth to "none">><<set $enemyhealthmax to 10>><<set $enemyhealth to 10>>

<<set $rescue to 1>>
<<endif>>

<<if $sexstart is 1>>
<<set $sexstart to 0>>
<<consensual>>
<<set $consensual to 1>>
<<neutral1>>
<<set $event to "molestationhome">>
<<man1init>>

	<<if $phase is 0>><<set $enemyanger to 70>>
		<<if $penis isnot "none">>
		You try to get away with just licking the tip, but <<he>> shoves your lips against it.
		<<else>>
		You try to get away with some light licking, but <<he>> shoves your lips against <<his>> entrance.
		<</if>>
	<<elseif $phase is 1>><<set $enemyanger to 70>>
		<<if $penis isnot "none">>
		You tease the base of <<his>> glans with the tip of your tongue.<<promiscuity4>>
		<<else>>
		You tease <<his>> clit with the tip of your tongue.<<promiscuity4>>
		<</if>>
	<<elseif $phase is 2>><<set $enemyanger to 50>>
		<<if $penis isnot "none">>
		You kiss the base of <<his>> penis, and work your up the shaft. <<He>> eases <<his>> rough handling of your hair as you kiss <<his>> glans.<<promiscuity1>>
		<<else>>
		You plant quick kisses on <<his>> labia. <<He>> eases <<his>> rough handling of your hair as you kiss <<his>> clit.<<promiscuity1>>
		<</if>>
	<</if>>

<<npcoral>><<set $lefthand to "hair">><<set $righthand to "none">><<set $head to "grappled">><<set $mouth to "none">><<set $enemyhealthmax to 10>><<set $enemyhealth to 10>>

<<set $rescue to 1>>
<<endif>>

<<effects>>

<<effectsman>><<man>>

Leighton lectures Whitney, unaware of your presence or what you're up to beneath the desk.

<<stateman>>

<<if $phase is 2>>
<<set $enemyanger to 50>>
<<else>>
<<set $enemyanger to 70>>
<</if>>
<<set $enemyarousal += 20>>
<<actionsman>>

<<if $alarm is 1 and $rescue is 1>>
<<click [[Next|Bully Detention Oral Finish]]>><</click>><<nexttext>>
<<elseif $enemyhealth lte 0>>
<<click [[Next|Bully Detention Oral Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Detention Oral Finish]]>><</click>><<nexttext>>
<<elseif $finish is 1>>
<<click [[Next|Bully Detention Oral Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Detention Oral]]>><</click>><<nexttext>>
<</if>>

:: Bully Detention Refuse [nobr]
<<effects>>

You keep your mouth shut. Whitney tugs on your hair, making you wince in pain, but you don't relent. <<He>> rubs your face against <<himcomma>> but you endure. <<He>> soon becomes frustrated and shoves you out from under the desk with <<his>> foot. You land on your back, facing up at a shocked Leighton.

<<endevent>><<leighton>><<person1>>

"Well this is a surprise," the headteacher says. "If you're so keen on detention I can oblige. For now though, get out." <<He>> pushes you from the room.

<<endevent>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

:: Bully Detention Oral Finish [nobr]
<<effects>>
<<if $enemyarousal gte $enemyarousalmax>>
<<ejaculation>><<set $whitneylust -= 20>>

	<<if $penis isnot "none">>
	<<He>> forces your face into <<his>> crotch, making sure you catch every last drop.
	<<else>>
	<<He>> forces your face into <<his>> crotch, making sure you can't breathe until <<hes>> done cumming.
	<</if>>

"Y-yes," <<he>> says. "Fuck, yes."

Leighton isn't amused. The desk above you shakes as the headteacher leans on it. "Keep that up and I'll keep you here all night."

"Yes," Whitney whispers as <<he>> continues to fill your face. It seems to satisfy Leighton.

"Good," the headteacher says, stepping towards the door. You hear it open, then slam shut.

Once alone, Whitney pulls your head up to face <<him>> and looks down at you. "You make a good sex toy," <<he>> says. <<He>> releases your hair and stands up. <<He>> leaves without looking back.<<llust>>

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>
<<elseif $enemyhealth lte 0>>

Whitney shouts in pain and kicks you out from under the desk. You land on your back, facing up at a shocked Leighton.

"Well this is a surprise," the headteacher says. "If you're so keen on detention I can oblige. For now though, get out." You're grabbed by the neck, pulled to your feet and shoved from the room.<<detention40>><<gdelinquency>>

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>
<<elseif $alarm is 1 and $rescue is 1>><<set $rescued += 1>>
A pair of hands grab your arms and pull you out from beneath the desk. You face up at a shocked Leighton.

"Well this is a surprise," the headteacher says. "If you're so keen on detention I can oblige. For now though, get out." You're grabbed by the neck, pulled to your feet and shoved from the room.<<detention40>><<gdelinquency>>

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

<<else>>

Whitney kicks you out from beneath the desk. You face up at a shocked Leighton.

"Well this is a surprise," the headteacher says. "If you're so keen on detention I can oblige. For now though, get out." You're grabbed by the neck, pulled to your feet and shoved from the room.<<detention40>><<gdelinquency>>

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Oral [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>>
<<He>> forces you to your knees and <<if $pronoun is "m">>unzips <<his>> fly,<<else>>lifts <<his>> skirt,<</if>> revealing <<his>><<if $penis isnot "none">>penis<<else>>pussy<</if>>. "Open wide," <<he>> says. <<His>> friends cheer <<him>> on.

<<npcoral>><<set $lefthand to "hair">><<set $enemyanger to 70>>
<<set $rescue to 1>>
<<endif>>

<<if $sexstart is 1>>
<<set $sexstart to 0>>
<<consensual>>
<<set $consensual to 1>>
<<neutral1>>
<<set $event to "molestationhome">>
<<man1init>>
You drop to your knees as <<he>> <<if $pronoun is "m">>unzips <<his>> fly,<<else>>lifts <<his>> skirt,<</if>> revealing <<his>><<if $penis isnot "none">>penis<<else>>pussy<</if>>. "Open wide," <<he>> says. <<His>> friends cheer <<him>> on.<<promiscuity4>>

<<npcoral>><<set $lefthand to "hair">><<set $enemyanger to 70>>
<<set $rescue to 1>>
<<endif>>

<<effects>>

<<effectsman>><<man>>

<<audience>>

<<stateman>>

<<actionsman>>

<<if $alarm is 1 and $rescue is 1>>
<<click [[Next|Bully Oral Finish]]>><</click>><<nexttext>>
<<elseif $enemyhealth lte 0>>
<<click [[Next|Bully Oral Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Oral Finish]]>><</click>><<nexttext>>
<<elseif $finish is 1>>
<<click [[Next|Bully Oral Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Oral]]>><</click>><<nexttext>>
<</if>>

:: Bully Oral Finish [nobr]
<<effects>>
<<if $enemyarousal gte $enemyarousalmax>>
<<ejaculation>><<set $whitneylust -= 20>>

<<His>> friends applaud <<himstop>> "See you later, slut," <<he>> sneers as <<he>> pulls a cigarette from <<his>> shirt pocket.<<llust>>

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>
<<elseif $enemyhealth lte 0>>

Whitney shouts in pain and staggers away from you.<<set $whitneydom -= 1>><<ldom>>

"I've had enough of you," Whitney says, a slight quiver in <<his>> voice. "What are you waiting for you fucks? This slut has wasted enough of our time."

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>
<<elseif $alarm is 1 and $rescue is 1>>
"Stop crying, slut," Whitney says. <<He>> shoves you to the ground. <<He>> starts kicking you, so you curl up and shield your body. The crowd jeers at you. You think some of them get kicks in of their own.<<gpain>><<set $pain += 40>>

You hazard a peek once the kicking stops, and see Whitney and <<his>> friends walking away.

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

<<else>>

"Aww," Whitney says. "Has the baby had enough?" <<He>> shoves you to the ground. "Whatever. I was bored anyway." <<He>> and <<his>> friends leave. <<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

<</if>>

:: Whitney Abduction [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>

<<set $leftarm to "bound">><<set $rightarm to "bound">>
<<whitney>><<person1>>You wake up to cold water drenching your face. Whitney stands above you, holding an empty bucket. Your arms are bound and you're lying in an unfamiliar alley.

"Wakey wakey," <<he>> says. "I knew if I followed you I'd get my chance." <<He>> bunches <<his>> fists. "They don't respect me any more thanks to you. But that won't be a problem now." A van stops at the end of the alley. Whitney drags you to your feet. "You're going to disappear. So I don't have to see your stupid face ever again. And I'm even going to make some money from it."

<<generate2>><<generate3>><<person2>>

A <<person2>><<person>> and <<person3>><<person>> climb out the van and walk towards you. "Here you go," <<person1>>Whitney says. "One slut, as promised." <<He>> shoves you to the ground in front of <<himstop>>

<<person2>>"Very nice," the <<person>> says, stepping over you. "You're just the boss' type."

<<person1>>"Let go of me!" Whitney protests as the <<person3>><<person>> grabs <<person1>><<his>> arms. "I'm not the <<girl>> you're getting. That's <<phim>> on the floor."

<<person2>>"How do I put this," the <<person>> says, before slapping Whitney's face. "Your days of making decisions are over."

The pair start dragging Whitney towards the van. <<person1>>Whitney struggles and screams. "I said let go. Stop. P-please stop." <<He>> start to sob.

<<click [[Intervene|Whitney Abduction Intervene]]>><</click>>

<<click [[Stay out of it|Whitney Abduction Stay]]>><</click>>

:: Whitney Abduction Intervene [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>

You scramble to your feet. Your arms are still tied, but you charge at the <<person2>><<personstop>> You run into <<himcomma>> catching <<him>> off guard and knocking <<him>> to the ground.

The <<person3>><<person>> stares dumbstruck. Whitney struggles free and together you run from the alley.

<<person1>>You feel safer once in public. Whitney leans against a wall and pants through <<his>> sobs. <<He>> looks at you with a conflicted expression on <<his>> face, then runs away.

<<set $whitneystate to "rescued">>
<<endevent>>
<<destinationeventend>>

:: Whitney Abduction Stay [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>

You lie still on the floor. They open the back of the van and shove the crying Whitney in. The <<person3>><<person>> climbs in after <<person1>> <<himstop>> The <<person2>><<person>> shuts the doors, cutting off the sound of Whitney's cries. <<He>> climbs in the front seat and drives away.

<<set $whitneystate to "dungeon">>
<<endevent>>
<<destinationeventend>>

:: Bully Pat [nobr]
<<effects>>

You let <<him>> continue. <<He>> adds <<his>> other hand and starts massaging your scalp. Your body reacts of its own accord, and you shiver with pleasure. <<He>> grips your hair and pulls your face close to <<his>> own, "Don't forget who owns you." <<He>> licks your cheek before shoving you to the ground.

<<tearful>> you climb to your feet. <<He>> leaves with <<his>> friends.

<<endevent>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

:: Bully Shake [nobr]
<<effects>>

You shake <<him>> off. "Aww," <<he>> says. "The little <<girl>> is sensitive. Later loser." <<He>> leaves with <<his>> friends.

<<endevent>>

<<click [[Next|Hallways]]>><<set $eventskip to 1>><</click>>

:: Bully Top Flaunt [nobr]
<<effects>>

<<if $uppertype isnot "naked">>
You <<pullup>> your $upperclothes.
<<else>>
Whitney stands back to observe your exposed <<breastsstop>>
<</if>>

<<if $playergenderappearance is "m">>
"Nice," <<he>> says as you turn to give everyone a view of your chest. "You know how to give a show."
<<elseif $breastsize lte 2>>
"<<pShes>> so small!" <<he>> exclaims. You cover your nipples with your fingers, but turn to give everyone a good view of your <<breastsstop>>
<<elseif $breastsize lte 5>>
"You've got a nice pair," <<he>> says. You cover your nipples with your fingers, but turn to give everyone a good view of your <<breastsstop>>
<<else>>
"Look at the size of those things." <<he>> says. You cover your nipples with your fingers, but turn to give everyone a good view of your <<breastsstop>>
<</if>>
<<exhibitionism2>>

"It's good that you know your place. See you later, slut," <<he>> says before leaving you to cover yourself.<<set $whitneylust += 5>><<glust>>

<<click [[Next|Hallways]]>><<endevent>><<set $eventskip to 1>><</click>>

:: Bully Strip Flaunt [nobr]
<<effects>>

<<if $undertype is "naked" or $undertype is "chastity">>
	<<if $leftarm is "bound" and $rightarm is "bound">>
You shuffle out of your clothing. You turn to keep your <<genitals>> and <<breasts>> concealed while giving everyone a good look at your <<bottomstop>>
	<<else>>
You take off your clothing and keep your <<genitals>> and <<breasts>> barely concealed with your hands.
	<</if>>
<<exhibitionism5>>
<<else>>
	<<if $leftarm is "bound" and $rightarm is "bound">>
	You shuffle out of your clothing. You turn to keep your <<breasts>> concealed and give them a good look at your <<bottomstop>>
	<<else>>
	You take off your clothing and keep your <<undies>> and <<breasts>> barely concealed with your hands.
	<</if>>
<<exhibitionism4>>
<</if>>

<<uppernaked>>
<<lowernaked>>

<<if $bullyevent is 5>>

Whitney snatches your clothes away as the crowd gawks at you, taking in your bare skin. Whitney beholds you, savouring the feel of having control of your clothing. "Let's go for a walk," <<he>> says. "You don't have to, but I'll be taking your clothes with me."

<<click [[Go along with it|Bully Walk]]>><<gtrauma60>><<gstress60>><<lcool10>><<set $whitneydom += 1>><</click>><<lcool>><<gtrauma>><<gstress>><<gdom>>

	<<if $exhibitionism gte 75>>
<<click [[Flaunt|Bully Walk Flaunt]]>><<set $whitneydom += 1>><<set $whitneylove += 1>><</click>><<exhibitionist5>><<glove>><<gdom>>

	<</if>>
<<click [[Refuse|Bully Refuse]]>><</click>>

<<else>>

Whitney snatches your clothes away as the crowd gawks at you, taking in your bare skin. Whitney beholds you, savouring the feel of having control of your clothing. "Don't forget your place." <<He>> tosses your clothes on top of a locker, high enough that you'll need to stretch. You manage to reach them, but your <<breasts>> are exposed in the process, eliciting a cheer from the audience.

They lose interest once you're dressed, "Come on, we've wasted enough time with this loser." They leave you in peace. For now. <<set $whitneylust += 5>><<glust>>

<<click [[Next|Hallways]]>><<clotheson>><<endevent>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Walk Flaunt [nobr]
<<effects>>

You start walking with Whitney and <<his>> friends. They push you to the front, making sure you're exposed to anyone you meet. Whitney stands at your side, clutching your arm.

<<if $leftarm is "bound" and $rightarm is "bound">>
<<else>>
You cover yourself with your other hand.
<</if>>

You're steered round a corner and into a corridor full of <<peopleystop>> <<covered>> A nearby <<persony>> looks at you and gasps in shock. Others have a similar reaction. As the noise grows more turn to look, until everyone is watching you.

You march down the corridor like it was a catwalk. Some look away, going red in the face. Most though are keen to take in the sight of the <<if $undertype is "naked">>naked<<else>>nearly naked<</if>> <<girl>> marching down the center.

"Feel free to look," you announce. "There's no shame in it."<<exhibitionism5>>

Whitney and <<his>> friends follow behind you. When reach the end of the corridor you turn and face them. "You're shameless," <<he>> says. <<He>> throws your clothes at you. "I wish every slut was as keen as you." <<He>> leaves you to get dressed.<<set $whitneylust += 5>><<glust>>

<<fameexhibitionism50>>

<<click [[Next|Hallways]]>><<clotheson>><<endevent>><<set $eventskip to 1>><</click>>

:: Bully Theft [nobr]
<<set $outside to 1>><<set $location to "town">><<effects>>
<<pass20>>
Whitney drags you through the school gates. "We're going to Elk Street," <<he>> says. "You're gonna help us find something." Someone keeps jabbing at your waist throughout the journey.

You arrive beside a walled compound. There's a small hole at the base of the wall. "I'm out of fags," Whitney says. "Go get me some." <<He>> shoves you to your knees and kicks your <<bottom>> several times, pushing you into the hole.

You stand on the other side. You're in an open space behind a large building. There's a vehicle not far away. It's back doors are wide open, many large boxes of cigarettes. You walk over and pick up a couple.

As you turn back to the wall however, you hear a growl behind you. You run, and the growl becomes a bark.

You dive through the hole. Whitney takes the boxes from your hands. You try to crawl through but you're stuck.

	<<if $submissive gte 1150>>
	"H-help," you say.
	<<elseif $submissive lte 850>>
	"Don't just stand there," you say.
	<<else>>
	"Please help," you say.
	<</if>>

<<if $whitneyromance is 1>>

Whitney considers a moment, then grabs your arms. <<He>> pulls you through to safety. "Can't let that dog have its way with you. You'd smell all funny." <<He>> and <<his>> friends laugh. "See you later <<girlstop>> Thanks for the help."<<set $whitneylust += 5>><<glust>>

<<endevent>>

<<click [[Next|Elk Street]]>><<endevent>><</click>>

<<elseif $bestialitydisable is "f">>

Whitney laughs. "Nah, I'm not gonna be caught helping a thief. See you later slut."<<set $whitneylust += 5>><<glust>>

<<endevent>>

You feel the dog prod your behind.

<<click [[Next|Bully Theft Dog]]>><<set $molestationstart to 1>><</click>>

<<else>>

You wriggle and manage to get through the hole before the dog reaches you. The struggle hurt you and damaged your clothing.<<set $whitneylust += 5>><<glust>><<beastescape>>

<<endevent>>

<<click [[Next|Elk Street]]>><<endevent>><</click>>

<</if>>

:: Bully Outside Fight [nobr]
<<if $fightstart is 1>>
<<set $fightstart to 0>>

<<neutral1>>
<<set $event to "molestationhome">>
<<man1init>>
<<set $enemytrust to $enemytrust - 100>>
<<set $enemyanger += 200>>
<<npcidlegenitals>><<set $mouthuse to "lefthand">><<set $lefthand to "mouth">>
You shove Whitney away and try to escape, but <<he>> grabs you from behind and wraps <<his>> arm around your mouth.

<<if $delinquency lt 400>><<set $rescue to 1>><</if>>
<<endif>>

<<effects>>
<<effectsman>><<man>>

<<if $alarm is 1 and $rescue is 0>><<set $alarm to 0>>
No one comes to your aid, likely due to your reputation as a delinquent.

<</if>>

<<audience>>

<<stateman>>

<<actionsman>>

<<if $enemyhealth lte 0>>
<<click [[Next|Bully Outside Fight Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Outside Fight Finish]]>><</click>><<nexttext>>
<<elseif $alarm is 1 and $rescue is 1>>
<<click [[Next|Bully Outside Fight Finish]]>><</click>><<nexttext>>
<<elseif $pain gte 100>>
<<click [[Next|Bully Outside Fight Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Outside Fight]]>><</click>><<nexttext>>
<</if>>

:: Bully Outside Fight Finish [nobr]
<<if $enemyhealth lte 0>>

You push <<him>> to the ground, giving you a chance to escape. <<tearful>> you shove <<his>> friends aside and flee to safety.

<<clotheson>>
<<endcombat>>

<<set $eventskip to 1>>
<<playground>>

<<elseif $enemyarousal gte $enemyarousalmax>>
<<ejaculation>>

"You... stupid..." <<he>> pants, leaning against the wall. <<His>> friends are so bemused by <<his>> state that they don't notice you slip away. <<tearful>> you escape to safety.<<llust>><<set $whitneylust -= 20>>

<<clotheson>>
<<endcombat>>

<<set $eventskip to 1>>
<<playground>>

<<elseif $alarm is 1 and $rescue is 1>>

Your cries attract attention. "Crybaby," Whitney says. "We'll get you next time." <<He>> and <<his>> friends leave. <<tearful>> you struggle to your feet.

<<clotheson>>
<<endcombat>>

<<set $eventskip to 1>>
<<playground>>

<<else>>

You're too battered and bruised to resist.

<<endcombat>>

<<whitney>><<person1>>

	<<if $bullyeventoutside is 1>>
	<<click [[Next|Bully Theft]]>><</click>>
	<<elseif $bullyeventoutside is 2>>
	<<click [[Next|Bully Light]]>><</click>>
	<<elseif $bullyeventoutside is 3>>
	<<click [[Next|Bully Romance]]>><</click>>
	<<else>>
	<<click [[Next|Bully Whore]]>><</click>>
	<</if>>

<</if>>

:: Bully Theft Dog [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "dogpack">>
<<beast1init>><<set $beasttype to "dog">><<set $enemytrust -= 40>><<set $position to "wall">><<set $leftarm to "bound">><<set $rightarm to "bound">><<set $head to "bound">>

<<endif>>

<<effects>>
<<effectsman>>
<<beast>>

<<stateman>>

<<actionsman>>

<<if $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Theft Dog Finish]]>><</click>><<nexttext>>
<<elseif $enemyhealth lte 0>>
<<click [[Next|Bully Theft Dog Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Theft Dog]]>><</click>><<nexttext>>
<</if>>

:: Bully Theft Dog Finish [nobr]
<<set $outside to 1>><<set $location to "forest">><<effects>>

<<if $enemyarousal gte $enemyarousalmax>>

<<beastejaculation>>

You hear the dog walk away from you, and manage to wriggle through the hole.

<<tearful>> you rise to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Elk Street]]>><<set $eventskip to 1>><</click>>

<<elseif $enemyhealth lte 0>>

You hear the dog yelp and run away. You manage to wriggle through the hole.

<<tearful>> you rise to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Elk Street]]>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Light [nobr]
<<set $outside to 1>><<set $location to "town">><<effects>>
<<pass20>>

You're dragged by the arm through the school gates. "The breeze from the sea is nice," <<he>> says. "I'll show you what I mean."

You journey to Mer Street. When you arrive Whitney steps up to the edge of the pier. "This is nice," <<he>> says. <<He>> points at a street light. <<His>> friends grasp your arms and drag you over to it. Someone ties your arms in place.

<<set $leftarm to "bound">><<set $rightarm to "bound">>
Whitney saunters over to you. "Think I'll leave you here awhile. You'll have company." <<He>> points at a fishing ship just landing. "Doesn't look like they caught much. They must be real frustrated. I know what'll cheer them up. A nice slut all tied and ready for them." <<He>> and <<his>> friends leave. You can't turn to tell if they're gone or watching from somewhere.

<<endevent>><<generate1>><<generate2>><<generate3>><<person1>>

A <<person>> on board the boat points at you. <<He>> comes ashore, followed by <<his>> crewmates.

<<set $rng to random(1, 100)>>
<<if $rng gte 81>>
"What do we have here," the <<person>> says as <<he>> draws close. "Now who'd tie you up like that. I bet you did something naughty to deserve it."

<<person2>>A <<person>> arrives at <<person1>><<his>> side. "We should probably help punish <<phimstop>> Civic duty and all that."

<<click [[Next|Bully Light Molestation]]>><<set $molestationstart to 1>><</click>>

<<else>>

<<click [[Next|Bully Light 2]]>><</click>>

<</if>>

:: Bully Light Molestation [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>>
<<endif>>

<<effects>>

<<effectsman>><<man>>

<<stateman>>

<<actionsman>>

<<if $enemyhealth lte 0>>
<<click [[Next|Bully Light Molestation Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Light Molestation Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Light Molestation]]>><</click>><<nexttext>>
<</if>>

:: Bully Light Molestation Finish [nobr]
<<effects>>
<<if $enemyarousal gte $enemyarousalmax>>
<<ejaculation>>

They laugh and joke with each other as they head back to their boat.

<<endcombat>>

<<whitney>><<person1>>
You hear Whitney's voice behind you. "I bet you made their day." Your hands come free. "Don't forget who owns your ass. If I want you servicing sailors twenty-four hours a day that's what'll happen." <<tearful>> you remove the remains of the rope from your arms. Whitney and <<his>> friends leave you by the pier.<<set $whitneylust += 5>><<glust>>

<<unbind>>
<<clotheson>>
<<endevent>>
<<click [[Next|Mer Street]]>><<set $eventskip to 1>><</click>>

<<elseif $enemyhealth lte 0>>
"Maybe paying a whore is worth it after all," the <<person1>><<person>> says. "They don't kick back." They grumble as they head back to their boat.

<<endcombat>>

<<whitney>><<person1>>
You hear Whitney's voice behind you. "You sure showed them." Your hands come free. "Don't forget who owns your ass." <<tearful>> you remove the remains of the rope from your arms. Whitney and <<his>> friends leave you by the pier.

<<unbind>>
<<clotheson>>
<<endevent>>
<<click [[Next|Mer Street]]>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Romance [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>
<<pass20>>

<<He>> pushes you through the school gates, groping your <<bottom>> the whole time without caring who sees. "I have something romantic planned," <<he>> says. "Only the best for my <<bitchstop>>"

<<He>> takes you to Harvest Street, to a seedy pub. "Sit down. I'll get drinks."

<<He>> returns with two colourful looking glasses. "Drink up," <<he>> says.

<<click [[Drink|Bully Romance 2]]>><<set $phase to 0>><<set $whitneydom += 1>><</click>><<gdom>>

<<click [[Don't Drink|Bully Romance 2]]>><<set $phase to 1>><<set $whitneydom -= 1>><</click>><<ldom>>

:: Bully Romance 2 [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>

<<if $phase is 0>>
You sip the drink. It's very sweet. You feel lightheaded within moments.

<<set $drunk += 120>>
<</if>>

<<He>> sips <<his>> drink and stares at you. "Why don't you come over here? Sit on my lap."

<<click [[Sit on lap|Bully Romance 3]]>><<set $phase to 0>><<set $whitneydom += 1>><<set $whitneylove += 1>><</click>><<glove>><<gdom>>

<<click [[Refuse|Bully Romance 3]]>><<set $phase to 1>><<set $whitneylove -= 1>><<set $whitneydom -= 1>><</click>><<llove>><<ldom>>

:: Bully Romance 3 [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>

<<if $phase is 0>>
You walk around the table and sit on <<his>> waiting lap. A few heads turn to look. <<He>> leans close.

<<else>>
You shake your head. <<He>> reaches forward and grabs your shoulders before pulling you onto the table. <<He>> leans close.

<</if>>

"I'm going to fuck you," <<he>> whispers. "Right here. Everyone will see and know you're mine."

<<click [[Nod|Bully Romance Sex]]>><<set $sexstart to 1>><<set $whitneydom += 1>><<set $whitneylove += 1>><</click>><<promiscuous1>><<glove>><<gdom>>

<<click [[Refuse|Bully Romance Sex]]>><<set $molestationstart to 1>><<set $whitneydom -= 1>><<set $whitneylove -= 1>><</click>><<llove>><<ldom>>

:: Bully Romance Sex [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>>
"That's not your decision to make," <<he>> says.

<<endif>>

<<if $sexstart is 1>>
<<set $sexstart to 0>>
<<consensual>>
<<set $consensual to 1>>
<<neutral1>>
<<set $event to "molestationhome">>
<<man1init>><<promiscuity1>>

<<endif>>

<<effects>>

<<effectsman>><<man>>

<<audience>>

<<stateman>>

<<actionsman>>

<<if $enemyhealth lte 0>>
<<click [[Next|Bully Romance Sex Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Romance Sex Finish]]>><</click>><<nexttext>>
<<elseif $finish is 1>>
<<click [[Next|Bully Romance Sex Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Romance Sex]]>><</click>><<nexttext>>
<</if>>

:: Bully Romance Sex Finish [nobr]
<<effects>>
<<if $enemyarousal gte $enemyarousalmax>>
<<ejaculation>><<set $whitneylust -= 20>>

The audience applaud. Whitney gasps and climbs off you.

<<clotheson>>

<<tearful>> you climb to your feet. Whitney takes your hand. "Let's leave before these perverts get any funny ideas." <<He>> pulls you from the pub.

<<He>> pulls a cigarette out of <<his>> shirt pocket once outside. "And they say I'm not romantic," <<he>> says. "Fuck off home or wherever, I've got things to do." <<He>> walks away from you.<<llust>>

<<endcombat>>

<<click [[Next|Harvest Street]]>><<set $eventskip to 1>><</click>>
<<elseif $enemyhealth lte 0>>

You shove Whitney off you. <<tearful>> you flee the pub. The audience cheer at the spectacle.<<llove>><<ldom>><<set $whitneylove -= 1>><<set $whitneydom -= 1>>

<<clotheson>>
<<endcombat>>

<<click [[Next|Harvest Street]]>><<set $eventskip to 1>><</click>>

<<else>>

"You're showing me up in front of all these people," Whitney says. "You should treat your <<if $pronoun is "m">>boy<<else>>girl<</if>>friend better." <<He>> shoves you away, adjusts <<his>> clothes and leaves the pub.<<llove>><<ldom>><<set $whitneylove -= 1>><<set $whitneydom -= 1>>

<<clotheson>>
<<endcombat>>

<<tearful>> you leave the same way as Whitney, but don't see them anywhere.

<<click [[Next|Harvest Street]]>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Whore [nobr]
<<set $outside to 0>><<set $location to "town">><<effects>>
<<pass20>>

Whitney drags you by your hair, forcing you to bend forwards. <<He>> leads you through the school gates and down a nearby alley. <<He>> releases you in front of a <<endevent>><<generate1>><<person1>><<personstop>>

<<if $uppertype isnot "naked">>
Without warning, Whitney <<pullsup>> your $upperclothes.
<</if>>

"There. I've shown you a school <<girl>> shirtless. Now pay up."

<<if $whitneydom gte 20>>

The <<person>> reaches forward to grope your <<breastsstop>> "No touching!" Whitney says. "That's extra."

"How much extra?"

Whitney pauses, refusing to let you go. "£50."

"Done," the <<person>> says. <<He>> pulls some notes from <<his>> pocket. Whitney shoves you over while taking the money.

<<click [[Next|Bully Whore Molestation]]>><<set $molestationstart to 1>><</click>>

<<else>>

The <<person>> reaches forward to grope your <<breastsstop>> "No touching!" Whitney says. "You haven't paid for that." You struggle free.

<<endevent>><<whitney>><<person1>>

You leave the alley as Whitney takes <<his>> money. "Don't be upset," <<he>> shouts at you. "You've been productive for once."<<set $whitneylust += 5>><<glust>><<gtrauma>><<gstress>><<gtrauma60>><<gstress60>>

<<click [[Next|Oxford Street]]>><<endevent>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Whore Molestation [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>>
<<endif>>

<<effects>>

<<effectsman>><<man>>

Whitney counts the money.

<<stateman>>

<<actionsman>>

<<if $enemyhealth lte 0>>
<<click [[Next|Bully Whore Molestation Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|Bully Whore Molestation Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|Bully Whore Molestation]]>><</click>><<nexttext>>
<</if>>

:: Bully Whore Molestation Finish [nobr]
<<if $enemyarousal gte $enemyarousalmax>>
<<ejaculation>><<set $forcedprostitutionstat += 1>>

"I hope you're satisfied," Whitney says. "Give another £20 and I'll let you have another go."

"I don't think my heart could take it," the <<person>> says. "Another time maybe."

<<tearful>> you stagger from the alley.

<<clotheson>>
<<endcombat>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>

<<elseif $enemyhealth lte 0>>

<<endcombat>>

"Fuck!" the <<person>> shouts as <<he>> backs away from you. "I want my money back. This one has rabies or something."

Whitney laughs. "There's nothing wrong with it. You're just a weakling. Come back with more money and you can have a another go."

<<tearful>> you leave the alley.

<<clotheson>>
<<endcombat>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>

<</if>>

:: Bully Light 2 [nobr]
<<set $outside to 1>><<set $location to "town">><<effects>>

<<He>> starts jogging towards you as <<he>> gets closer. "Hang on there <<girlstop>> Won't take long." <<He>> walks behind you. Your bonds come loose. "You alright?"

<<unbind>>
"Tha-" you begin, but Whitney interrupts you from the other side of the road. "What are you doing? Just fuck <<phim>> already."

One of the <<persons>> crewmates catches up and stares at Whitney. "Something's wrong with that kid. Damn."

"You shouldn't tie your friend up like that," the <<person>> shouts back at Whitney. "Not in this town especially."

<<endevent>><<whitney>><<person1>>

Whitney steps forward, fists clenched. <<His>> gang doesn't seem so eager to start a fight though. Two of them pull <<him>> back. "You weak fucks," <<he>> shouts, you're not sure at who. "I hope you fish fuckers get raped by a whale." <<He>> turns with <<his>> friends and walks away.

The crew make sure you're okay, then head back to their ship.

<<endevent>>

<<click [[Next|Mer Street]]>><<set $eventskip to 1>><</click>>

:: School Leave Whitney [nobr]
<<set $outside to 1>><<set $location to "school">><<schooleffects>><<effects>>

<<if $whitneyromance is 1>>

	<<if $rng gte 81>>
<<whitney>><<person1>>Whitney's busy arguing with one of <<his>> friends and doesn't spot you. Another of <<his>> friends, a <<generatey2>><<person2>><<person>> does though, and walks over to you. "You're Whitney's slut," <<he>> says. "Think I fancy a piece myself." You withdraw into a defensive posture as <<he>> tries to grope your <<genitalsstop>>

The <<person2>><<person>> turns just in time to get smacked in the face. Whitney grasps <<his>> collar and pulls <<him>> close. "Keep your <<if $pronoun is "m">>pervert hands<<else>>skanky ass<</if>> away from my slut." Whitney shoves <<him>> aside. <<He>> turns away, red in the face as Whitney grabs your arm and tugs.

<<endevent>><<whitney>><<person1>><<He>> pulls you away from <<his>> friends, behind the bike shed. "The nerve of that cunt," <<he>> says. "I need to vent," <<he>> shoves you to the ground and drops on top of you.

<<click [[Next|School Leave Whitney Rape]]>><<set $molestationstart to 1>><</click>>

	<<else>>
<<whitney>><<person1>>Whitney spots you approach the gate. <<He>> shoves one of <<his>> friends out of the way and marches towards you. <<He>> pushes you against a wall and holds your hands above your head in <<his>> own. "Almost missed you," <<he>> says. <<He>> kisses you, still pressing your arms against the wall. "You wouldn't do that to me, would you?" <<He>> kisses once more before releasing you. <<He>> slaps your <<bottom>> as you leave.<<gstress>><<garousal>><<glust>><<gstress60>><<garousal60>><<set $whitneylust += 5>>

<<click [[Next|Oxford Street]]>><<endevent>><</click>>

	<</if>>
<<else>>
	<<if $rng gte 81>>
<<whitney>><<person1>>Whitney spots you approach the gate. "Where do you think you're going," <<he>> says. "You haven't paid the toll." <<He>> grasps <<his>> crotch and <<his>> friends laugh.<<gtrauma>><<gstress>><<gtrauma60>><<gstress60>><<glust>><<set $whitneylust += 5>>

	<<click [[Next|Oxford Street]]>><<endevent>><</click>>

	<<elseif $rng gte 61>>
<<whitney>><<person1>>You hear footsteps behind you. Before you can turn, Whitney leaps on your back and wraps <<his>> arms around your neck. "Giddy up, <<bitchcomma>>" <<he>> says. The weight forces you to your knees. "You're a shit horse. Maybe you need to be ridden more." <<He>> turns to <<his>> friends. "Any takers?" They laugh as you climb to your feet.<<gtrauma>><<gstress>><<gtrauma60>><<gstress60>><<glust>><<set $whitneylust += 5>>

<<click [[Next|Oxford Street]]>><<endevent>><</click>>

	<<elseif $rng gte 41>>
	<<whitney>><<person1>>Whitney spots you approach the gate. "Look who it is," <<he>> shouts. <<His>> friends turn to watch you. "Look at the way <<pshe>> walks. I bet <<pshes>> sore after fucking all the teachers." They laugh.<<gtrauma>><<gstress>><<gtrauma60>><<gstress60>><<glust>><<set $whitneylust += 5>>

	<<click [[Next|Oxford Street]]>><<endevent>><</click>>

	<<elseif $rng gte 21>>

	<<whitney>><<person1>>Whitney spots you approach the gate. <<He>> blocks your path. "Where do you think you're going?" <<he>> says. "There's a toll for passing through." <<He>> holds out a hand. "Twenty quid. Or I'll take something else as payment."

		<<if $money gte 2000>>
	<<click [[Pay up|School Leave Whitney Pay]]>><<set $money -= 2000>><<set $submissive += 1>><</click>><<gdom>>

		<</if>>
		<<click [[Say you can't afford it|School Leave Whitney Strip]]>><<set $phase to 0>><<set $molestationstart to 1>><</click>>

		<<click [[Shove|School Leave Whitney Strip]]>><<set $submissive -= 1>><<set $whitneydom -= 1>><<set $phase to 1>><<set $molestationstart to 1>><</click>><<ldom>>

	<<else>>
	<<whitney>><<person1>>You walk past Whitney. You feel a sting on your arm and turn to see Whitney putting <<his>> cigarette out on it. <<He>> gives you an innocent smile.<<gpain>><<set $pain += 20>><<gtrauma>><<gstress>><<gtrauma60>><<gstress60>><<glust>><<set $whitneylust += 5>>

	<<endevent>>

	<<click [[Next|Oxford Street]]>><<endevent>><</click>>

	<</if>>
<</if>>

:: School Leave Whitney Rape [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>><<set $enemyanger += 60>>
<<endif>>

<<effects>>
<<effectsman>><<man>>

<<audience>>

<<stateman>>

<<actionsman>>

<<if $enemyarousal gte $enemyarousalmax>>
<<click [[Next|School Leave Whitney Rape Finish]]>><</click>><<nexttext>>
<<elseif $enemyhealth lte 0>>
<<click [[Next|School Leave Whitney Rape Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|School Leave Whitney Rape]]>><</click>><<nexttext>>
<</if>>

:: School Leave Whitney Rape Finish [nobr]
<<effects>>
<<if $enemyarousal gte $enemyarousalmax>>
<<ejaculation>><<set $whitneylust -= 20>>

"Maybe you'll smell like me now," <<he>> says. "I read somewhere that affects people subconciously." <<He>> pulls a cigarette from <<his>> shirt pocket. "Later <<girlstop>>"<<llust>>

<<tearful>> you climb to your feet.

<<clotheson>>
<<endcombat>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>
<<else>>

Whitney shouts in pain and staggers away from you. <<tearful>> you climb to you feet. <<He>> swipes at you but misses as you flee out from behind the shed. You leave the school.<<set $whitneydom -= 1>><<ldom>>

<<clotheson>>
<<endcombat>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>

<</if>>

:: School Leave Whitney Pay [nobr]
<<set $outside to 1>><<set $location to "school">><<schooleffects>><<effects>>

You hand Whitney the money. "Nice doing business," <<he>> says. <<He>> barges past you.<<gtrauma>><<gstress>><<gtrauma60>><<gstress60>><<glust>><<set $whitneylust += 5>>

<<click [[Next|Oxford Street]]>><<endevent>><</click>>

:: School Leave Whitney Strip [nobr]
<<if $molestationstart is 1>>
<<set $molestationstart to 0>>
<<controlloss>>
<<violence1>>
<<neutral1>>
<<molested>>
<<set $event to "molestationhome">>
<<man1init>><<npcstrip>><<npcidlegenitals>>
	<<if $phase is 0>>
	"Oh, I think you can," <<he>> says. <<He>> lunges for you. <<His>> friends cheer <<him>> on.

	<<elseif $phase is 1>>
	You shove Whitney away. "Slut," <<he>> snarls. "I'm gonna show everyone." <<He>> lunges for you. <<His>> friends cheer <<him>> on.

	<</if>>
<<if $delinquency lt 400>><<set $rescue to 1>><</if>>
<<endif>>

<<effects>>
<<effectsman>><<man>>

<<if $alarm is 1 and $rescue is 0>><<set $alarm to 0>>
No one comes to your aid, likely due to your reputation as a delinquent.

<</if>>

<<audience>>

<<stateman>>

<<actionsman>>

<<if $alarm is 1 and $rescue is 1>>
<<click [[Next|School Leave Whitney Strip Finish]]>><</click>><<nexttext>>
<<elseif $uppertype is "naked" and $lowertype is "naked" and $undertype is "naked">>
<<click [[Next|School Leave Whitney Strip Finish]]>><</click>><<nexttext>>
<<elseif $uppertype is "naked" and $lowertype is "naked" and $undertype is "chastity">>
<<click [[Next|School Leave Whitney Strip Finish]]>><</click>><<nexttext>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<click [[Next|School Leave Whitney Strip Finish]]>><</click>><<nexttext>>
<<elseif $enemyhealth lte 0>>
<<click [[Next|School Leave Whitney Strip Finish]]>><</click>><<nexttext>>
<<else>>
<<click [[Next|School Leave Whitney Strip]]>><</click>><<nexttext>>
<</if>>

:: School Leave Whitney Strip Finish [nobr]
<<if $enemyhealth lte 0>>

Whitney stumbles backwards. <<tearful>> you push past <<his>> friends and flee to safety.

<<clotheson>>
<<endcombat>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>
<<elseif $enemyarousal gte $enemyarousalmax>>
<<ejaculation>><<set $whitneylust -= 20>>

<<tearful>> you push past <<his>> friends and flee to safety.<<llust>>

<<clotheson>>
<<endcombat>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>
<<elseif $alarm is 1 and $rescue is 1>>

<<endcombat>>

<<doren>><<person1>>"Leave the <<if $playergenderappearance is "m">>lad<<else>>lass<</if>> alone," Doren shouts across the playground.<<endevent>><<whitney>><<person1>> Whitney shoves you away. "I wasn't doing nothing," <<he>> protests. <<tearful>> you push past <<his>> friends and flee to safety.

<<clotheson>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>

<<else>>

Whitney steps back to look at you. <<covered>> <<His>> friends jeer at you. "Hey everyone!" Whitney shouts, trying to attract more attention to your situation.<<glust>><<set $whitneylust += 5>><<fameexhibitionism30>>

<<endcombat>>
<<doren>><<person1>>Doren pushes through the crowd. <<He>> scowls when <<he>> sees you and Whitney. "Give the <<if $playergenderappearance is "m">>lad<<else>>lass<</if>> <<pher>> clothes back," <<he>> says. "Now."

Whitney hesitates, but relents and throws the clothes on top of you. "Come on. I think we showed <<phimstop>>"

Doren holds <<his>> large coat around you and looks away as you dress.

<<clothesontowel>>

"Are you alri-" <<he>> begins, but is cut off by a scream on the other side of the playground. <<He>> sighs. "Sorry." <<He>> leaves to investigate the noise.

<<endevent>>

<<click [[Next|Oxford Street]]>><<set $eventskip to 1>><</click>>

<</if>>

license: unknown


code:
:: Testing Wardrobe [nobr testing]
<<testingroomlist>>
<<effects>>

<<wardrobesystem "Testing Wardrobe">>

:: Testing Sprite [nobr testing]
<<testingroomlist>>
<<effects>>
<<if $outertop>><<set $outertop.state to "waist">><</if>>
<<if $outerbottom>><<set $outerbottom.state to "waist">><</if>>
<<if $outertop>><<set $outertop.state to "waist">><</if>>
<<if $outerbottom>><<set $outerbottom.state to "waist">><</if>>
<<if $outertop>><<set $outertop.state to "waist">><</if>>
<<if $outerbottom>><<set $outerbottom.state to "waist">><</if>>
<<combatimg>>

:: Testing Shop [nobr testing]
<<testingroomlist>>
<<effects>>

/*
ToDo:  Add handling for theft including crime increase

ToDo:  Add handling for 'try on clothing' - probably only after apropriate scenes are made.

*/
''Tops:''

<<if $temptype is "t-shirt">><<radiobutton "$temptype" "t-shirt" checked>>
<<else>><<radiobutton "$temptype" "t-shirt">><</if>>
T-Shirt  |
<<if $temptype is "tank top">><<radiobutton "$temptype" "tank top" checked>>
<<else>><<radiobutton "$temptype" "tank top">><</if>>
Tank Top  |
<<if $temptype is "bikini top">><<radiobutton "$temptype" "bikini top" checked>>
<<else>><<radiobutton "$temptype" "bikini top">><</if>>
Bikini Top  |
<<if $temptype is "pyjama shirt">><<radiobutton "$temptype" "pyjama shirt" checked>>
<<else>><<radiobutton "$temptype" "pyjama shirt">><</if>>
Pyjama Shirt  |
<<if $temptype is "towel top">><<radiobutton "$temptype" "towel top" checked>>
<<else>><<radiobutton "$temptype" "towel top">><</if>>
Towel (top)

''Bottoms:''

<<if $temptype is "shorts">><<radiobutton "$temptype" "shorts" checked>>
<<else>><<radiobutton "$temptype" "shorts">><</if>>
Shorts  |
<<if $temptype is "bikini bottoms">><<radiobutton "$temptype" "bikini bottoms" checked>>
<<else>><<radiobutton "$temptype" "bikini bottoms">><</if>>
Bikini Bottoms  |
<<if $temptype is "pyjama bottoms">><<radiobutton "$temptype" "pyjama bottoms" checked>>
<<else>><<radiobutton "$temptype" "pyjama bottoms">><</if>>
Pyjama Bottoms  |
<<if $temptype is "towel bottom">><<radiobutton "$temptype" "towel bottom" checked>>
<<else>><<radiobutton "$temptype" "towel bottom">><</if>>
Towel (bottom)

''School:''

<<if $temptype is "school shirt">><<radiobutton "$temptype" "school shirt" checked>>
<<else>><<radiobutton "$temptype" "school shirt">><</if>>
School Shirt  |
<<if $temptype is "school shorts">><<radiobutton "$temptype" "school shorts" checked>>
<<else>><<radiobutton "$temptype" "school shorts">><</if>>
School Shorts  |
<<if $temptype is "school skirt">><<radiobutton "$temptype" "school skirt" checked>>
<<else>><<radiobutton "$temptype" "school skirt">><</if>>
School Skirt  |
<<if $temptype is "school swimsuit">><<radiobutton "$temptype" "school swimsuit" checked>>
<<else>><<radiobutton "$temptype" "school swimsuit">><</if>>
School Swimsuit  |
<<if $temptype is "school swim shorts">><<radiobutton "$temptype" "school swim shorts" checked>>
<<else>><<radiobutton "$temptype" "school swim shorts">><</if>>
School Swim Shorts

''Underwear:''

<<if $temptype is "Y fronts">><<radiobutton "$temptype" "Y fronts" checked>>
<<else>><<radiobutton "$temptype" "Y fronts">><</if>>
Y Fronts  |
<<if $temptype is "plain panties">><<radiobutton "$temptype" "plain panties" checked>>
<<else>><<radiobutton "$temptype" "plain panties">><</if>>
Plain Panties  |
<<if $temptype is "lace panties">><<radiobutton "$temptype" "lace panties" checked>>
<<else>><<radiobutton "$temptype" "lace panties">><</if>>
Lace Panties

''Other:''

<<if $temptype is "sundress">><<radiobutton "$temptype" "sundress" checked>>
<<else>><<radiobutton "$temptype" "sundress">><</if>>
Sundress  |
<<if $temptype is "evening gown">><<radiobutton "$temptype" "evening gown" checked>>
<<else>><<radiobutton "$temptype" "evening gown">><</if>>
Evening Gown  |
<<if $temptype is "waist apron">><<radiobutton "$temptype" "waist apron" checked>>
<<else>><<radiobutton "$temptype" "waist apron">><</if>>
Waist Apron

''Color Selection:''

<<if $tempcolour is "white">><<radiobutton "$tempcolour" "white" checked>>
<<else>><<radiobutton "$tempcolour" "white">><</if>>
White |
<<if $tempcolour is "pink">><<radiobutton "$tempcolour" "pink" checked>>
<<else>><<radiobutton "$tempcolour" "pink">><</if>>
Pink |
<<if $tempcolour is "red">><<radiobutton "$tempcolour" "red" checked>>
<<else>><<radiobutton "$tempcolour" "red">><</if>>
Red |
<<if $tempcolour is "orange">><<radiobutton "$tempcolour" "orange" checked>>
<<else>><<radiobutton "$tempcolour" "orange">><</if>>
Orange |
<<if $tempcolour is "yellow">><<radiobutton "$tempcolour" "yellow" checked>>
<<else>> <<radiobutton "$tempcolour" "yellow">><</if>>
Yellow |
<<if $tempcolour is "green">><<radiobutton "$tempcolour" "green" checked>>
<<else>><<radiobutton "$tempcolour" "green">><</if>>
Green |
<<if $tempcolour is "blue">><<radiobutton "$tempcolour" "blue" checked>>
<<else>><<radiobutton "$tempcolour" "blue">><</if>>
Blue |
<<if $tempcolour is "purple">><<radiobutton "$tempcolour" "purple" checked>>
<<else>><<radiobutton "$tempcolour" "purple">><</if>>
Purple  |
<<if $tempcolour is "black">><<radiobutton "$tempcolour" "black" checked>>
<<else>><<radiobutton "$tempcolour" "black">><</if>>

''Action:''

<<if $tempaction is "wear">><<radiobutton "$tempaction" "wear" checked>>
<<else>><<radiobutton "$tempaction" "wear">><</if>>
Wear |
<<if $tempaction is "store">><<radiobutton "$tempaction" "store" checked>>
<<else>><<radiobutton "$tempaction" "store">><</if>>
Send Home

<<button "Buy Now!" "Testing Shop">><<buyclothes $tempcolour $temptype $tempaction>><</button>>
 - - - or - - -
<<button "Delete All Clothes" "Testing Shop">>
<<set $outertop to 0>><<set $outerbottom to 0>><<set $top to 0>><<set $bottom to 0>><<set $undertop to 0>><<set $underbottom to 0>><<set $legs to 0>><<set $feet to 0>><<set $headacc to 0>><<set $faceacc to 0>><<set $neckacc to 0>><<set $underacc to 0>><<set $wardrobe to []>><</button>>
 - - - or - - -
<<button "Give Money!" "Testing Shop">><<set $money += 5000>><</button>>

''Temp Items:''
<<link [[Get Plant Top|Testing Shop]]>><<giveclothes "green" "plant top" "wear">><</link>> |
<<link [[Get Plant Skirt|Testing Shop]]>><<giveclothes "green" "plant skirt" "wear">><</link>>

''Lewd Items:''
<<link [[Toggle Chastity Belt|Testing Shop]]>>
  <<if $underacc.name is "chastity belt">><<set $underacc to 0>>
  <<else>><<giveclothes "" "chastity belt" "wear">><</if>><</link>> |
<<link [[Toggle Collar|Testing Shop]]>>
  <<if $neckacc.name is "collar">><<set $neckacc to 0>>
  <<else>><<giveclothes "" "collar" "wear">><</if>><</link>>

''Accessories:''
<<link [[Get Hairpin|Testing Shop]]>><<giveclothes "" "hairpin" "wear">><</link>> |
<<link [[Get Beanie|Testing Shop]]>><<giveclothes "" "beanie" "wear">><</link>> |
<<link [[Get Glasses|Testing Shop]]>><<giveclothes "" "glasses" "wear">><</link>> |
<<link [[Get Cool Shades|Testing Shop]]>><<giveclothes "" "shades" "wear">><</link>>

''Socks:''
<<link [[Get Pink Gym Socks|Testing Shop]]>><<giveclothes "pink" "gym socks" "wear">><</link>> |
<<link [[Get Blue Gym Socks|Testing Shop]]>><<giveclothes "blue" "gym socks" "wear">><</link>>

''Stockings:''
<<link [[Get Fishnet Stockings|Testing Shop]]>><<giveclothes "fishnet" "stockings" "wear">><</link>> |
<<link [[Get Sheer Stockings|Testing Shop]]>><<giveclothes "sheer" "stockings" "wear">><</link>>

''Tights:''
<<link [[Get Brown Tights|Testing Shop]]>><<giveclothes "brown" "tights" "wear">><</link>> |
<<link [[Get Sheer Tights|Testing Shop]]>><<giveclothes "sheer" "tights" "wear">><</link>>

''Feet:''
<<link [[Get Black Shoes|Testing Shop]]>><<giveclothes "" "shoes" "wear">><</link>>

<<link "Reset Debug" "Testing Wardrobe">><<set $debugtxt to []>><</link>>

Print Debug: <<print $debugtxt>>

:: Testing Text [nobr testing]
<<testingroomlist>>
<<effects>>

Passage: $passage

Tags: $tags

Version: $version
Step: $step

<<link "Reset Debug" passage()>><<set $debugtxt to []>><</link>>

Print Debug: <<print $debugtxt>>

<<if $outertop is 0>>
  <<if $outerbottom is 0>>
<<else>> /*wearing outertop*/
  <</if>><</if>>

  <<if $upperclothes is "naked">>
	<<if $lowerclothes is "naked">>
		<<if $underclothes is "naked">>
		You are completely naked!
		<</if>>
		<<if $underclothes isnot "naked">>
		You are wearing nothing but a <<if $undertype isnot "chastity">>pair of <</if>><<underintegrity>> $undercolour $underclothes.
		<</if>>
	<</if>>
	<<if $lowerclothes isnot "naked">>
		<<if $underclothes is "naked">>
		You are topless and wearing no underwear but your lower half is covered by <<lowerword>> <<lowerintegrity>> $lowercolour $lowerclothes.
		<</if>>
		<<if $underclothes isnot "naked">>
		You are topless with <<lowerword>> <<lowerintegrity>> $lowercolour $lowerclothes and <<underword>> <<underintegrity>> $undercolour $underclothes.
		<</if>>
	<</if>>
<<elseif $upperclothes isnot "naked">>
	<<if $lowerclothes is "naked">>
		<<if $underclothes is "naked">>
			<<if $upperonepiece is 1 and $lowerset isnot $upperset>>
			You are wearing <<upperword>> <<upperintegrity>> $uppercolour $upperclothes that has been torn at the waist  leaving your bottom half completely exposed!
			<<else>>
		Your bottom half is completely exposed! You are wearing <<upperword>> <<upperintegrity>> $uppercolour $upperclothes.
			<</if>>
		<</if>>
		<<if $underclothes isnot "naked">>
			<<if $upperonepiece is 1 and $lowerset isnot $upperset>>
			You are wearing <<upperword>> <<upperintegrity>> $uppercolour $upperclothes that has been torn at the waist  leaving your <<underword>> <<underintegrity>> $undercolour $underclothes exposed.
			<<else>>
		You are wearing <<upperword>> <<upperintegrity>> $uppercolour $upperclothes and exposed <<underword>> <<underintegrity>> $undercolour $underclothes.
			<</if>>
		<</if>>
	<</if>>
	<<if $lowerclothes isnot "naked">>
		<<if $underclothes is "naked">>
		You are wearing <<upperword>> <<upperintegrity>> $uppercolour $upperclothes
		<<if $loweronepiece isnot 1>>and <<lowerword>> <<lowerintegrity>> $lowercolour $lowerclothes
		<</if>>
		<<if $lowertype is "swim">>and<<else>>but<</if>> you are not wearing underwear.
		<</if>>
		<<if $underclothes isnot "naked">><<nobr>>
		You are wearing <<upperword>> <<upperintegrity>> $uppercolour $upperclothes
		<<if $loweronepiece isnot 1>>with <<lowerword>> <<lowerintegrity>> $lowercolour $lowerclothes
		<</if>>and <<underword>> <<underintegrity>> $undercolour $underclothes.
		<<endnobr>><</if>>
	<</if>>
<</if>>

:: Testing Variables [nobr testing]
<<testingroomlist>>
<<effects>>
<<variablebar "Pain" "$pain" 0 2 20 200>>
<<variablebar "Arousal" "$arousal" 0 100 1000 10000>>
<<variablebar "Fatigue" "$tiredness" 0 20 200 2000>>
<<variablebar "Stress" "$stress" 0 100 1000 10010>>
<<variablebar "Trauma" "$trauma" 0 50 500 5000>>

<<variablebar "Promiscuity" "$promiscuity" 0 1 10 100>>
<<variablebar "Exhibitionism" "$exhibitionism" 0 1 10 100>>

Toggle:
<<link "Gender">><<if $playergender is "f">>
<<set $vaginaexist to 0>><<set $playergender to "m">><<set $penisexist to 1>>
<<else>><<set $penisexist to 0>><<set $playergender to "f">><<set $vaginaexist to 1>><</if>>
<<goto "Testing Variables">><</link>>  |
<<link "Virginity">>
<<if $penilevirginity is 0 or $vaginalvirginity is 0>>
  <<set $penilevirginity to 1>><<set $vaginalvirginity to 1>><<set $oralvirginity to 1>><<set $analvirginity to 1>>
<<else>>
  <<set $penilevirginity to 0>><<set $vaginalvirginity to 0>><<set $oralvirginity to 0>><<set $analvirginity to 0>>
<</if>>
<<goto "Testing Variables">><</link>> |
<<link "Hirsute">>
<<if $hirsutedisable is "f">><<set $hirsutedisable to "t">>
<<else>><<set $hirsutedisable to "f">><</if>>
<<goto "Testing Variables">><</link>>  |
<<link "Bound Left Arm">>
<<if $leftarm is "bound">><<set $leftarm to 0>><<set $leftboundcarry to 0>>
<<else>><<set $leftarm to "bound">><</if>>
<<goto "Testing Variables">><</link>>  |
<<link "Bound Right Arm">>
<<if $rightarm is "bound">><<set $rightarm to 0>><<set $rightboundcarry to 0>>
<<else>><<set $rightarm to "bound">><</if>>
<<goto "Testing Variables">><</link>>

Breast Size - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

Hair Colour (<<= $haircolour>>):
<<link "Black">><<set $haircolour to "black">><<goto "Testing Variables">><</link>> |
<<link "Brown">><<set $haircolour to "brown">><<goto "Testing Variables">><</link>> |
<<link "Red">><<set $haircolour to "red">><<goto "Testing Variables">><</link>> |
<<link "Ginger">><<set $haircolour to "ginger">><<goto "Testing Variables">><</link>> |
<<link "Blond">><<set $haircolour to "blond">><<goto "Testing Variables">><</link>> |
<<link "Green">><<set $haircolour to "green">><<goto "Testing Variables">><</link>> |
<<link "Blue">><<set $haircolour to "blue">><<goto "Testing Variables">><</link>> |
<<link "Purple">><<set $haircolour to "purple">><<goto "Testing Variables">><</link>>

<<variablebar "Hair Length" "$hairlength" 0 10 100 1000>>

Eye Colour (<<= $eyecolour>>):
<<link "Hazel">><<set $eyecolour to "hazel">><<goto "Testing Variables">><</link>> |
<<link "Amber">><<set $eyecolour to "amber">><<goto "Testing Variables">><</link>> |
<<link "Green">><<set $eyecolour to "green">><<goto "Testing Variables">><</link>> |
<<link "Dark Blue">><<set $eyecolour to "dark blue">><<goto "Testing Variables">><</link>> |
<<link "Light Blue">><<set $eyecolour to "light blue">><<goto "Testing Variables">><</link>> |
<<link "Purple">><<set $eyecolour to "purple">><<goto "Testing Variables">><</link>>

<<link "<">><<set $wolfgirl -= 1>><<goto "Testing Variables">><</link>>
Wolf (<<= $wolfgirl>>)
<<link ">">><<set $wolfgirl += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $angel -= 1>><<goto "Testing Variables">><</link>>
Angel (<<= $angel>>)
<<link ">">><<set $angel += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $demon -= 1>><<goto "Testing Variables">><</link>>
Demon (<<= $demon>>)
<<link ">">><<set $demon += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $fallenangel -= 1>><<goto "Testing Variables">><</link>>
Fallen Angel (<<= $fallenangel>>)
<<link ">">><<set $fallenangel += 1>><<goto "Testing Variables">><</link>>

Semen:
<<link "<">><<set $vaginasemen -= 1>><<goto "Testing Variables">><</link>>
Vagina (<<= $vaginasemen>>)
<<link ">">><<set $vaginasemen += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $anussemen -= 1>><<goto "Testing Variables">><</link>>
Anus (<<= $anussemen>>)
<<link ">">><<set $anussemen += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $mouthsemen -= 1>><<goto "Testing Variables">><</link>>
Mouth (<<= $mouthsemen>>)
<<link ">">><<set $mouthsemen += 1>><<goto "Testing Variables">><</link>>

Goo:
<<link "<">><<set $vaginagoo -= 1>><<goto "Testing Variables">><</link>>
Vagina (<<= $vaginagoo>>)
<<link ">">><<set $vaginagoo += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $anusgoo -= 1>><<goto "Testing Variables">><</link>>
Anus (<<= $anusgoo>>)
<<link ">">><<set $anusgoo += 1>><<goto "Testing Variables">><</link>> |
<<link "<">><<set $mouthgoo -= 1>><<goto "Testing Variables">><</link>>
Mouth (<<= $mouthgoo>>)
<<link ">">><<set $mouthgoo += 1>><<goto "Testing Variables">><</link>>

Parasite:
<<link "Chest">>
<<if $chestparasite is 0>><<set $chestparasite to 1>>
<<else>><<set $chestparasite to 0>><</if>>
<<goto "Testing Variables">><</link>>  |
<<link "Penis">>
<<if $penisparasite is 0>><<set $penisparasite to 1>>
<<else>><<set $penisparasite to 0>><</if>>
<<goto "Testing Variables">><</link>>  |
<<link "Clit">>
<<if $clitparasite is 0>><<set $clitparasite to 1>>
<<else>><<set $clitparasite to 0>><</if>>
<<goto "Testing Variables">><</link>>

<<if $outertop isnot 0>>
Outerclothes Top:  <<link "<<">><<set $outertop.integrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $outertop.integrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $outertop.integrity>>)
<<link ">">><<set $outertop.integrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $outertop.integrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $outertop.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $outertop.wet>>)
<<link ">">><<set $outertop.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $outerbottom isnot 0>>
Outerclothes Bottom:  <<link "<<">><<set $outerbottom.botintegrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $outerbottom.botintegrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $outerbottom.botintegrity>>)
<<link ">">><<set $outerbottom.botintegrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $outerbottom.botintegrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $outerbottom.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $outerbottom.wet>>)
<<link ">">><<set $outerbottom.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $top isnot 0>>
Upper Clothes:  <<link "<<">><<set $top.integrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $top.integrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $top.integrity>>)
<<link ">">><<set $top.integrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $top.integrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $top.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $top.wet>>)
<<link ">">><<set $top.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $bottom isnot 0>>
Lower Clothes:  <<link "<<">><<set $bottom.botintegrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $bottom.botintegrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $bottom.botintegrity>>)
<<link ">">><<set $bottom.botintegrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $bottom.botintegrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $bottom.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $bottom.wet>>)
<<link ">">><<set $bottom.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $undertop isnot 0>>
Underclothes Top:  <<link "<<">><<set $undertop.integrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $undertop.integrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $undertop.integrity>>)
<<link ">">><<set $undertop.integrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $undertop.integrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $undertop.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $undertop.wet>>)
<<link ">">><<set $undertop.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $underbottom isnot 0>>
Underclothes Bottom:  <<link "<<">><<set $underbottom.botintegrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $underbottom.botintegrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $underbottom.botintegrity>>)
<<link ">">><<set $underbottom.botintegrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $underbottom.botintegrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $underbottom.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $underbottom.wet>>)
<<link ">">><<set $underbottom.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $underacc isnot 0>>
Under Accessory:  <<link "<<">><<set $underacc.botintegrity -= 1000>><<goto "Testing Variables">><</link>>
<<link "<">><<set $underacc.botintegrity -= 100>><<goto "Testing Variables">><</link>>
Integrity (<<= $underacc.botintegrity>>)
<<link ">">><<set $underacc.botintegrity += 100>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $underacc.botintegrity += 1000>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $underacc.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $underacc.wet>>)
<<link ">">><<set $underacc.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>
<<if $legs isnot 0>>
Leggings and Socks:  <<link "<<">><<set $legs.integrity -= 10>><<goto "Testing Variables">><</link>>
<<link "<">><<set $legs.integrity -= 1>><<goto "Testing Variables">><</link>>
Integrity (<<= $legs.integrity>>)
<<link ">">><<set $legs.integrity += 1>><<goto "Testing Variables">><</link>>
<<link ">>">><<set $legs.integrity += 10>><<goto "Testing Variables">><</link>>  |
<<link "<">><<set $legs.wet -= 1>><<goto "Testing Variables">><</link>>
Wet (<<= $legs.wet>>)
<<link ">">><<set $legs.wet += 1>><<goto "Testing Variables">><</link>>

<</if>>

:: Widgets Testing [widget]
<<widget "testingroomlist">><<nobr>>
<<if $passage is "Testing Wardrobe">> ''[[Wardrobe|Testing Wardrobe]]''
<<else>> [[Wardrobe|Testing Wardrobe]] <</if>> |
<<if $passage is "Testing Shop">> ''[[Shop|Testing Shop]]''
<<else>> [[Shop|Testing Shop]] <</if>> |
<<if $passage is "Testing Sprite">> ''[[Sprite|Testing Sprite]]''
<<else>> [[Sprite|Testing Sprite]] <</if>> |
<<if $passage is "Testing Text">> ''[[Text|Testing Text]]''
<<else>> [[Text|Testing Text]] <</if>> |
<<if $passage is "Testing Variables">> ''[[Variables|Testing Variables]]''
<<else>> [[Variables|Testing Variables]] <</if>>

<</nobr>><</widget>>

<<widget "variablebar">><<nobr>>
<<= '[["|<"|' + $passage + '][' + $args[1] + ' to ' + $args[2] + ']]'>>
<<= '[["<<"|' + $passage + '][' + $args[1] + ' -= ' + $args[4] + ']]'>>
<<= '[["<"|' + $passage + '][' + $args[1] + ' -= ' + $args[3] + ']]'>>
<<= '[[">"|' + $passage + '][' + $args[1] + ' += ' + $args[3] + ']]'>>
<<= '[[">>"|' + $passage + '][' + $args[1] + ' += ' + $args[4] + ']]'>>
<<= '[[">|"|' + $passage + '][' + $args[1] + ' to ' + $args[5] + ']]'>>
$args[0] ($args[1])

<</nobr>><</widget>>


code:
#!/bin/bash
if [ ! -d ".git" ]; then
	#not running in git repo, so can't use git commands :-)
	echo "No .git repo found - skipping sanity checks"
	exit 0
fi

WARNING='\033[93m'
WARNING='\033[93m'
ENDC='\033[0m'

myprint() {
	while read data; do
		echo -n -e "[$1]$WARNING"
		echo "$data"
	done
}

GREP="git grep -n --color"
# Check for missing right angle bracket: <</if>
$GREP "<</[^>]*>[^>]" -- 'game/*'  | myprint "MissingClosingAngleBracket"
$GREP "<<[^>()]*>[^()<>"$'\r]*\r'"\?$" -- 'game/*' | myprint "MissingClosingAngleBracket"
# Check for missing left angle bracket: </if>>
$GREP "\([^<]\|^\)</\?\(if\|else\|case\|set\|print\|elseif\)" -- 'game/*' | myprint "MissingOpeningAngleBracket2"
# Check for accidental assignment.  e.g.:   <<if $foo = "hello">>
$GREP "<<[ ]*if[^>=]*[^><\!=]=[^=][^>]*>>" -- 'game/*' | myprint "AccidentalAssignmentInIf"
# Check for accidental assignment.  e.g.:   <<elseif $foo = "hello">>
$GREP "<<[ ]*elseif[^>=]*[^><\!=]=[^=][^>]*>>" -- 'game/*' | myprint "AccidentalAssignmentInElseIf"
# Check for missing ".  e.g.:   <<if $foo == "hello>>
$GREP "<<[^\"<>]*\"[^\"<>]*>>" -- 'game/*' | myprint "MissingSpeechMark"
# Check for missing ".  e.g.:   <<if $foo = "hello)
$GREP -e "<<[^\"<>]*\([^\"<>]*\"[^><\"]*\"\| [<>] \)*\"\([^\"<>]*\"[^><\"]*\"\| [<>] \)*\([^\"<>]\| [<>] \)*>>" --and --not -e "*[^']*" -- 'game/*' | myprint "MissingSpeechMark2"
# Check for colors like: @@color:red   - should be @@.red
$GREP -e "@@color:" --and --not -e  "@@color:rgb([0-9 ]\+,[0-9 ]\+,[0-9 ]\+)" -- "game/*" | myprint "UseCssColors"
# Check for missing $ in activeSlave or PC
$GREP "<<[ ]*[^\$><_\[]*\(activeSlave\|PC\)[.]"  -- "game/*" | myprint "MissingDollar"
# Check for closing bracket without opening bracket.  e.g.:  <<if foo)>>      (but  <<case "foo")>>   is valid, so ignore those
$GREP -e "<<[ a-zA-Z]\+\([^()<>]\|[^()<>][<>][^()<>]\)*)" --and --not -e "<< *case"  -- "game/*" | myprint "MissingOpeningBracket"
# Check for opening bracket without closing bracket.  e.g.:  <<if (foo>>
$GREP -e "<<[ a-zA-Z]\([^<>]\|[^<>][<>][^<>]\)\+(\([^()<>]\|[^<>()][<>][^<>()]\|([^<>()]*])\)*>>" -- "game/*" | myprint "MissingClosingBracket"
# Check for two closing brackets but one opening bracket.  e.g.:  <<if (foo))>>
$GREP -e "<<[ a-zA-Z]\+[^()<>]*([^()]*)[^()]*)[^()<>]*>>"  -- "game/*" | myprint "MissingOpeningBracket2"
# Check for one closing bracket but two opening brackets.  e.g.:  <<if ((foo)>>
$GREP -e "<<[ a-zA-Z]\+[^()<>]*([^()]*([^()]*)[^()<>]*>>"  -- "game/*" | myprint "MissingClosingBracket2"
$GREP -e "<<.*[(][^<>)]*[(][^<>)]*)\?[^<>)]*>>" -- "game/*" | myprint "MissingClosingBracket3"
# Check for missing >>.  e.g.:   <<if $foo
$GREP "<<[^<>]*[^,\"\[{"$'\r]\r'"\?$" -- 'game/*' | myprint "MissingClosingAngleBrackets"
# Check for too many >>>.  e.g.: <</if>>>
$GREP "<<[^<>]*[<>]\?[^<>]*>>>" -- "game/*.twee" | myprint "TooManyAngleBrackets"
# Check for too many <<<.  e.g.: <<</if>>
$GREP "<<<[^<>]*[<>]\?[^<>]*>>" -- "game/*.twee" | myprint "TooManyAngleBrackets"
# Check for wrong capitalization on 'activeslave' and other common typos
$GREP -e "\$act" --and --not -e "\$\(activeSlave\|activeArcology\|activeStandard\|activeOrgan\|activeLimbs\|activeUnits\|activeCanine\|activeHooved\|activeFeline\)" -- "game/*" | myprint "WrongCapitilization"
$GREP  "\(csae\|[a-z] She \|attepmts\|youreslf\|advnaces\|canAcheive\|setBellySize\|SetbellySize\|setbellySize\|bellypreg\|pregBelly\|bellyimplant\|bellyfluid\|pronounCaps\|carress\)" -- 'game/*' | myprint "SpellCheck"
$GREP  "\(recieve\|recieves\)" -- 'game/*' | myprint "PregmodderCannotSpellReceive"
$GREP "\$slave\[" -- 'game/*' | myprint "ShouldBeSlaves"
# Check for strange spaces e.g.  $slaves[$i]. lips
$GREP "\$slaves\[\$i\]\. " -- 'game/*' | myprint "MissingPropertyAfterSlaves"
# Check, e.g., <<//if>>
$GREP "<</[a-zA-Z]*[^a-zA-Z<>]\+[a-zA-Z]*>>" -- 'game/*' | myprint "DoubleSlash"
# Check, e.g.  <<else $foo==4
$GREP "<<else >\?[^>]" -- 'game/*' | myprint "ShouldBeElseIf"
# Check, e.g., =to
$GREP "=to" -- 'game/*' | myprint "EqualAndTo"
# Check, e.g.  <<set foo == 4>>
$GREP "<<set[^{>=]*==" -- 'game/*' | myprint "DoubleEqualsInSet"
# Check for, e.g   <<if slaves[foo]>>
$GREP "<<\([^>]\|[^>]>[^>]\)*[^$]slaves\[" -- 'game/*' | myprint "MissingDollar"
# Check for missing $ or _ in variable name:
$GREP -e "<<[a-zA-Z]\([^>\"]\|[^>]>[^>]\|\"[^\"]*\"\)* [a-zA-Z]\+ * =" -- game/*.twee | myprint "MissingDollar2"
# Check for missing command, e.g.  <<foo =
$GREP -e "<<[a-zA-Z]* = *" -- game/*.twee | myprint "BadCommand"
# Check for duplicate words, e.g. with with
$GREP -e  " \(\b[a-zA-Z][a-zA-Z]\+\) \1\b " --and --not -e " her her " --and --not -e " you you " --and --not -e " New New " --and --not -e "Slave Slave " --and --not -e " that that " --and --not -e " in in " --and --not -e " is is " -- 'game/*' | myprint "Duplicate words"
# Check for obsolete SugarCube macros
$GREP -E "<<display |<<click|<<.*\.contains" -- game/*.twee | myprint "ObsoleteMacro"
# Check for double articles
$GREP -E "\Wa an\W" -- game/*.twee | myprint "DoubleArticle"
# Check for incorrect articles
$GREP -i -E "\Wa (a|e|i|o|u)." -- game/*.twee | grep -a -i -vE "\Wa (un|eu|us|ut|on|ur|in)." | grep -a -i -vE "(&|<<s>>|UM)." | myprint "IncorrectArticle"
$GREP -i -E "\Wan (b|c|d|f|g|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z)\w." -- game/*.twee | grep -a -i -vE "[A-Z]{3}" | myprint "IncorrectArticle"
# Check for $ sign mid-word
$GREP -i "\w$\w" -- game/*.twee | myprint "VarSignMidWord"
# check for $ sign at beginning of macro
$GREP '<<\s*\$' -- 'game/*'  | myprint "VarSignAtMacroStart"
# check for missing ; before statement
$GREP 'if $ ' -- 'game/*'  | myprint "missing ; before statement"
$GREP 'elseif $ ' -- 'game/*'  | myprint "missing ; before statement"

# Check that we do not have any variables that we use only once.   e.g.     $onlyUsedOnce
# Ignore  *Nationalities
(
cd game/
cat $(find . -name "*.twee" ) | tr -c '$a-zA-Z' '\n'  | sed -n '/^[$]/p' | grep -v "Nationalities" | sort | uniq -u | sed 's/^[$]/-e[$]/' | sed 's/$/\\\\W/' | xargs -r  git grep -n --color | myprint "OnlyUsedOnce"
cat $(find . -name "*.twee" ) | tr -c '.$a-zA-Z[]_' '\n' | sed 's/SugarCube\.State\.variables\./$/g' | sed -n -e 's/^[$]\(PC\|activeSlave\|\(slaves\|tanks\)\[[^]]*\]*\)[.]\([a-zA-Z]\+\).*$/[.]\3/p' | sort | uniq -u |sed 's/^\(.*\)$/-e\1\\\\\b/'  | xargs -r git grep -n --color | myprint "SlaveAttributeUsedOnce"
$GREP "\$\(PC\|activeSlave\|slaves\|tanks\)[.][^a-zA-Z]" | myprint "UnexpectedCharAfterDot"

)

# Check that all the tags are properly opened and closed
git ls-files "game/*.twee" | xargs -d '\n' ./devTools/check.py

path: sanityCheck


code:
# Copy this file to .env and fill in the values you wish to change. Most already
# have sensible defaults.  See config.ts for more details.

# PORT=7860
# SERVER_TITLE=Coom Tunnel
# MODEL_RATE_LIMIT=4
# MAX_OUTPUT_TOKENS_OPENAI=300
# MAX_OUTPUT_TOKENS_ANTHROPIC=900
# LOG_LEVEL=info
# REJECT_DISALLOWED=false
# REJECT_MESSAGE="This content violates /aicg/'s acceptable use policy."
# CHECK_KEYS=true
# TURBO_ONLY=false
# BLOCKED_ORIGINS=reddit.com,9gag.com
# BLOCK_MESSAGE="You must be over the age of majority in your country to use this service."
# BLOCK_REDIRECT="https://roblox.com/"

# Note: CHECK_KEYS is disabled by default in local development mode, but enabled
# by default in production mode.

# Optional settings for user management and access control. See
# `docs/user-management.md` to learn how to use these.
# GATEKEEPER=none
# GATEKEEPER_STORE=memory
# MAX_IPS_PER_USER=20

# Optional settings for prompt logging. See docs/logging-sheets.md.
# PROMPT_LOGGING=false

# ------------------------------------------------------------------------------
# The values below are secret -- make sure they are set securely. Do NOT set
# them in the .env file of a public repository.
# For Huggingface, set them via the Secrets section in your Space's config UI.
# For Render, create a "secret file" called .env using the Environment tab.

# You can add multiple keys by separating them with a comma.
OPENAI_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ANTHROPIC_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# You can require a Bearer token for requests when using proxy_token gatekeeper.
# PROXY_KEY=your-secret-key

# You can set an admin key for user management when using user_token gatekeeper.
# ADMIN_KEY=your-very-secret-key

# These are used to push data to a Huggingface Dataset repository.
# HF_DATASET_REPO_URL=https://huggingface.co/datasets/your-username/your-dataset-name
# HF_PRIVATE_SSH_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# These are used to persist user data to Firebase across restarts.
# FIREBASE_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# FIREBASE_RTDB_URL=https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.firebaseio.com

# These are used to log prompts to Google Sheets.
# GOOGLE_SHEETS_SPREADSHEET_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# GOOGLE_SHEETS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

repo_name: CODEMAN/oai


code:
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

path: .gitattributes


code:
.env
.venv
.vscode
build
greeting.md
node_modules

path: .gitignore


code:
# OAI Reverse Proxy

Reverse proxy server for the OpenAI and Anthropic APIs. Forwards text generation requests while rejecting administrative/billing requests. Includes optional rate limiting and prompt filtering to prevent abuse.

### Table of Contents
- [What is this?](#what-is-this)
- [Why?](#why)
- [Usage Instructions](#setup-instructions)
  - [Deploy to Huggingface (Recommended)](#deploy-to-huggingface-recommended)
  - [Deploy to Repl.it (WIP)](#deploy-to-replit-wip)
- [Local Development](#local-development)

## What is this?
If you would like to provide a friend access to an API via keys you own, you can use this to keep your keys safe while still allowing them to generate text with the API. You can also use this if you'd like to build a client-side application which uses the OpenAI or Anthropic APIs, but don't want to build your own backend. You should never embed your real API keys in a client-side application. Instead, you can have your frontend connect to this reverse proxy and forward requests to the downstream service.

This keeps your keys safe and allows you to use the rate limiting and prompt filtering features of the proxy to prevent abuse.

## Why?
OpenAI keys have full account permissions. They can revoke themselves, generate new keys, modify spend quotas, etc. **You absolutely should not share them, post them publicly, nor embed them in client-side applications as they can be easily stolen.**

This proxy only forwards text generation requests to the downstream service and rejects requests which would otherwise modify your account.

---

## Usage Instructions
If you'd like to run your own instance of this proxy, you'll need to deploy it somewhere and configure it with your API keys. A few easy options are provided below, though you can also deploy it to any other service you'd like.

### Deploy to Huggingface (Recommended)
[See here for instructions on how to deploy to a Huggingface Space.](./docs/deploy-huggingface.md)

### Deploy to Render
[See here for instructions on how to deploy to Render.com.](./docs/deploy-render.md)

## Local Development
To run the proxy locally for development or testing, install Node.js >= 18.0.0 and follow the steps below.

1. Clone the repo
2. Install dependencies with `npm install`
3. Create a `.env` file in the root of the project and add your API keys. See the [.env.example](./.env.example) file for an example.
4. Start the server in development mode with `npm run start:dev`.

You can also use `npm run start:dev:tsc` to enable project-wide type checking at the cost of slower startup times. `npm run type-check` can be used to run type checking without starting the server.


code:
FROM node:18-bullseye-slim
RUN apt-get update && \
    apt-get install -y git
RUN git clone https://gitgud.io/khanon/oai-reverse-proxy.git /app
WORKDIR /app
RUN npm install
COPY Dockerfile greeting.md* .env* ./
RUN npm run build
EXPOSE 7860
ENV NODE_ENV=production
CMD [ "npm", "start" ]

path: docker/huggingface/Dockerfile


code:
# syntax = docker/dockerfile:1.2

FROM node:18-bullseye-slim
RUN apt-get update && \
    apt-get install -y curl

# Unlike Huggingface, Render can only deploy straight from a git repo and
# doesn't allow you to create or modify arbitrary files via the web UI.
# To use a greeting file, set `GREETING_URL` to a URL that points to a raw
# text file containing your greeting, such as a GitHub Gist.

# You may need to clear the build cache if you change the greeting, otherwise
# Render will use the cached layer from the previous build.

WORKDIR /app
ARG GREETING_URL
RUN if [ -n "$GREETING_URL" ]; then \
    curl -sL "$GREETING_URL" > greeting.md; \
    fi
COPY package*.json greeting.md* ./
RUN npm install
COPY . .
RUN npm run build
RUN --mount=type=secret,id=_env,dst=/etc/secrets/.env cat /etc/secrets/.env >> .env
EXPOSE 10000
ENV NODE_ENV=production
CMD [ "npm", "start" ]

path: docker/render/Dockerfile


code:
# Deploy to Huggingface Space

This repository can be deployed to a [Huggingface Space](https://huggingface.co/spaces).  This is a free service that allows you to run a simple server in the cloud.  You can use it to safely share your OpenAI API key with a friend.

### 1. Get an API key
- Go to [OpenAI](https://openai.com/) and sign up for an account. You can use a free trial key for this as long as you provide SMS verification.
    - Claude is not publicly available yet, but if you have access to it via the [Anthropic](https://www.anthropic.com/) closed beta, you can also use that key with the proxy.

### 2. Create an empty Huggingface Space
- Go to [Huggingface](https://huggingface.co/) and sign up for an account.
- Once logged in, [create a new Space](https://huggingface.co/new-space).
- Provide a name for your Space and select "Docker" as the SDK.  Select "Blank" for the template.
- Click "Create Space" and wait for the Space to be created.

![Create Space](huggingface-createspace.png)

### 3. Create an empty Dockerfile
- Once your Space is created, you'll see an option to "Create the Dockerfile in your browser".  Click that link.

![Create Dockerfile](huggingface-dockerfile.png)
- Paste the following into the text editor and click "Save".
```dockerfile
FROM node:18-bullseye-slim
RUN apt-get update && \
    apt-get install -y git
RUN git clone https://gitgud.io/khanon/oai-reverse-proxy.git /app
WORKDIR /app
RUN npm install
COPY Dockerfile greeting.md* .env* ./
RUN npm run build
EXPOSE 7860
ENV NODE_ENV=production
CMD [ "npm", "start" ]
```
- Click "Commit new file to `main`" to save the Dockerfile.

![Commit](huggingface-savedockerfile.png)

### 4. Set your API key as a secret
- Click the Settings button in the top right corner of your repository.
- Scroll down to the `Repository Secrets` section and click `New Secret`.

![Secrets](https://files.catbox.moe/irrp2p.png)

- Enter `OPENAI_KEY` as the name and your OpenAI API key as the value.
    - For Claude, set `ANTHROPIC_KEY` instead.
    - You can use both types of keys at the same time if you want.

![New Secret](https://files.catbox.moe/ka6s1a.png)

### 5. Deploy the server
- Your server should automatically deploy when you add the secret, but if not you can select `Factory Reboot` from that same Settings menu.

### 6. Share the link
- The Service Info section below should show the URL for your server. You can share this with anyone to safely give them access to your API key.
- Your friend doesn't need any API key of their own, they just need your link.

# Optional

## Updating the server

To update your server, go to the Settings menu and select `Factory Reboot`.  This will pull the latest version of the code from GitHub and restart the server.

Note that if you just perform a regular Restart, the server will be restarted with the same code that was running before.

## Adding a greeting message

You can create a Markdown file called `greeting.md` to display a message on the Server Info page.  This is a good place to put instructions for how to use the server.

## Customizing the server

The server will be started with some default configuration, but you can override it by adding a `.env` file to your Space.  You can use Huggingface's web editor to create a new `.env` file alongside your Dockerfile. Huggingface will restart your server automatically when you save the file.

Here are some example settings:
```shell
# Requests per minute per IP address
MODEL_RATE_LIMIT=4
# Max tokens to request from OpenAI
MAX_OUTPUT_TOKENS_OPENAI=256
# Max tokens to request from Anthropic (Claude)
MAX_OUTPUT_TOKENS_ANTHROPIC=512
# Block prompts containing disallowed characters
REJECT_DISALLOWED=false
REJECT_MESSAGE="This content violates /aicg/'s acceptable use policy."
# Show exact quota usage on the Server Info page
QUOTA_DISPLAY_MODE=full
```

See `.env.example` for a full list of available settings, or check `config.ts` for details on what each setting does.

## Restricting access to the server

If you want to restrict access to the server, you can set a `PROXY_KEY` secret.  This key will need to be passed in the Authentication header of every request to the server, just like an OpenAI API key.

Add this using the same method as the OPENAI_KEY secret above. Don't add this to your `.env` file because that file is public and anyone can see it.


code:
# Deploy to Render.com
Render.com offers a free tier that includes 750 hours of compute time per month.  This is enough to run a single proxy instance 24/7.  Instances shut down after 15 minutes without traffic but start up again automatically when a request is received.

### 1. Create account
- [Sign up for Render.com](https://render.com/) to create an account and access the dashboard.

### 2. Create a service using a Blueprint
Render allows you to deploy and auutomatically configure a repository containing a [render.yaml](../render.yaml) file using its Blueprints feature.  This is the easiest way to get started.

- Click the **Blueprints** tab at the top of the dashboard.
- Click **New Blueprint Instance**.
- Under **Public Git repository**, enter `https://gitlab.com/khanon/oai-proxy`.
  - Note that this is not the GitGud repository, but a mirror on GitLab.
- Click **Continue**.
- Under **Blueprint Name**, enter a name.
- Under **Branch**, enter `main`.
- Click **Apply**.

The service will be created according to the instructions in the `render.yaml` file.  Don't wait for it to complete as it will fail due to missing environment variables.  Instead, proceed to the next step.

### 3. Set environment variables
- Return to the **Dashboard** tab.
- Click the name of the service you just created, which may show as "Deploy failed".
- Click the **Environment** tab.
- Click **Add Secret File**.
- Under **Filename**, enter `.env`.
- Under **Contents**, enter all of your environment variables, one per line, in the format `NAME=value`.
  - For example, `OPENAI_KEY=sk-abc123`.
- Click **Save Changes**.

The service will automatically rebuild and deploy with the new environment variables.  This will take a few minutes.  The link to your deployed proxy will appear at the top of the page.

If you want to change the URL, go to the **Settings** tab of your Web Service and click the **Edit** button next to **Name**.  You can also set a custom domain, though I haven't tried this yet.

# Optional

## Updating the server

To update your server, go to the page for your Web Service and click **Manual Deploy** > **Deploy latest commit**.  This will pull the latest version of the code and redeploy the server.

_If you have trouble with this, you can also try selecting **Clear build cache & deploy** instead from the same menu._

## Adding a greeting message

To show a greeting message on the Server Info page, set the `GREETING_URL` environment variable within Render to the URL of a Markdown file.  This URL should point to a raw text file, not an HTML page. You can use a public GitHub Gist or GitLab Snippet for this.  For example: `GREETING_URL=https://gitlab.com/-/snippets/2542011/raw/main/greeting.md`.  You can change the title of the page by setting the `SERVER_TITLE` environment variable.

Don't set `GREETING_URL` in the `.env` secret file you created earlier; it must be set in Render's environment variables section for it to work correctly.

## Customizing the server

You can customize the server by editing the `.env` configuration you created earlier. Refer to [.env.example](../.env.example) for a list of all available configuration options. Further information can be found in the [config.ts](../src/config.ts) file.


code:
# Warning
**I strongly suggest against using this feature with a Google account that you care about.** Depending on the content of the prompts people submit, Google may flag the spreadsheet as containing inappropriate content. This seems to prevent you from sharing that spreadsheet _or any others on the account. This happened with my throwaway account during testing; the existing shared spreadsheet continues to work but even completely new spreadsheets are flagged and cannot be shared.

I'll be looking into alternative storage backends but you should not use this implementation with a Google account you care about, or even one remotely connected to your main accounts (as Google has a history of linking accounts together via IPs/browser fingerprinting). Use a VPN and completely isolated VM to be safe.

# Configuring Google Sheets Prompt Logging
This proxy can log incoming prompts and model responses to Google Sheets. Some configuration on the Google side is required to enable this feature. The APIs used are free, but you will need a Google account and a Google Cloud Platform project.

NOTE: Concurrency is not supported. Don't connect two instances of the server to the same spreadsheet or bad things will happen.

## Prerequisites
- A Google account
  - **USE A THROWAWAY ACCOUNT!**
- A Google Cloud Platform project

### 0. Create a Google Cloud Platform Project
_A Google Cloud Platform project is required to enable programmatic access to Google Sheets. If you already have a project, skip to the next step. You can also see the [Google Cloud Platform documentation](https://developers.google.com/workspace/guides/create-project) for more information._

- Go to the Google Cloud Platform Console and [create a new project](https://console.cloud.google.com/projectcreate).

### 1. Enable the Google Sheets API
_The Google Sheets API must be enabled for your project. You can also see the [Google Sheets API documentation](https://developers.google.com/sheets/api/quickstart/nodejs) for more information._

- Go to the [Google Sheets API page](https://console.cloud.google.com/apis/library/sheets.googleapis.com) and click **Enable**, then fill in the form to enable the Google Sheets API for your project.
<!-- TODO: Add screenshot of Enable page and describe filling out the form -->

### 2. Create a Service Account
_A service account is required to authenticate the proxy to Google Sheets._

- Once the Google Sheets API is enabled, click the **Credentials** tab on the Google Sheets API page.
- Click **Create credentials** and select **Service account**.
- Provide a name for the service account and click **Done** (the second and third steps can be skipped).

### 3. Download the Service Account Key
_Once your account is created, you'll need to download the key file and include it in the proxy's secrets configuration._

- Click the Service Account you just created in the list of service accounts for the API.
- Click the **Keys** tab and click **Add key**, then select **Create new key**.
- Select **JSON** as the key type and click **Create**.

The JSON file will be downloaded to your computer.

### 4. Set the Service Account key as a Secret
_The JSON key file must be set as a secret in the proxy's configuration. Because files cannot be included in the secrets configuration, you'll need to base64 encode the file's contents and paste the encoded string as the value of the `GOOGLE_SHEETS_KEY` secret._

- Open the JSON key file in a text editor and copy the contents.
- Visit the [base64 encode/decode tool](https://www.base64encode.org/) and paste the contents into the box, then click **Encode**.
- Copy the encoded string and paste it as the value of the `GOOGLE_SHEETS_KEY` secret in the deployment's secrets configuration.
  - **WARNING:** Don't reveal this string publically. The `.env` file is NOT private -- unless you're running the proxy locally, you should not use it to store secrets!

### 5. Create a new spreadsheet and share it with the service account
_The service account must be given permission to access the logging spreadsheet. Each service account has a unique email address, which can be found in the JSON key file; share the spreadsheet with that email address just as you would share it with another user._

- Open the JSON key file in a text editor and copy the value of the `client_email` field.
- Open the spreadsheet you want to log to, or create a new one, and click **File > Share**.
- Paste the service account's email address into the **Add people or groups** field. Ensure the service account has **Editor** permissions, then click **Done**.

### 6. Set the spreadsheet ID as a Secret
_The spreadsheet ID must be set as a secret in the proxy's configuration. The spreadsheet ID can be found in the URL of the spreadsheet. For example, the spreadsheet ID for `https://docs.google.com/spreadsheets/d/1X2Y3Z/edit#gid=0` is `1X2Y3Z`.  The ID isn't necessarily a sensitive value if you intend for the spreadsheet to be public, but it's still recommended to set it as a secret._

- Copy the spreadsheet ID and paste it as the value of the `GOOGLE_SHEETS_SPREADSHEET_ID` secret in the deployment's secrets configuration.


code:
# Shat out by GPT-4, I did not check for correctness beyond a cursory glance
openapi: 3.0.0
info:
  version: 1.0.0
  title: User Management API
paths:
  /admin/users:
    get:
      summary: List all users
      operationId: getUsers
      responses:
        "200":
          description: A list of users
          content:
            application/json:
              schema:
                type: object
                properties:
                  users:
                    type: array
                    items:
                      $ref: "#/components/schemas/User"
                  count:
                    type: integer
                    format: int32
    post:
      summary: Create a new user
      operationId: createUser
      responses:
        "200":
          description: The created user's token
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
    put:
      summary: Bulk upsert users
      operationId: bulkUpsertUsers
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                users:
                  type: array
                  items:
                    $ref: "#/components/schemas/User"
      responses:
        "200":
          description: The upserted users
          content:
            application/json:
              schema:
                type: object
                properties:
                  upserted_users:
                    type: array
                    items:
                      $ref: "#/components/schemas/User"
                  count:
                    type: integer
                    format: int32
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string

  /admin/users/{token}:
    get:
      summary: Get a user by token
      operationId: getUser
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: A user
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
        "404":
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    put:
      summary: Update a user by token
      operationId: upsertUser
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/User"
      responses:
        "200":
          description: The updated user
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
    delete:
      summary: Disables the user with the given token
      description: Optionally accepts a `disabledReason` query parameter. Returns the disabled user.
      parameters:
        - in: path
          name: token
          required: true
          schema:
            type: string
          description: The token of the user to disable
        - in: query
          name: disabledReason
          required: false
          schema:
            type: string
          description: The reason for disabling the user
      responses:
        '200':
          description: The disabled user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
components:
  schemas:
    User:
      type: object
      properties:
        token:
          type: string
        ip:
          type: array
          items:
            type: string
        type:
          type: string
          enum: ["normal", "special"]
        promptCount:
          type: integer
          format: int32
        tokenCount:
          type: integer
          format: int32
        createdAt:
          type: integer
          format: int64
        lastUsedAt:
          type: integer
          format: int64
        disabledAt:
          type: integer
          format: int64
        disabledReason:
          type: string