소스 검색

[added] Full rework of the sleep cycle and how events and mods can interact with it.

anjuna krokus 1 년 전
부모
커밋
478d9b8ecd
41개의 변경된 파일2746개의 추가작업 그리고 1649개의 파일을 삭제
  1. 14 3
      glife.qproj
  2. 104 104
      locations/Cheatmenu_din.qsrc
  3. 2 1
      locations/LariskaHome.qsrc
  4. 47 47
      locations/alarmclock.qsrc
  5. 13 390
      locations/bed.qsrc
  6. 73 52
      locations/bed2.qsrc
  7. 532 0
      locations/bed_events.qsrc
  8. 42 0
      locations/bed_get_out.qsrc
  9. 134 0
      locations/bed_get_out_events.qsrc
  10. 5 4
      locations/bedr.qsrc
  11. 1 1
      locations/bedr2x.qsrc
  12. 2 2
      locations/bedrPar.qsrc
  13. 7 4
      locations/begin.qsrc
  14. 2 2
      locations/brothel.qsrc
  15. 8 32
      locations/city_sauna.qsrc
  16. 340 174
      locations/dream_events.qsrc
  17. 1 1
      locations/gadhouse.qsrc
  18. 8 8
      locations/home_activity.qsrc
  19. 2 2
      locations/korrPar.qsrc
  20. 2 2
      locations/marisha_ev.qsrc
  21. 1 1
      locations/mey_home.qsrc
  22. 71 57
      locations/mother_sextalk.qsrc
  23. 1 1
      locations/natbel_friend.qsrc
  24. 45 27
      locations/nichBedroomServant.qsrc
  25. 1 2
      locations/nichTanya.qsrc
  26. 2 2
      locations/pav_shared_apt.qsrc
  27. 1 1
      locations/placer_sex.qsrc
  28. 185 0
      locations/pre_sleep.qsrc
  29. 277 0
      locations/pre_sleep_events.qsrc
  30. 21 1
      locations/saveupdater.qsrc
  31. 18 18
      locations/sex_ev_after.qsrc
  32. 2 2
      locations/sex_ev_wakeup.qsrc
  33. 85 696
      locations/sleep.qsrc
  34. 286 0
      locations/sleep_events.qsrc
  35. 90 0
      locations/sleep_simple.qsrc
  36. 4 4
      locations/succubus.qsrc
  37. 6 6
      locations/therapist.qsrc
  38. 1 1
      locations/therapist_hotel.qsrc
  39. 1 1
      locations/uni_dorm.qsrc
  40. 99 0
      locations/wakeup.qsrc
  41. 210 0
      locations/wakeup_events.qsrc

+ 14 - 3
glife.qproj

@@ -67,7 +67,6 @@
 		<Location name="beverage"/>
 		<Location name="food_menu"/>
 		<Location name="schedule"/>
-		<Location name="sleep"/>
 		<Location name="willpower"/>
 		<Location name="drugs"/>
 		<Location name="npc_relationship"/>
@@ -79,6 +78,16 @@
 		<Location name="grades"/>
 		<Location name="internet_mobile"/>
 	</Folder>
+	<Folder name="Sleep">
+		<Location name="pre_sleep"/>
+		<Location name="pre_sleep_events"/>
+		<Location name="dream_events"/>
+		<Location name="sleep"/>
+		<Location name="sleep_simple"/>
+		<Location name="sleep_events"/>
+		<Location name="wakeup"/>
+		<Location name="wakeup_events"/>
+	</Folder>
 	<Folder name="Body">
 		<Location name="AppearanceSystem"/>
 		<Location name="body"/>
@@ -306,9 +315,11 @@
 	</Folder>
 	<Folder name="Furniture">
 		<Location name="bed"/>
+		<Location name="bed_events"/>
 		<Location name="bed2"/>
-		<Location name="dreams"/>
-		<Location name="budilnik"/>
+		<Location name="bed_get_out"/>
+		<Location name="bed_get_out_events"/>
+		<Location name="alarmclock"/>
 		<Location name="divan"/>
 		<Location name="Komp"/>
 		<Location name="komp_camgirl"/>

+ 104 - 104
locations/Cheatmenu_din.qsrc

@@ -359,13 +359,13 @@ $cheatmenu['cheat_NoLactation'] = {
 }
 
 $cheatmenu['Vibrator'] = {
-	if cheatVib = 0:
-		cheatVib = 1
-		bedvibrator = 1
+	if sleepQW['cheatVib'] = 0:
+		sleepQW['cheatVib'] = 1
+		sleepQW['bedVibrator'] = 1
 		dynamic $cheatmenu['permanent']
-	elseif cheatVib = 1:
-		cheatVib = 0
-		bedvibrator = 0
+	elseif sleepQW['cheatVib'] = 1:
+		sleepQW['cheatVib'] = 0
+		sleepQW['bedVibrator'] = 0
 		dynamic $cheatmenu['permanent']
 	end
 }
@@ -514,66 +514,66 @@ $cheatmenu['permanent'] = {
 	gs'stat'
 	*clr & cla
 	gs 'obj_din', 'cheattabs'
-	if cheatWork = 0:$cheatWork = 'Currently OFF'
-	if cheatWork = 1:$cheatWork = 'Currently ON'
-	if cheatWillpower = 0:$cheatWillpower = 'Currently OFF'
-	if cheatWillpower = 1:$cheatWillpower = 'Currently ON'
-	if cheatHapri = 0:$cheatHapri = 'Currently OFF'
-	if cheatHapri = 1:$cheatHapri = 'Currently ON'
-	if cheatKlisma = 1:$cheatKlisma = 'Currently OFF'
-	if cheatKlisma = 0:$cheatKlisma = 'Currently ON'
-	if cheatNomakeup = 0:$cheatNomakeup = 'Currently OFF'
-	if cheatNomakeup = 1:$cheatNomakeup = 'Currently ON'
-	if cheatNoSweat = 0:$cheatNoSweat = 'Currently OFF'
-	if cheatNoSweat = 1:$cheatNoSweat = 'Currently ON'
-	if cheatNoEat = 0:$cheatNoEat = 'Currently OFF'
-	if cheatNoEat = 1:$cheatNoEat = 'Currently ON'
-	if cheatNoDrink = 0:$cheatNoDrink = 'Currently OFF'
-	if cheatNoDrink = 1:$cheatNoDrink = 'Currently ON'
-	if cheatNoSleep = 0:$cheatNoSleep = 'Currently OFF'
-	if cheatNoSleep = 1:$cheatNoSleep = 'Currently ON'
-	if cheatNoMood = 0:$cheatNoMood = 'Currently OFF'
-	if cheatNoMood = 1:$cheatNoMood = 'Currently ON'
-	if cheatNoFat = 0:$cheatNoFat = 'Currently OFF'
-	if cheatNoFat = 1:$cheatNoFat = 'Currently ON'
-	if cheatHealth = 0:$cheatHealth = 'Enabled'
-	if cheatHealth = 1:$cheatHealth = 'Disabled'
-	if cheatPee = 0:$cheatPee = 'Enabled'
-	if cheatPee = 1:$cheatPee = 'Disabled'
-	if NarkImmune = 0:$NarkImmune = 'Currently OFF'
-	if NarkImmune = 1:$NarkImmune = 'Currently ON'
-	if InfWillpwer = 0:$InfWillpwer = 'Currently OFF'
-	if InfWillpwer = 1:$InfWillpwer = 'Currently ON'
-	if cheatSlut = 0:$cheatSlut = 'Enabled'
-	if cheatSlut = 1:$cheatSlut = 'Disabled'
-	if cheatHorny = 0:$cheatHorny = 'Currently OFF'
-	if cheatHorny = 1:$cheatHorny = 'Currently ON'
-	if bedvibrator = 0:$cheatVib = 'Currently OFF'
-	if bedvibrator = 1:$cheatVib = 'Currently ON'
-	if fight_cheat = 0:$fight_cheat = 'Currently OFF'
-	if fight_cheat = 1:$fight_cheat = 'Currently ON'
-	if autocombat_cheat = 0:$autocombat_cheat = 'Currently OFF'
-	if autocombat_cheat = 1:$autocombat_cheat = 'Currently ON'
-	if cheat_NoPregnancy = 0:$cheat_NoPregnancy = 'Enabled'
-	if cheat_NoPregnancy = 1:$cheat_NoPregnancy = 'Disabled'
-	if cheat_NoLactation = 0:$cheat_NoLactation = 'Enabled'
-	if cheat_NoLactation = 1:$cheat_NoLactation = 'Disabled'
-	if cheatBimbo = 0:$cheatBimbo = 'Enabled'
-	if cheatBimbo = 1:$cheatBimbo = 'Disabled'
-	if cheatBimbo2 = 0:$cheatBimbo2 = 'Disabled'
-	if cheatBimbo2 = 1:$cheatBimbo2 = 'Enabled'
-	if cheatBimbo3 = 0:$cheatBimbo3 = 'Disabled'
-	if cheatBimbo3 = 1:$cheatBimbo3 = 'Enabled'
-	if cumeater_cheat = 0:$cheatcumtrait = 'Enabled'
-	if cumeater_cheat = 1:$cheatcumtrait = 'Disabled'
-	if exhib_cheat = 0:$cheatexhib = 'Enabled'
-	if exhib_cheat = 1:$cheatexhib = 'Disabled'
+	if cheatWork = 0: $cheatWork = 'Currently OFF'
+	if cheatWork = 1: $cheatWork = 'Currently ON'
+	if cheatWillpower = 0: $cheatWillpower = 'Currently OFF'
+	if cheatWillpower = 1: $cheatWillpower = 'Currently ON'
+	if cheatHapri = 0: $cheatHapri = 'Currently OFF'
+	if cheatHapri = 1: $cheatHapri = 'Currently ON'
+	if cheatKlisma = 1: $cheatKlisma = 'Currently OFF'
+	if cheatKlisma = 0: $cheatKlisma = 'Currently ON'
+	if cheatNomakeup = 0: $cheatNomakeup = 'Currently OFF'
+	if cheatNomakeup = 1: $cheatNomakeup = 'Currently ON'
+	if cheatNoSweat = 0: $cheatNoSweat = 'Currently OFF'
+	if cheatNoSweat = 1: $cheatNoSweat = 'Currently ON'
+	if cheatNoEat = 0: $cheatNoEat = 'Currently OFF'
+	if cheatNoEat = 1: $cheatNoEat = 'Currently ON'
+	if cheatNoDrink = 0: $cheatNoDrink = 'Currently OFF'
+	if cheatNoDrink = 1: $cheatNoDrink = 'Currently ON'
+	if cheatNoSleep = 0: $cheatNoSleep = 'Currently OFF'
+	if cheatNoSleep = 1: $cheatNoSleep = 'Currently ON'
+	if cheatNoMood = 0: $cheatNoMood = 'Currently OFF'
+	if cheatNoMood = 1: $cheatNoMood = 'Currently ON'
+	if cheatNoFat = 0: $cheatNoFat = 'Currently OFF'
+	if cheatNoFat = 1: $cheatNoFat = 'Currently ON'
+	if cheatHealth = 0: $cheatHealth = 'Enabled'
+	if cheatHealth = 1: $cheatHealth = 'Disabled'
+	if cheatPee = 0: $cheatPee = 'Enabled'
+	if cheatPee = 1: $cheatPee = 'Disabled'
+	if NarkImmune = 0: $NarkImmune = 'Currently OFF'
+	if NarkImmune = 1: $NarkImmune = 'Currently ON'
+	if InfWillpwer = 0: $InfWillpwer = 'Currently OFF'
+	if InfWillpwer = 1: $InfWillpwer = 'Currently ON'
+	if cheatSlut = 0: $cheatSlut = 'Enabled'
+	if cheatSlut = 1: $cheatSlut = 'Disabled'
+	if cheatHorny = 0: $cheatHorny = 'Currently OFF'
+	if cheatHorny = 1: $cheatHorny = 'Currently ON'
+	if sleepQW['bedVibrator'] = 0: $sleepQW['cheatVib'] = 'Currently OFF'
+	if sleepQW['bedVibrator'] = 1: $sleepQW['cheatVib'] = 'Currently ON'
+	if fight_cheat = 0: $fight_cheat = 'Currently OFF'
+	if fight_cheat = 1: $fight_cheat = 'Currently ON'
+	if autocombat_cheat = 0: $autocombat_cheat = 'Currently OFF'
+	if autocombat_cheat = 1: $autocombat_cheat = 'Currently ON'
+	if cheat_NoPregnancy = 0: $cheat_NoPregnancy = 'Enabled'
+	if cheat_NoPregnancy = 1: $cheat_NoPregnancy = 'Disabled'
+	if cheat_NoLactation = 0: $cheat_NoLactation = 'Enabled'
+	if cheat_NoLactation = 1: $cheat_NoLactation = 'Disabled'
+	if cheatBimbo = 0: $cheatBimbo = 'Enabled'
+	if cheatBimbo = 1: $cheatBimbo = 'Disabled'
+	if cheatBimbo2 = 0: $cheatBimbo2 = 'Disabled'
+	if cheatBimbo2 = 1: $cheatBimbo2 = 'Enabled'
+	if cheatBimbo3 = 0: $cheatBimbo3 = 'Disabled'
+	if cheatBimbo3 = 1: $cheatBimbo3 = 'Enabled'
+	if cumeater_cheat = 0: $cheatcumtrait = 'Enabled'
+	if cumeater_cheat = 1: $cheatcumtrait = 'Disabled'
+	if exhib_cheat = 0: $cheatexhib = 'Enabled'
+	if exhib_cheat = 1: $cheatexhib = 'Disabled'
 	if addictive_cheat = 0: $cheataddictive = 'Enabled'
 	if addictive_cheat = 1: $cheataddictive = 'Disabled'
-	if cheatConsole = 0:$cheatConsole = 'Visible'
-	if cheatConsole = 1:$cheatConsole = 'Hidden'
-	if cheatTime = 0:$cheatTime = 'Disabled'
-	if cheatTime = 1:$cheatTime = 'Enabled'
+	if cheatConsole = 0: $cheatConsole = 'Visible'
+	if cheatConsole = 1: $cheatConsole = 'Hidden'
+	if cheatTime = 0: $cheatTime = 'Disabled'
+	if cheatTime = 1: $cheatTime = 'Enabled'
 	if random_bf_gf_cheat = 0: $random_bf_gf_cheat = 'Enabled'
 	if random_bf_gf_cheat = 1: $random_bf_gf_cheat = 'Disabled'
 	if cheat_street_robbers = 0: $cheat_street_robbers = 'Enabled'
@@ -615,7 +615,7 @@ $cheatmenu['permanent'] = {
 
 	*nl
 
-	'Enable sleeping with vibrator inserted: <a href="exec:dynamic $cheatmenu[''Vibrator'']"><<$cheatVib>></a>'
+	'Enable sleeping with vibrator inserted: <a href="exec:dynamic $cheatmenu[''Vibrator'']"><<$sleepQW[''cheatVib'']>></a>'
 
 	*nl
 
@@ -650,10 +650,10 @@ $cheatmenu['permanent'] = {
 		'Automatic cheat on Tampon: <a href="exec:Enable_auto_tampons =  1 & dynamic $cheatmenu[''permanent'']">Currently OFF</a>'
 	end
 	*nl
-	if Enable_nodream > 0:
-		'No dream chance: <a href="exec:Enable_nodream=input(''Enter no dream chance (%)'') & dynamic $cheatmenu[''permanent'']"><<Enable_nodream>>%</a>, <a href="exec:Enable_nodream=0 & dynamic $cheatmenu[''permanent'']">Currently ON</a>'
+	if sleepQW['cheat_nodream_chance'] > 0:
+		'No dream chance: <a href="exec:sleepQW[''cheat_nodream_chance'']=input(''Enter no dream chance (%)'') & dynamic $cheatmenu[''permanent'']"><<sleepQW[''cheat_nodream_chance'']>>%</a>, <a href="exec:sleepQW[''cheat_nodream_chance'']=0 & dynamic $cheatmenu[''permanent'']">Currently ON</a>'
 	else
-		'No dream chance: <a href="exec:Enable_nodream=input(''Enter no dream chance (%)'') & dynamic $cheatmenu[''permanent'']">Currently OFF</a>'
+		'No dream chance: <a href="exec:sleepQW[''cheat_nodream_chance'']=input(''Enter no dream chance (%)'') & dynamic $cheatmenu[''permanent'']">Currently OFF</a>'
 	end & !1.2.3 new function
 	*nl
 	'Hide Console input in objects window: <a href="exec:dynamic $cheatmenu[''consolecheat'']"><<$cheatConsole>></a>'
@@ -2349,42 +2349,42 @@ $cheatmenu['theme'] = {
 }
 
 $cheatmenu['pain'] = {
-	if pain['head'] < 0:pain['head'] = 0
-	if pain['hair'] < 0:pain['hair'] = 0
-	if pain['ears'] < 0:pain['ears'] = 0
-	if pain['eyebrows'] < 0:pain['eyebrows'] = 0
-	if pain['eyes'] < 0:pain['eyes'] = 0
-	if pain['cheeks'] < 0:pain['cheeks'] = 0
-	if pain['nose'] < 0:pain['nose'] = 0
-	if pain['mouth'] < 0:pain['mouth'] = 0
-	if pain['lips'] < 0:pain['lips'] = 0
-	if pain['tongue'] < 0:pain['tongue'] = 0
-	if pain['throat'] < 0:pain['throat'] = 0
-	if pain['neck'] < 0:pain['neck'] = 0
-	if pain['back'] < 0:pain['back'] = 0
-	if pain['asscheeks'] < 0:pain['asscheeks'] = 0
-	if pain['asshole'] < 0:pain['asshole'] = 0
-	if pain['hips'] < 0:pain['hips'] = 0
-	if pain['thighs'] < 0:pain['thighs'] = 0
-	if pain['legL'] < 0:pain['legL'] = 0
-	if pain['legR'] < 0:pain['legR'] = 0
-	if pain['feet'] < 0:pain['feet'] = 0
-	if pain['toes'] < 0:pain['toes'] = 0
-	if pain['shoulders'] < 0:pain['shoulders'] = 0
-	if pain['armL'] < 0:pain['armL'] = 0
-	if pain['armR'] < 0:pain['armR'] = 0
-	if pain['hands'] < 0:pain['hands'] = 0
-	if pain['fingers'] < 0:pain['fingers'] = 0
-	if pain['chest'] < 0:pain['chest'] = 0
-	if pain['breasts'] < 0:pain['breasts'] = 0
-	if pain['nipples'] < 0:pain['nipples'] = 0
-	if pain['ribs'] < 0:pain['ribs'] = 0
-	if pain['tummy'] < 0:pain['tummy'] = 0
-	if pain['pubic'] < 0:pain['pubic'] = 0
-	if pain['vaginal'] < 0:pain['vaginal'] = 0
-	if pain['clitoris'] < 0:pain['clitoris'] = 0
-	if pain['urethra'] < 0:pain['urethra'] = 0
-	if pain['cervix'] < 0:pain['cervix'] = 0
+	if pain['head'] < 0: pain['head'] = 0
+	if pain['hair'] < 0: pain['hair'] = 0
+	if pain['ears'] < 0: pain['ears'] = 0
+	if pain['eyebrows'] < 0: pain['eyebrows'] = 0
+	if pain['eyes'] < 0: pain['eyes'] = 0
+	if pain['cheeks'] < 0: pain['cheeks'] = 0
+	if pain['nose'] < 0: pain['nose'] = 0
+	if pain['mouth'] < 0: pain['mouth'] = 0
+	if pain['lips'] < 0: pain['lips'] = 0
+	if pain['tongue'] < 0: pain['tongue'] = 0
+	if pain['throat'] < 0: pain['throat'] = 0
+	if pain['neck'] < 0: pain['neck'] = 0
+	if pain['back'] < 0: pain['back'] = 0
+	if pain['asscheeks'] < 0: pain['asscheeks'] = 0
+	if pain['asshole'] < 0: pain['asshole'] = 0
+	if pain['hips'] < 0: pain['hips'] = 0
+	if pain['thighs'] < 0: pain['thighs'] = 0
+	if pain['legL'] < 0: pain['legL'] = 0
+	if pain['legR'] < 0: pain['legR'] = 0
+	if pain['feet'] < 0: pain['feet'] = 0
+	if pain['toes'] < 0: pain['toes'] = 0
+	if pain['shoulders'] < 0: pain['shoulders'] = 0
+	if pain['armL'] < 0: pain['armL'] = 0
+	if pain['armR'] < 0: pain['armR'] = 0
+	if pain['hands'] < 0: pain['hands'] = 0
+	if pain['fingers'] < 0: pain['fingers'] = 0
+	if pain['chest'] < 0: pain['chest'] = 0
+	if pain['breasts'] < 0: pain['breasts'] = 0
+	if pain['nipples'] < 0: pain['nipples'] = 0
+	if pain['ribs'] < 0: pain['ribs'] = 0
+	if pain['tummy'] < 0: pain['tummy'] = 0
+	if pain['pubic'] < 0: pain['pubic'] = 0
+	if pain['vaginal'] < 0: pain['vaginal'] = 0
+	if pain['clitoris'] < 0: pain['clitoris'] = 0
+	if pain['urethra'] < 0: pain['urethra'] = 0
+	if pain['cervix'] < 0: pain['cervix'] = 0
 	*clr & cla
 	gs 'obj_din', 'cheattabs'
 	'<center><h1>Cheat Menu - Pain Management</h1></center>'

+ 2 - 1
locations/LariskaHome.qsrc

@@ -480,7 +480,8 @@ if $ARGS[0] = 'lariska_bedroom':
 	else
 		'Her bed sits directly on the floor, without space underneath.'
 	end
-	'<table><tr><td valign="top">Your <a href="exec:gt ''budilnik'', ''start''">phone alarm</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt $loc">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt $loc">ON</a>.')
+
+	'<table><tr><td valign="top">Your <a href="exec:gt ''alarmclock'', ''start''">phone alarm</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
 	*nl
 	if locat['Lariska'] = 1:'<a href="exec:gt ''LariskaHome'', ''lariska_asleep_1''">Lariska</a> is sound asleep, curled up and wrapped in blankets.'
 	if locat['Lariska'] = 2:'<a href="exec:gt ''LariskaHome'', ''lariska_dressing_1''">Lariska</a> is getting dressed right now.'

+ 47 - 47
locations/budilnik.qsrc → locations/alarmclock.qsrc

@@ -1,4 +1,4 @@
-# budilnik
+# alarmclock
 
 menu_off = 1
 
@@ -14,28 +14,29 @@ if $ARGS[0] = 'start':
 	if numbud = 1: '<center><b><<bud1>></b><<bud2>>:<<bud3>><<bud4>></center>'
 	if numbud = 0: '<center><<bud1>><<bud2>> : <<bud3>><<bud4>></center>'
 
-	'<center><b><a href="exec:gt ''budilnik'', ''clear''">Clear</a>'
-	'<center><b><a href="exec:gt ''budilnik'', ''1''">1</a> <a href="exec:gt ''budilnik'', ''2''">2</a> <a href="exec:gt ''budilnik'', ''3''">3</a></b></center>'
-	'<center><b><a href="exec:gt ''budilnik'', ''4''">4</a> <a href="exec:gt ''budilnik'', ''5''">5</a> <a href="exec:gt ''budilnik'', ''6''">6</a></b></center>'
-	'<center><b><a href="exec:gt ''budilnik'', ''7''">7</a> <a href="exec:gt ''budilnik'', ''8''">8</a> <a href="exec:gt ''budilnik'', ''9''">9</a></b></center>'
-	'<center><b><a href="exec:gt ''budilnik'', ''0''">0</a></b></center>'
-	'<center><b><a href="exec: bud_weekend = 0 & gt ''budilnik'', ''Reset''">Reset weekday alarm</a> <a href="exec: bud_weekend = 0 & gt ''budilnik'', ''Time''">Set</a> weekday alarm to this time</b></center>'
+	'<center><b><a href="exec:gt ''alarmclock'', ''clear''">Clear</a>'
+	'<center><b><a href="exec:gt ''alarmclock'', ''1''">1</a> <a href="exec:gt ''alarmclock'', ''2''">2</a> <a href="exec:gt ''alarmclock'', ''3''">3</a></b></center>'
+	'<center><b><a href="exec:gt ''alarmclock'', ''4''">4</a> <a href="exec:gt ''alarmclock'', ''5''">5</a> <a href="exec:gt ''alarmclock'', ''6''">6</a></b></center>'
+	'<center><b><a href="exec:gt ''alarmclock'', ''7''">7</a> <a href="exec:gt ''alarmclock'', ''8''">8</a> <a href="exec:gt ''alarmclock'', ''9''">9</a></b></center>'
+	'<center><b><a href="exec:gt ''alarmclock'', ''0''">0</a></b></center>'
+	'<center><b><a href="exec: bud_weekend = 0 & gt ''alarmclock'', ''Reset''">Reset weekday alarm</a> <a href="exec: bud_weekend = 0 & gt ''alarmclock'', ''Time''">Set</a> weekday alarm to this time</b></center>'
+
+	'<center><b>Currently set for <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>></center>'
+	'<center><b><a href="exec: bud_weekend = 1 & gt ''alarmclock'', ''Reset''">Reset weekend alarm</a> <a href="exec: bud_weekend = 1 & gt ''alarmclock'', ''Time''">Set</a> weekend alarm to this time</b></center>'
+	'<center><b>Currently set for <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>></center>'
 
-	'<center><b>Currently set for <<func(''budilnik'', ''alarm_display'', timer, timerM)>></center>'
-	'<center><b><a href="exec: bud_weekend = 1 & gt ''budilnik'', ''Reset''">Reset weekend alarm</a> <a href="exec: bud_weekend = 1 & gt ''budilnik'', ''Time''">Set</a> weekend alarm to this time</b></center>'
-	'<center><b>Currently set for <<func(''budilnik'', ''alarm_display'', timerEnd, timerEndM)>></center>'
 	if mid($start_type,1,2) = 'sg' and alarm_holiday = 0:
-		'<center><b>Use weekend alarm for holidays - <a href="exec:  alarm_holiday = 1 & gt ''budilnik'', ''start''">OFF</a></b></center>'
+		'<center><b>Use weekend alarm for holidays - <a href="exec:  alarm_holiday = 1 & gt ''alarmclock'', ''start''">OFF</a></b></center>'
 	elseif mid($start_type,1,2) = 'sg' and alarm_holiday = 1:
-		'<center><b>Use weekend alarm for holidays - <a href="exec:  alarm_holiday = 0 & gt ''budilnik'', ''start''">ON</a></b></center>'
+		'<center><b>Use weekend alarm for holidays - <a href="exec:  alarm_holiday = 0 & gt ''alarmclock'', ''start''">ON</a></b></center>'
 	end
 
 	*nl
-	if budilnikOn = 0:
-		'<center>Your alarm is currently turned <a href="exec: budilnikOn = 1 & gt ''budilnik'', ''start''"><b>OFF</a></b></center>'
+	if alarmVars['alarmOn'] = 0:
+		'<center>Your alarm is currently turned <a href="exec: alarmVars[''alarmOn''] = 1 & gt ''alarmclock'', ''start''"><b>OFF</a></b></center>'
 	else
-		'<center>Your alarm is currently turned <a href="exec: budilnikOn = 0 & gt ''budilnik'', ''start''"><b>ON</b></a></center>'
-		'<center>The alarm is set to <<func(''budilnik'', ''alarm_display'', timer, timerM)>> during the week and to <<func(''budilnik'', ''alarm_display'', timerEnd, timerEndM)>> during the weekend.</center>'
+		'<center>Your alarm is currently turned <a href="exec: alarmVars[''alarmOn''] = 0 & gt ''alarmclock'', ''start''"><b>ON</b></a></center>'
+		'<center>The alarm is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend.</center>'
 	end
 	act 'Clear time display':
 		bud1 = 0
@@ -43,7 +44,7 @@ if $ARGS[0] = 'start':
 		bud3 = 0
 		bud4 = 0
 		numbud = 0
-		gt 'budilnik', 'fin'
+		gt 'alarmclock', 'fin'
 	end
 	act 'Finish':
 		bud1 = 0
@@ -51,12 +52,12 @@ if $ARGS[0] = 'start':
 		bud3 = 0
 		bud4 = 0
 		numbud = 0
-		gt 'budilnik', 'fin'
+		gt 'alarmclock', 'fin'
 	end
 end
 
 if $ARGS[0] = 'alarm_display':
-	!! func('budilnik', 'alarm_display', hour, minutes)
+	!! func('alarmclock', 'alarm_display', hour, minutes)
 	$result = '<b><<$mid(100 + hour, 2, 2)>>:<<$mid(100 + minut, 2, 2)>></b>'
 end
 
@@ -67,27 +68,27 @@ if $ARGS[0] = 'clear':
 	bud3 = 0
 	bud4 = 0
 	numbud = 0
-	gt 'budilnik', 'fin'
+	gt 'alarmclock', 'fin'
 end
 
 if $ARGS[0] = 'Time':
-	budilnikOn = 1
+	alarmVars['alarmOn'] = 1
 
 	if bud_weekend = 1:
-		timerEnd = bud1 * 10 + bud2
-		timerEndM = bud3 * 10 + bud4
+		alarmVars['timerEndH'] = bud1 * 10 + bud2
+		alarmVars['timerEndM'] = bud3 * 10 + bud4
 
-		if timerEnd > 23:timerEnd = 0
-		if timerEndM > 60:timerEndM = 0
+		if alarmVars['timerEndH'] > 23: alarmVars['timerEndH'] = 0
+		if alarmVars['timerEndM'] > 60: alarmVars['timerEndM'] = 0
 	else
-		timer = bud1 * 10 + bud2
-		timerM = bud3 * 10 + bud4
+		alarmVars['timerH'] = bud1 * 10 + bud2
+		alarmVars['timerM'] = bud3 * 10 + bud4
 
-		if timer > 23:timer = 0
-		if timerM > 60:timerM = 0
+		if alarmVars['timerH'] > 23: alarmVars['timerH'] = 0
+		if alarmVars['timerM'] > 60:alarmVars['timerM'] = 0
 	end
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '1':
@@ -97,7 +98,7 @@ if $ARGS[0] = '1':
 	if numbud = 1:bud2 = 1 & numbud = 2
 	if numbud = 0:bud1 = 1 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '2':
@@ -107,7 +108,7 @@ if $ARGS[0] = '2':
 	if numbud = 1:bud2 = 2 & numbud = 2
 	if numbud = 0:bud1 = 2 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '3':
@@ -117,7 +118,7 @@ if $ARGS[0] = '3':
 	if numbud = 1:bud2 = 3 & numbud = 2
 	if numbud = 0:bud1 = 3 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '4':
@@ -127,7 +128,7 @@ if $ARGS[0] = '4':
 	if numbud = 1:bud2 = 4 & numbud = 2
 	if numbud = 0:bud1 = 4 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '5':
@@ -137,7 +138,7 @@ if $ARGS[0] = '5':
 	if numbud = 1:bud2 = 5 & numbud = 2
 	if numbud = 0:bud1 = 5 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '6':
@@ -147,7 +148,7 @@ if $ARGS[0] = '6':
 	if numbud = 1:bud2 = 6 & numbud = 2
 	if numbud = 0:bud1 = 6 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '7':
@@ -157,7 +158,7 @@ if $ARGS[0] = '7':
 	if numbud = 1:bud2 = 7 & numbud = 2
 	if numbud = 0:bud1 = 7 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '8':
@@ -167,7 +168,7 @@ if $ARGS[0] = '8':
 	if numbud = 1:bud2 = 8 & numbud = 2
 	if numbud = 0:bud1 = 8 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '9':
@@ -177,7 +178,7 @@ if $ARGS[0] = '9':
 	if numbud = 1:bud2 = 9 & numbud = 2
 	if numbud = 0:bud1 = 9 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = '0':
@@ -187,16 +188,16 @@ if $ARGS[0] = '0':
 	if numbud = 1:bud2 = 0 & numbud = 2
 	if numbud = 0:bud1 = 0 & numbud = 1
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = 'Reset':
 	if bud_weekend = 1:
-		timerEnd = 0
-		timerEndM = 0
+		alarmVars['timerEndH'] = 0
+		alarmVars['timerEndM'] = 0
 	else
-		timer = 0
-		timerM = 0
+		alarmVars['timerH'] = 0
+		alarmVars['timerM'] = 0
 	end
 	bud1 = 0
 	bud2 = 0
@@ -204,10 +205,9 @@ if $ARGS[0] = 'Reset':
 	bud4 = 0
 	numbud = 0
 
-	gt 'budilnik', 'start'
+	gt 'alarmclock', 'start'
 end
 
 if $ARGS[0] = 'fin': gt $loc, $loc_arg
 
---- budilnik ---------------------------------
-
+--- alarmclock ---------------------------------

+ 13 - 390
locations/bed.qsrc

@@ -1,400 +1,23 @@
 # bed
-if $ARGS[0] = 'start':
-	*clr & cla
-	menu_off = 1
-	shour = 24 - hour
-	gs 'stat'
+$sleep_loc = 'bed'
+menu_off = 1
 
-	if hour > 22 and rand(0, 100) < 2 and houserab = 1 and houserabday ! daystart and pcs_sleep < 50 and $loc = 'nichBedroomServant':gt 'bed', 'rab'
-	if hour > 22 and rand(0, 200) = 0 and STRPOS('bedr,bedr2x,korr,korr2x',$loc) > 0 and husband = 0:gt 'bed', 'vor'
+!! Prepare to lie down, move to events related to entering the bed.
 
-	gt 'bed2'
-end
-
-if $ARGS[0] = 'mast':
-	*clr & cla
+if $ARGS[0] = 'start' or $ARGS[0] = '':
 	menu_off = 1
-	if pcs_inhib < 30:inhib_exp += rand(1,3)
-	pcs_mood += 15
-	pcs_vag += 1
-
-	if husband > 0 and STRPOS('bedr,bedr2x,korr,korr2x',$loc) > 0 and husbandrink ! 10:
-		if mc_inventory['dildo_small'] > 0:
-			if week > 5 or (week < 6 and hour > 16):
-				*clr & cla
-				'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m21.jpg"></center>'
-				'You bend over and start fucking your pussy with your dildo.'
-				gs 'arousal', 'vaginal_dildo', 15
-				gs 'stat'
-
-				if hour > 22 or hour < 7:'<<$husName>> looks at you, a little dumbfounded.'
-				if hour >= 7 and hour <= 22:'Once you get into it, <<$husName>> enters the room.'
-				if harakHusb = 0:
-					'"What are you doing?" he asks.'
-					'"I''m sorry dear, but I really need it, and you''ve been busy," you reply without stopping.'
-					'"How often do you do this?" he asks.'
-					'"Quite often, sometimes in my ass. you want to see?" you ask.'
-					if izvratH = 0:
-						husband -= 1
-						'"I''ll wait outside the door until you''re done," he says and leaves. You continue to satisfy yourself rapidly, and soon finish.'
-						$orgasm_or = 'yes'
-						gs 'arousal', 'clit_finger', 5, 'masturbate'
-						gs 'arousal', 'end'
-						gs 'stat'
-
-						act 'Finish':gt 'bed', 'start'
-					elseif izvratH = 1:
-						'"Oh. I don''t know..." he stammers.'
-						'"Come on," you encourage him.'
-
-						act 'Show him':
-							*clr & cla
-							'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m22.jpg"></center>'
-							'You pull the dildo out of your pussy and, winking at your husband, insert it into your ass. <<$husName>> watches closely as the dildo disappears into your ass.'
-							'You see how his pants swell. "Anything else you want, dear?" you ask while smiling.'
-							'"Can I join?" he asks, a little embarrassed.'
-							gs 'arousal', 'anal_dildo', 5, 'masturbate'
-							gs 'stat'
-
-							act 'Invite':
-								*clr & cla
-								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m23.jpg"></center>'
-								'<<$husName>> gets his dick out and starts masturbating. It''s not what you expected and you feel a little sad that he isn''t fucking you as you start to masturbate.'
-								'You watch your husband masturbate as he watches you, his face covered in pleasure, before you scream and fall on the table, having experienced an orgasm.'
-								'<<$husName>> is still masturbating, looking at you stretched out on the table before you take the dildo out of your ass and start lick it while looking into his eyes.'
-								'The spectacle has him immediately cum all over the floor before you walk over to him and kiss him on the lips. He passionately kisses you back.'
-								gs 'arousal', 'anal_dildo', 5, 'masturbate'
-								$orgasm_or = 'custom'
-								gs 'arousal', 'end'
-								gs 'stat'
-						
-								act 'Finish':gt 'bed', 'start'
-							end
-						end
-					end
-				elseif harakHusb = 1:
-					'"Are you trying to tell me that I''m not enough to satisfy you?" He asks.'
-					'"I''m sorry dear, but I really need this, and you''ve been busy," you reply without stopping.'
-					'"Well then, show me everything now that you know I''ll watch," he says.'
-					'"Want to see me do it in the ass too?" you offer.'
-
-					if izvratH = 0:
-						husband += 1
-						husbizvradd += 1
-						'"No, I think this is enough," he says as he sits on a chair and starts watching you. You continue to satisfy yourself rapidly and soon finish in front of him.'
-						$orgasm_or = 'yes'
-						gs 'arousal', 'clit_finger', 5, 'masturbate'
-						gs 'arousal', 'end'
-						gs 'stat'
-						'<<$husName>> stands up and playfully claps. "Bravo! Encore?" he laughs.'
-						'"Anything for such a lovely audience, but first an intermission," you laugh and <<$husName>> helps you down from the table.'
-
-						act 'Finish': gt 'bed', 'start'
-					elseif izvratH = 1:
-						husband += 1
-						'"Well then, I think you better show me," he says.'
-						'"As you wish," you reply.'
-
-						act 'Show':
-							*clr & cla
-							'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m22.jpg"></center>'
-							'You pull the dildo out of your pussy and, winking at your husband, insert it into your ass. <<$husName>> watches closely as you slide the dildo in and out of your ass.'
-							'You see how his pants swell. "Anything else you want, dear?" you ask while smiling.'
-							'"I don''t just want something, I''ll do something!" he replies, unbuttoning his pants and brings his cock to your mouth.'
-							gs 'arousal', 'anal_dildo', 5
-							gs 'stat'
-
-							act 'Suck him':
-								*clr & cla
-								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m24.jpg"></center>'
-								'You take his flaccid penis in your mouth and start sucking while continuing to drive the dildo into your ass.'
-								'When his cock has finally hardened, <<$husName>> stops you. "Now I''ll take this hole."'
-								gs 'arousal', 'clit_finger', 5
-								gs 'arousal', 'bj', -5
-								gs 'stat'
-						
-								act 'Get fucked in the ass':
-									picrand = 89
-									gt 'sex', 'anal'
-								end
-							end
-						end
-					elseif harakHusb = 2:
-						'"Itchy hole?" he asks.'
-						'"I''m sorry dear, but I really need it, and you''ve been busy," you reply without stopping.'
-
-						if izvratH = 0:
-							husband += 1
-							husbizvradd += 1
-							'"You should have said something. Now open your mouth," he says while pulling out his cock and forcefully pushing it into your mouth.'
-							'He holds you by the hair and fucks your mouth, telling you not to stop masturbating before he tires of your mouth. "Enough of this rubber shit! I''m going to fuck you."'
-							gs 'arousal', 'vaginal_dildo', 10
-							gs 'arousal', 'bj', -10
-							gs 'stat'
-						
-							act 'Spread your legs ':
-								picrand = 89
-								gt 'sex', 'vag'
-							end
-						elseif izvratH = 1:
-							husband += 1
-							'"You''re going to insert this stupid toy into your pussy, ass and mouth. You''ll pulverize them for as long as I like," he says while sitting down to watch.'
-							'You quickly and submissively do as you''re told.'
-							gs 'arousal', 'vaginal_dildo', 5
-							gs 'arousal', 'anal_dildo', -5
-							gs 'stat'
-
-							act 'Offer your mouth':
-								*clr & cla
-								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m24.jpg"></center>'
-								'Still using the dildo on your pussy and ass, you offer <<$husName>> your mouth. He gets up and walks over to you.'
-								'You take his flaccid penis and start sucking until his cock is finally hard and he stops you. "Now I''ll fuck your ass."'
-								gs 'arousal', 'vaginal_dildo', 5
-								gs 'arousal', 'anal_dildo', 5
-								gs 'arousal', 'bj', -10
-								gs 'stat'
-								
-								act 'Offer your ass':
-									picrand = 89
-									gt 'sex', 'anal'
-								end
-							end
-						end
-					end
-				end
-			else
-				'<center><video autoplay loop src="images/shared/sex/mast/mastr.mp4"></video></center>'
-				'Unable to control yourself anymore, you immediately reach for your dildo so you can finally take care of your lustful desires. You waste no time and attach the suction base of the dildo onto the floor before slowly lowering yourself.'
-				'Shivers run down your spine as you feel the thick head spreading your pussy lips and soon the whole length starts to slide deep inside your hole. A throaty moan overwhelms the room when it finally bottoms out inside you, sending you to the heavens and back.'
-				'After shifting your legs and getting more comfortable, you start to rock your hips and bounce on it, moaning louder and louder as you keep increasing the power and pace of your thrusts. You''re soon hammering your ass against the cold floor time and it takes you just a few minutes to reach orgasm, your toes curling tightly as a wonderful feeling run through your entire body.'
-				'You''re soon twitching on the dildo and juices drip down its length, soaking the floor beneath you. You take a few deep breaths and a smile grows along your face. That was just what you needed!'
-				$orgasm_or = 'custom'
-				gs 'arousal', 'vaginal_dildo', 10, 'masturbate'
-				gs 'arousal', 'end'
-				
-				act 'Breathe':gt 'bed', 'start'
-			end
-		elseif week > 5 or week < 6 and hour > 16:
-			'You feel the need for something inside you and think that your husband would be a better option.'
-		else
-			gt 'selfplay', 'start'
-		end
-	else
-		gt 'selfplay', 'start'
-	end
-end
-
-if $ARGS[0] = 'fin':
-	if STRPOS('bedr,bedr2x,korr,korr2x',$loc) > 0: gt 'bedr'
-	if $loc = 'uni_dorm': gt 'uni_dorm', 'dorm_room'
-	if $loc = 'nichBedroomServant': gt 'nichBedroomServant'
-end
-
-if $ARGS[0] = 'rab':
-	cla
-	*clr
-	menu_off = 1
-	minut += 120
-	houserabday = daystart
-	'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r0.jpg"></center>'
-	'Once you get into bed, your mistress comes into the room. "What, my bitch is going to sleep?" she snaps from the doorway.'
-	'"Yes..." you meekly reply.'
-	'"Yes, who?" she continues.'
-	'"Yes, mistress..." you reply and sit on the bed. She''s drunk and barely able to stand on her feet as she drinks wine from the bottle, spilling quite a bit of it on the floor.'
-	'"That''s better, but today you have to be punished." She lifts up her skirt and out pops the strap-on. "Suck it," she commands.'
-
-	act 'Suck it':
-		*clr & cla
-		
-		if analplugIN = 1:analplugIN = 0
-		if pcs_makeup ! 1 and cosmetic_tattoo = 0:pcs_makeup = 0
-
-		'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r1.jpg"></center>'
-		'You take the strap-on in your mouth and start sucking her off without much enthusiasm. Mistress, though she''s drunk, notices that you''re not trying and starts to thrust along with your movements, driving it deeper into your mouth and causing you to gag.'
-		'"Oh, damn stubborn bitch! Lie down on the bed. Quickly." She forcefully pushes you on the bed.'
-		gs 'arousal', 'bj', 5, 'sub', 'lesbian'
-		gs 'stat'
-		
-		act 'Lie down':
-			*clr & cla
-			'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r2.jpg"></center>'
-			'You lay down on the bed and she climbs on top of you and kneels over your face. She makes you open your mouth and forcefully shoves the strap-on in. You try to pull away, but her hands hold your head firmly. She continues to violate your mouth, hardly allowing you to catch a breath of air while she thrust it deeper and deeper, eventually sliding it down your throat, cutting off your breath completely. When you start to lose consciousness, she finally takes it out, allowing you to roll onto your side, wheezing and sniffling.'
-			'"And now for the punishment. Get up, bitch!" she demands.'
-			gs 'arousal', 'bj', 5, 'sub', 'lesbian', 'rough'
-			gs 'stat'
-		
-			act 'Get up':
-				*clr & cla
-				'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r3.jpg"></center>'
-				'You get up on all fours on the bed. "You''re wet," she says and wipes your saliva on your ass with the strap-on, "You need to be punished, not pleasured. Spread your ass."'
-				'You reach back with your hands and try to relax your ass, but you don''t succeed before the pain pierces your body as she forces the strap-on into your anus, not giving your ass the time to get used to it before she starts fucking you at a crazy pace. You grab the blankets with your hands and teeth as tears pour from your eyes and you whine, but she still continues. Growing tired, she lowers the pace. "Well, does it hurt?" she asks.'
-				'"Yes mistress, it hurts a lot!" you gasp through your tears.'
-				'"Well, let''s see how this feels," she says and starts pouring wine from her bottle onto the strap-on and your ass.'
-				'"Thank you, mistress!" you say while she starts gaining momentum again. The wine starts to dry on your skin and hurts so much that you start screaming from the pain. After what feels like an eternity, she tires out, removes the strap-on and leaves the room without saying a word. You collapse on the bed and fall asleep.'
-				gs 'arousal', 'anal_strap', 5, 'sub', 'lesbian', 'rough'
-				gs 'arousal', 'end'
-				gs 'stat'
-		
-				act 'Sleep': gt 'bed2'
-			end
-		end
-	end
-
-	gs 'willpower', 'sex', 'resist', 'medium'
-	if will_cost <= pcs_willpwr:
-		act 'Refuse (<<will_cost>> Willpower)':
-			*clr & cla
-			gs 'willpower', 'pay', 'resist'
-			gs 'stat'
-			lesbian += 1
-			orgasm += 1
-			houserab = 2
-			gs 'stat'
-			'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r4.jpg"></center>'
-			'"No!" you reply.'
-			'"You will suck now or things will get very bad for you!" she asserts.'
-			'"No!" you answer again.'
-			'"All right, you asked for it!" she screams and swings a fist, trying to hit you. You easily dodge the punch and kick her in the stomach.'
-			'"Bitch!" she moans while doubling over. You''ve suffered enough and jump out of bed, grabbing her head in your hands and kneeing her in the face.'
-			'She flies into the corner, but you don''t calm down. Remembering the taste of her dirty boots and sneakers, you storm up to her and start pushing a sneaker into her mouth.'
-			*nl
-			'When you can''t shove it in any further, you throw the sneaker aside, grab her hair and throw her onto the bed.'
-			'You jump on the bed, straddle her face and push your pussy against her mouth. "Eat me, bitch!" you yell as she tries to push you away.'
-			'You have her head held tight between your thighs, however, and continue yelling. You soon feel her tongue on your pussy and start moving your hips, grinding on her face and increasing the pace.'
-			'She doesn''t resist and tries to stick it in your pussy. You start enjoying her submissive nature and get more excited thinking about your dominant actions.'
-			'You''ve even thought about something to do with her strap-on and enjoying this thought when you orgasm. You wipe your crotch in her face and finish, leaving her whole face covered in your juices.'
-			*nl
-			'She quietly gets out of bed, straightens her clothes and leaves the room. "Animal." You should be careful; who knows what she will do to you in return.'
-			$orgasm_or = 'yes'
-			gs 'arousal', 'cuni', 20, 'dom', 'rough'
-			gs 'arousal', 'end'
-			gs 'stat'
-			
-			act 'Breathe': gt 'bed', 'start'
-		end
-	else
-		act 'Refuse (<font color="red"><<will_cost>> Willpower</font>)': '<br><font color="red">You don''t have enough willpower to use this action.</font>'
-	end	
-end
-
-if $ARGS[0] = 'vor':
-	*clr & cla
-	menu_off = 1
-	if rex['owned'] = 1:
-		if dog_bravery = 0:
-			dog_bravery = rand(1,100)
-		end
-
-		if dog_bravery >= 50:
-			minut += 10
-			'You''re lying in bed when you suddenly hear a commotion out in the hallway. You get up to check it out and as you arrive, you see <<$rex[''name'']>> chase two masked men outside. You can hear loud swearing as they run down the stairs.'
-			'You call your dog''s name and he comes back from the stairway looking calm.'
-
-			act 'Hug him':
-				cla
-				'You kneel down and hug <<$rex[''name'']>>, your heart pounding at the thought of what could have happened if he wasn''t here.'
-
-				act 'Check the lock':
-					cla
-					'You check the lock on the door and it appears to be intact. You''re not sure if you forgot to lock the door when you came in or if the lock was picked. Maybe you should have a second one installed...'
-					act 'Lock the door': gt 'korr'
-				end
-			end
-
-			act 'Check the lock':
-				cla
-				'You check the lock on the door and it appears to be intact. You''re not sure if you forgot to lock the door when you came in or if the lock was picked. Maybe you should have a second one installed...'
-				act 'Lock the door': gt 'korr'
-			end
-		else
-			'You''re lying in bed when you hear sounds from the hallway. You decide to get up and as you get to the door you see two masked men. <<$rex[''name'']>> is shivering in the corner.'
-			act 'Scream': gt 'bed', 'vor2'
-		end
-	else
-		'You''re lying in bed when you hear sounds from the hallway. You decide to get up and as you get to the door, you see two masked men.'
-		act 'Scream': gt 'bed', 'vor2'
-	end
-end
-
-if $ARGS[0] = 'vor2':
-	menu_off = 1
-	minut += 60
-	'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g0.jpg"></center>'
-	'You don''t even have time to open your mouth to scream when a knife is at your throat. "Scream and I''ll cut you, bitch!" one of them croaks.'
-	'They tie your hands and one goes to search your apartment while the second guards you. He sits down and studies you, then starts running his knife across your body.'
-	'"You scared?" he asks. Thinking that it''s better to keep silent, you say nothing and look at the floor. "So you <i>are</i> scared..."'
-	'He starts feeling you up and you try to pull away, but the knife is back at your throat. "Sit still or the knife might slip. Fatally..." he croaks and continues feeling you up.'
-	'The other intruder finally returns. "Time we got out of here," he says. "Unless we give this juicy little morsel a treat," he adds as he sits next to you.'
-
-	if pcs_apprnc >= 120:
-		guy += 2
-		rape += 1
-		'"Hey, sweet cheeks. Something tells me you like to fuck," the first one says.'
-
-		act 'Plead':
-			*clr & cla
-			'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g1.jpg"></center>'
-			'You''re struck with fear. "Kneel down and open your mouth, whore. If we so much as feel a tooth, I''ll cut your throat from ear to ear!" the second one says while pulling his cock out.'
-			'You start pleading with them, but they just push you to your knees and he jabs his dick against your lips. You reluctantly open your mouth and his cock slides into your mouth.'
-			'His hands clench your head and he starts fucking your face before they start taking turns with you.'
-			'"Get her on all fours," one of them eventually commands.'
-			gs 'arousal', 'bj', 15, 'rough', 'sub', 'group', 'bound'
-			gs 'stat'
-			
-			act 'Get up':
-				*clr & cla
-				orgasm += 1
-				gs 'npcgeneratec', 0, 'Rapist', rand(18,40)
-				$boy[0] = $npclastgenerated
-				$boydesc[0] = $npc_usedname[$npclastgenerated]
-				gs 'npcgeneratec', 0, 'Rapist', rand(18,40)
-				$boy[1] = $npclastgenerated
-				$boydesc[1] = $npc_usedname[$npclastgenerated]
-				'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g2.jpg"></center>'
-				'You stand up and bend over as one of them stands behind you and stuffs his dick into your pussy.'
-				'"Open your mouth!" the second guy growls and he inserts his dick into your mouth. They proceed to rape you from both sides before they untie your hands and get off you. "Let''s see what she can do with her hands free," one of them says.'
-				$orgasm_or = 'yes'
-				gs 'arousal', 'bj', 15, 'rough', 'sub', 'group', 'bound'
-				gs 'arousal', 'vaginal', 15, 'rough', 'sub', 'group', 'bound'
-				minut -= 15
-				gs 'stat'
-			
-				act 'Continue': picrand = 38 & xgt 'sexdvoe', 'var'
-			end
-		end
-	elseif pcs_apprnc < 120:
-		'"Gag her," one of them orders and the second one doesn''t argue as he takes some of your clothes and stuffs them in your mouth. "If you try to leave in the next half hour, you''re dead," he says and they leave.'
-		'You don''t wait half an hour before you start trying to break free. Fortunately, they really didn''t know how to tie a knot and you''re soon free.'
+	shour = 24 - hour
+	gs 'stat'
 
-		act 'Assess the damage': gt 'bed', 'vorend'
-	end
+	gs 'bed', 'mod_triggers'
+	gt 'bed_events', 'start'
 end
 
-if $ARGS[0] = 'vorend':
-	*clr & cla
-	menu_off = 1
-	if remsitr = 0:'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sitr.jpg"></center>'
-	if remsitr = 1:'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sitr2.jpg"></center>'
-
-	'Relieved that it''s over, you check your apartment to see what''s missing.'
-
-	if stolmoney > 0:
-		'They took <<stolmoney>> <b>₽</b> from your living room table.'
-		stolmoney = 0
-	end
-
-	if money > 0:
-		'They took the <<money>> <b>₽</b> that you had on you.'
-		money = 0
-	end
-
-	if mc_inventory['tech_computer'] = 1:
-		'They took your computer.'
-		mc_inventory['tech_computer'] = 0
-	end
-
-	gs 'stat'
-	act 'Finish': gt 'sitr'
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'bed' and $$ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
 end
 
 --- bed ---------------------------------

+ 73 - 52
locations/bed2.qsrc

@@ -1,11 +1,18 @@
 # bed2
-!2020/10/14/Gwen
-if $ARGS[0] = '':
-	cla & *clr
-	$menu_loc = 'bed2'
-	$menu_arg = ''
+$sleep_loc = 'bed2'
+
+!! Lying in bed hub. From here PC can take various actions, including going to sleep.
+!!
+!! Moved here from bed_events
+!! Going to sleep: move to pre_sleep_events
+
+if $ARGS[0] = 'bed2' or $ARGS[0] = 'start' or $ARGS[0] = '':
 	menu_off = 0
+	$menu_loc = 'bed2'
 	$alarmloc = 'bed2'
+	$menu_arg = 'start'
+	$alarmarg = 'start'
+
 	if clo_flag['bed'] = 1:
 		clo_flag['bed'] = 0
 		gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
@@ -13,78 +20,92 @@ if $ARGS[0] = '':
 		gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
 	end
 	gs 'stat'
+
 	if $clothingworntype ! 'nude':
 		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
 	else
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
 	end
 	*nl
-	
-	'Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt ''bed2''">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt ''bed2''">ON</a>.')
-	
+	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt ''bed2'', ''start''">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt ''bed2'', ''start''">ON</a>.')
 	*nl
-	if hypnoPanty <= 0:
-		if bedPanty = 0:
-			'Will you always wear your underwear to bed? Currently - <a href="exec:bedPanty = 1 & gs ''stat'' & & gt ''bed2''">AS IS</a>.'
-		elseif bedPanty = 1:
-			'Will you always wear your underwear to bed? Currently - <a href="exec:bedPanty = 2 & gs ''stat'' & gt ''bed2''">YES</a>.'
-		elseif bedPanty = 2:
-			'Will you always wear your underwear to bed? Currently - <a href="exec:bedPanty = 0 & gs ''stat'' & gt ''bed2''">NO</a>.'
-		end
-	end
+	gs 'bed2', 'wear_panties_decider'
 	*nl
+	gs 'bed2', 'wear_buttplug_decider'
+	gs 'bed2', 'wear_vibe_decider'
 
-	if mc_inventory['buttplug'] = 1 :
-		if bedAnal = 0:
-			'Should you always remove your anal plug before bed? Currently - <a href="exec:bedAnal = 1 & gs ''stat'' & gt ''bed2''">NO</a>.'
-		elseif bedAnal = 1:
-			'Should you always remove your anal plug before bed? Currently - <a href="exec:bedAnal = 0 & gs ''stat'' & gt ''bed2''">YES</a>.'
-		end
-	end
 
-	if mc_inventory['vibe'] = 1 and cheatVib = 1:
-		if bedVibrator = 0:
-			'Should you always remove your vibrator before bed? Currently - <a href="exec:bedVibrator = 1 & gs ''stat'' & gt ''bed2''">NO</a>.'
-		elseif bedVibrator = 1:
-			'Should you always remove your vibrator before bed? Currently - <a href="exec:bedVibrator = 0 & gs ''stat'' & gt ''bed2''">YES</a>.'
-		end
-	end
-
-	if pcs_makeup ! 1 and cosmetic_tattoo = 0:*nl '<b><font color="red">You need to wash off your makeup before going to bed.</font></b>'
+	if pcs_makeup ! 1 and cosmetic_tattoo = 0: *nl '<b><font color="red">You need to wash off your makeup before going to bed.</font></b>'
 
 	if pcs_sleep <= 80:
 		if $clothingworntype = 'nude':
-			$sleep_txt = 'Go to bed'
+			act 'Go to bed': gt 'pre_sleep_events'
 		else
-			$sleep_txt = 'Undress and go to bed'
+			act 'Undress and go to bed': gt 'pre_sleep_events'
 		end
-		gs 'sleep', 'full'
 	end
-	act 'Get out of bed': killvar '$sleep_txt' & gt $loc, $loc_arg
-	gs 'sleep', 'nap_bed'
+
+	act 'Get out of bed': gt 'bed_get_out', 'start'
+	gs 'sleep_simple', 'nap_bed'
 	gs 'events', 'read'
 
-	if $loc = 'bedrPar':
-		if locat['Anya_inroom'] = 0 or locat['Anya'] = 1 or locat['Anya'] = 26:
-			if mc_inventory['mag_porn'] > 0:gs 'events', 'read_porn'
-			if (pcs_horny > 75 and pcs_inhib >= 60) or (pcs_horny > 50 and fame['pav_slut'] >= 150) or (pcs_horny > 50 and fame['pav_slut'] >= 50 and pcs_inhib >= 60):
-				act 'Masturbate':
-					InSleep = 0
-					gt 'selfplay', 'start'
-				end
-			end
-		end
-	else
-		if mc_inventory['mag_porn'] > 0:gs 'events', 'read_porn'
-		if (pcs_horny > 75 and pcs_inhib >= 60) or (pcs_horny > 50 and fame['pav_slut'] >= 150) or (pcs_horny > 50 and fame['pav_slut'] >= 50 and pcs_inhib >= 60):
+	if $loc ! 'bedrPar' or locat['Anya_inroom'] = 0 or locat['Anya'] = 1 or locat['Anya'] = 26:
+		if mc_inventory['mag_porn'] > 0: gs 'events', 'read_porn'
+		if (pcs_horny > 75 and pcs_inhib >= 60) or (pcs_horny > 50 and (fame['pav_slut'] >= 150 or (fame['pav_slut'] >= 50 and pcs_inhib >= 60))):
 			act 'Masturbate':
 				InSleep = 0
 				gt 'selfplay', 'start'
 			end
 		end
 	end
+
+	gs 'bed2', 'mod_triggers'
 end
 
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'bed2' and $ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
+end
 
---- bed2 ---------------------------------
 
+if $ARGS[0] = 'wear_panties_decider':
+	if hypnoPanty <= 0:
+		if sleepVars['bedPanty'] = 0:
+			'Will you always wear your underwear to bed? Currently - <a href="exec:sleepVars[''bedPanty''] = 1 & gs ''stat'' & gt ''bed'', ''bed2''">AS IS</a>.'
+		elseif sleepVars['bedPanty'] = 1:
+			'Will you always wear your underwear to bed? Currently - <a href="exec:sleepVars[''bedPanty''] = 2 & gs ''stat'' & gt ''bed'', ''bed2''">YES</a>.'
+		elseif sleepVars['bedPanty'] = 2:
+			'Will you always wear your underwear to bed? Currently - <a href="exec:sleepVars[''bedPanty''] = 0 & gs ''stat'' & gt ''bed'', ''bed2''">NO</a>.'
+		end
+	end
+end
+
+if $ARGS[0] = 'wear_buttplug_decider':
+	if mc_inventory['buttplug'] = 1:
+		if sleepVars['bedAnal'] = 0:
+			'Should you always remove your anal plug before bed? Currently - <a href="exec:sleepVars[''bedAnal''] = 1 & gs ''stat'' & gt ''bed'', ''bed2''">NO</a>.'
+		elseif sleepVars['bedAnal'] = 1:
+			'Should you always remove your anal plug before bed? Currently - <a href="exec:sleepVars[''bedAnal''] = 0 & gs ''stat'' & gt ''bed'', ''bed2''">YES</a>.'
+		end
+	end
+end
+
+if $ARGS[0] = 'wear_vibe_decider':
+	if mc_inventory['vibe'] = 1 and sleepVars['cheatVib'] = 1:
+		if sleepVars['bedVibrator'] = 0:
+			'Should you always remove your vibrator before bed? Currently - <a href="exec:sleepVars[''bedVibrator''] = 1 & gs ''stat'' & gt ''bed'', ''bed2''">NO</a>.'
+		elseif sleepVars['bedVibrator'] = 1:
+			'Should you always remove your vibrator before bed? Currently - <a href="exec:sleepVars[''bedVibrator''] = 0 & gs ''stat'' & gt ''bed'', ''bed2''">YES</a>.'
+		end
+	end
+end
+
+if $ARGS[0] = 'fin':
+	if strpos('bedr,bedr2x,korr,korr2x',$loc) > 0: gt 'bedr'
+	if $loc = 'uni_dorm': gt 'uni_dorm', 'dorm_room'
+	if $loc = 'nichBedroomServant': gt 'nichBedroomServant'
+end
+
+--- bed2 ---------------------------------

+ 532 - 0
locations/bed_events.qsrc

@@ -0,0 +1,532 @@
+# bed_events
+$sleep_loc = 'bed_events'
+menu_off = 1
+
+!! Bed events trigger after going to lie down on the bed, but before actually lying down in bed (and getting to choose to sleep, get out, read a book, etc)
+!!
+!! Moved here from bed.
+!! When done, move to bed2
+
+	!!=====================================!!
+	!!                                     !!
+	!!          Event handlers             !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+
+	if sleepVars['events_active'] = 1:
+		sleepVars['events_done'] = 0
+
+		if (hour > 22 or hour < 3) and rand(0, 50) = 0 and houserab = 1 and houserabday ! daystart and pcs_sleep < 50 and $loc = 'nichBedroomServant':
+			$sleep_events[] = 'gs ''bed_events'', ''rab'' '
+		end
+		if (hour > 22 or hour < 3) and rand(0, 200) = 0 and strpos('bedr,bedr2x,korr,korr2x',$loc) > 0 and husband = 0:
+			$sleep_events[] = 'gs ''bed_events'', ''vor'' '
+		end
+
+		gt 'bed_events', 'mod_events'
+	end
+
+	gt 'bed_events', 'continue'
+end
+
+if $ARGS[0] = 'mod_events':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'bed_events' and $ARGS[0] = 'mod_events'
+	!!
+	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!! A random event will be chosen from amongst the added ones.
+	!! If an event MUST trigger (due to quest timing), add it tp $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!!
+	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'bed_events', 'event_end'
+	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'bed_events', 'exit' before exiting the location
+	!!     Example: Act: 'Leave': gs 'bed_events', 'exit' & gt $new_loc, $new_log_arg
+	!!
+	!! This is to cleanup all necessary variables.
+	!!
+	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
+	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
+
+	gt 'bed_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'event_handler':
+	if sleepVars['events_done'] < 1:
+		if arrsize('$sleep_events_priority') > 0:
+			gt 'bed_events', 'event_handler2', 'priority'
+		elseif arrsize('$sleep_events') > 0:
+			gt 'bed_events', 'event_handler2'
+		end
+	end
+
+	gt 'bed_events', 'continue'
+end
+
+if $ARGS[0] = 'event_handler2':
+	sleepVars['events_done'] += 1
+	
+	if $ARGS[1] = 'priority':
+		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
+		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
+		killvar '$sleep_events_priority', temp_slev_id
+	else
+		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
+		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
+		killvar '$sleep_events', temp_slev_id
+	end
+
+	killvar 'temp_slev_id'
+	dynamic $temp_sleep_event_chosen
+end
+
+
+if $ARGS[0] = 'event_end':
+
+!!	if arrsize('$sleep_events_priority') > 0:
+!!		gt 'bed_events', 'event_handler2', 'priority'
+!!	end
+
+	gt 'bed_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'exit':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+end
+
+if $ARGS[0] = 'continue':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+
+	gt 'bed2', 'start'
+end
+
+
+
+
+	!!=====================================!!
+	!!                                     !!
+	!!              Events                 !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'rab':
+	menu_off = 1
+	minut += 120
+	houserabday = daystart
+
+	'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r0.jpg"></center>'
+	'Once you get into bed, your mistress comes into the room. "What, my bitch is going to sleep?" she snaps from the doorway.'
+	'"Yes..." you meekly reply.'
+	'"Yes, who?" she continues.'
+	'"Yes, mistress..." you reply and sit on the bed. She''s drunk and barely able to stand on her feet as she drinks wine from the bottle, spilling quite a bit of it on the floor.'
+	'"That''s better, but today you have to be punished." She lifts up her skirt and out pops the strap-on. "Suck it," she commands.'
+
+	act 'Suck it':
+		*clr & cla
+
+		if analplugIN = 1: analplugIN = 0
+		if pcs_makeup ! 1 and cosmetic_tattoo = 0: pcs_makeup = 0
+
+		'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r1.jpg"></center>'
+		'You take the strap-on in your mouth and start sucking her off without much enthusiasm. Mistress, though she''s drunk, notices that you''re not trying and starts to thrust along with your movements, driving it deeper into your mouth and causing you to gag.'
+		'"Oh, damn stubborn bitch! Lie down on the bed. Quickly." She forcefully pushes you on the bed.'
+
+		gs 'arousal', 'bj', 5, 'sub', 'lesbian'
+		gs 'stat'
+		
+		act 'Lie down':
+			*clr & cla
+			'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r2.jpg"></center>'
+			'You lay down on the bed and she climbs on top of you and kneels over your face. She makes you open your mouth and forcefully shoves the strap-on in. You try to pull away, but her hands hold your head firmly. She continues to violate your mouth, hardly allowing you to catch a breath of air while she thrust it deeper and deeper, eventually sliding it down your throat, cutting off your breath completely. When you start to lose consciousness, she finally takes it out, allowing you to roll onto your side, wheezing and sniffling.'
+			'"And now for the punishment. Get up, bitch!" she demands.'
+
+			gs 'arousal', 'bj', 5, 'sub', 'lesbian', 'rough'
+			gs 'stat'
+		
+			act 'Get up':
+				*clr & cla
+				'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r3.jpg"></center>'
+				'You get up on all fours on the bed. "You''re wet," she says and wipes your saliva on your ass with the strap-on, "You need to be punished, not pleasured. Spread your ass."'
+				'You reach back with your hands and try to relax your ass, but you don''t succeed before the pain pierces your body as she forces the strap-on into your anus, not giving your ass the time to get used to it before she starts fucking you at a crazy pace. You grab the blankets with your hands and teeth as tears pour from your eyes and you whine, but she still continues. Growing tired, she lowers the pace. "Well, does it hurt?" she asks.'
+				'"Yes mistress, it hurts a lot!" you gasp through your tears.'
+				'"Well, let''s see how this feels," she says and starts pouring wine from her bottle onto the strap-on and your ass.'
+				'"Thank you, mistress!" you say while she starts gaining momentum again. The wine starts to dry on your skin and hurts so much that you start screaming from the pain. After what feels like an eternity, she tires out, removes the strap-on and leaves the room without saying a word. You collapse on the bed and fall asleep.'
+
+				gs 'arousal', 'anal_strap', 5, 'sub', 'lesbian', 'rough'
+				gs 'arousal', 'end'
+				gs 'stat'
+
+				act 'Sleep': gs 'bed_events', 'event_end'
+			end
+		end
+	end
+
+	gs 'willpower', 'sex', 'resist', 'medium'
+	if pcs_willpwr < will_cost:
+		act 'Refuse (<font color="red"><<will_cost>> Willpower</font>)': '<br><font color="red">You don''t have enough willpower to use this action.</font>'
+	else
+		act 'Refuse (<<will_cost>> Willpower)':
+			*clr & cla
+			gs 'willpower', 'pay', 'resist'
+			gs 'stat'
+			lesbian += 1
+			orgasm += 1
+			houserab = 2
+			gs 'stat'
+
+			'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r4.jpg"></center>'
+			'"No!" you reply.'
+			'"You will suck now or things will get very bad for you!" she asserts.'
+			'"No!" you answer again.'
+			'"All right, you asked for it!" she screams and swings a fist, trying to hit you. You easily dodge the punch and kick her in the stomach.'
+			'"Bitch!" she moans while doubling over. You''ve suffered enough and jump out of bed, grabbing her head in your hands and kneeing her in the face.'
+			'She flies into the corner, but you don''t calm down. Remembering the taste of her dirty boots and sneakers, you storm up to her and start pushing a sneaker into her mouth.'
+			*nl
+			'When you can''t shove it in any further, you throw the sneaker aside, grab her hair and throw her onto the bed.'
+			'You jump on the bed, straddle her face and push your pussy against her mouth. "Eat me, bitch!" you yell as she tries to push you away.'
+			'You have her head held tight between your thighs, however, and continue yelling. You soon feel her tongue on your pussy and start moving your hips, grinding on her face and increasing the pace.'
+			'She doesn''t resist and tries to stick it in your pussy. You start enjoying her submissive nature and get more excited thinking about your dominant actions.'
+			'You''ve even thought about something to do with her strap-on and enjoying this thought when you orgasm. You wipe your crotch in her face and finish, leaving her whole face covered in your juices.'
+			*nl
+			'She quietly gets out of bed, straightens her clothes and leaves the room. "Animal." You should be careful; who knows what she will do to you in return.'
+
+			$orgasm_or = 'yes'
+			gs 'arousal', 'cuni', 20, 'dom', 'rough'
+			gs 'arousal', 'end'
+			gs 'stat'
+
+			act 'Breathe': gs 'bed_events', 'event_end'
+		end
+	end
+end
+
+
+if $ARGS[0] = 'vor':
+	menu_off = 1
+	if rex['owned'] = 0:
+		'You''re lying in bed when you hear sounds from the hallway. You decide to get up and as you get to the door, you see two masked men.'
+		act 'Scream': gt 'bed_events', 'vor2'
+
+	else
+		if dog_bravery = 0: 
+			dog_bravery = rand(1,100)
+
+		if dog_bravery < 50:
+			'You''re lying in bed when you hear sounds from the hallway. You decide to get up and as you get to the door you see two masked men. <<$rex[''name'']>> is shivering in the corner.'
+			act 'Scream': gt 'bed_events', 'vor2'
+
+		else
+			minut += 10
+			'You''re lying in bed when you suddenly hear a commotion out in the hallway. You get up to check it out and as you arrive, you see <<$rex[''name'']>> chase two masked men outside. You can hear loud swearing as they run down the stairs.'
+			'You call your dog''s name and he comes back from the stairway looking calm.'
+
+			act 'Hug him':
+				'You kneel down and hug <<$rex[''name'']>>, your heart pounding at the thought of what could have happened if he wasn''t here.'
+				delact 'Hug him'
+			end
+
+			act 'Check the lock':
+				cla
+				'You check the lock on the door and it appears to be intact. You''re not sure if you forgot to lock the door when you came in or if the lock was picked. Maybe you should have a second one installed...'
+				act 'Lock the door': 
+					gs 'bed_events', 'exit'
+					gt 'korr'
+				end
+			end
+		end
+	end
+end
+
+
+if $ARGS[0] = 'vor2':
+	menu_off = 1
+	minut += 60
+	'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g0.jpg"></center>'
+	'You don''t even have time to open your mouth to scream when a knife is at your throat. "Scream and I''ll cut you, bitch!" one of them croaks.'
+	'They tie your hands and one goes to search your apartment while the second guards you. He sits down and studies you, then starts running his knife across your body.'
+	'"You scared?" he asks. Thinking that it''s better to keep silent, you say nothing and look at the floor. "So you <i>are</i> scared..."'
+	'He starts feeling you up and you try to pull away, but the knife is back at your throat. "Sit still or the knife might slip. Fatally..." he croaks and continues feeling you up.'
+	'The other intruder finally returns. "Time we got out of here," he says. "Unless we give this juicy little morsel a treat," he adds as he sits next to you.'
+
+	if pcs_apprnc < 120:
+		'"Gag her," one of them orders and the second one doesn''t argue as he takes some of your clothes and stuffs them in your mouth. "If you try to leave in the next half hour, you''re dead," he says and they leave.'
+		'You don''t wait half an hour before you start trying to break free. Fortunately, they really didn''t know how to tie a knot and you''re soon free.'
+
+		act 'Assess the damage': gt 'bed_events', 'vorend'
+
+	else
+		guy += 2
+		rape += 1
+		'"Hey, sweet cheeks. Something tells me you like to fuck," the first one says.'
+
+		act 'Plead':
+			*clr & cla
+			'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g1.jpg"></center>'
+			'You''re struck with fear. "Kneel down and open your mouth, whore. If we so much as feel a tooth, I''ll cut your throat from ear to ear!" the second one says while pulling his cock out.'
+			'You start pleading with them, but they just push you to your knees and he jabs his dick against your lips. You reluctantly open your mouth and his cock slides into your mouth.'
+			'His hands clench your head and he starts fucking your face before they start taking turns with you.'
+			'"Get her on all fours," one of them eventually commands.'
+
+			gs 'arousal', 'bj', 15, 'rough', 'sub', 'group', 'bound'
+			gs 'stat'
+			
+			act 'Get up':
+				*clr & cla
+				orgasm += 1
+				gs 'npcgeneratec', 0, 'Rapist', rand(18,40)
+				$boy[0] = $npclastgenerated
+				$boydesc[0] = $npc_usedname[$npclastgenerated]
+
+				gs 'npcgeneratec', 0, 'Rapist', rand(18,40)
+				$boy[1] = $npclastgenerated
+				$boydesc[1] = $npc_usedname[$npclastgenerated]
+
+				'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g2.jpg"></center>'
+				'You stand up and bend over as one of them stands behind you and stuffs his dick into your pussy.'
+				'"Open your mouth!" the second guy growls and he inserts his dick into your mouth. They proceed to rape you from both sides before they untie your hands and get off you. "Let''s see what she can do with her hands free," one of them says.'
+
+				$orgasm_or = 'yes'
+				gs 'arousal', 'bj', 15, 'rough', 'sub', 'group', 'bound'
+				gs 'arousal', 'vaginal', 15, 'rough', 'sub', 'group', 'bound'
+				minut -= 15
+				gs 'stat'
+			
+				act 'Continue': 
+					picrand = 38
+					gs 'bed_events', 'exit'
+					xgt 'sexdvoe', 'var'
+				end
+			end
+		end
+	end
+end
+
+
+if $ARGS[0] = 'vorend':
+	*clr & cla
+	menu_off = 1
+	if remsitr = 0: '<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sitr.jpg"></center>'
+	if remsitr = 1: '<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sitr2.jpg"></center>'
+
+	'Relieved that it''s over, you check your apartment to see what''s missing.'
+
+	if stolmoney > 0:
+		'They took <<stolmoney>> <b>₽</b> from your living room table.'
+		stolmoney = 0
+	end
+
+	if money > 0:
+		'They took the <<money>> <b>₽</b> that you had on you.'
+		money = 0
+	end
+
+	if mc_inventory['tech_computer'] = 1:
+		'They took your computer.'
+		mc_inventory['tech_computer'] = 0
+	end
+
+	gs 'stat'
+	act 'Finish': gs 'bed_events', 'event_end'
+end
+
+
+if $ARGS[0] = 'mast':
+	menu_off = 1
+	if pcs_inhib < 30: inhib_exp += rand(1,3)
+	pcs_mood += 15
+	pcs_vag += 1
+
+	if husband = 0 or strpos('bedr,bedr2x,korr,korr2x',$loc) <= 0 or husbandrink = 10:
+		gt 'selfplay', 'start'
+	else
+		if mc_inventory['dildo_small'] = 0:
+			if week > 5 or week < 6 and hour > 16:
+				'You feel the need for something inside you and think that your husband would be a better option.'
+			else
+				gt 'selfplay', 'start'
+			end
+		else
+			if week <= 5 and hour <= 15:
+				'<center><video autoplay loop src="images/shared/sex/mast/mastr.mp4"></video></center>'
+				'Unable to control yourself anymore, you immediately reach for your dildo so you can finally take care of your lustful desires. You waste no time and attach the suction base of the dildo onto the floor before slowly lowering yourself.'
+				'Shivers run down your spine as you feel the thick head spreading your pussy lips and soon the whole length starts to slide deep inside your hole. A throaty moan overwhelms the room when it finally bottoms out inside you, sending you to the heavens and back.'
+				'After shifting your legs and getting more comfortable, you start to rock your hips and bounce on it, moaning louder and louder as you keep increasing the power and pace of your thrusts. You''re soon hammering your ass against the cold floor time and it takes you just a few minutes to reach orgasm, your toes curling tightly as a wonderful feeling run through your entire body.'
+				'You''re soon twitching on the dildo and juices drip down its length, soaking the floor beneath you. You take a few deep breaths and a smile grows along your face. That was just what you needed!'
+				$orgasm_or = 'custom'
+				gs 'arousal', 'vaginal_dildo', 10, 'masturbate'
+				gs 'arousal', 'end'
+				
+				act 'Breathe': gs 'bed_events', 'event_end'
+
+			else
+				'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m21.jpg"></center>'
+				'You bend over and start fucking your pussy with your dildo.'
+				gs 'arousal', 'vaginal_dildo', 15
+				gs 'stat'
+
+				if hour > 22 or hour < 7:'<<$husName>> looks at you, a little dumbfounded.'
+				if hour >= 7 and hour <= 22:'Once you get into it, <<$husName>> enters the room.'
+				if harakHusb = 0:
+					'"What are you doing?" he asks.'
+					'"I''m sorry dear, but I really need it, and you''ve been busy," you reply without stopping.'
+					'"How often do you do this?" he asks.'
+					'"Quite often, sometimes in my ass. you want to see?" you ask.'
+					if izvratH = 0:
+						husband -= 1
+						'"I''ll wait outside the door until you''re done," he says and leaves. You continue to satisfy yourself rapidly, and soon finish.'
+						$orgasm_or = 'yes'
+						gs 'arousal', 'clit_finger', 5, 'masturbate'
+						gs 'arousal', 'end'
+						gs 'stat'
+
+						act 'Finish': gs 'bed_events', 'event_end'
+
+					elseif izvratH = 1:
+						'"Oh. I don''t know..." he stammers.'
+						'"Come on," you encourage him.'
+
+						act 'Show him':
+							*clr & cla
+							'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m22.jpg"></center>'
+							'You pull the dildo out of your pussy and, winking at your husband, insert it into your ass. <<$husName>> watches closely as the dildo disappears into your ass.'
+							'You see how his pants swell. "Anything else you want, dear?" you ask while smiling.'
+							'"Can I join?" he asks, a little embarrassed.'
+							gs 'arousal', 'anal_dildo', 5, 'masturbate'
+							gs 'stat'
+
+							act 'Invite':
+								*clr & cla
+								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m23.jpg"></center>'
+								'<<$husName>> gets his dick out and starts masturbating. It''s not what you expected and you feel a little sad that he isn''t fucking you as you start to masturbate.'
+								'You watch your husband masturbate as he watches you, his face covered in pleasure, before you scream and fall on the table, having experienced an orgasm.'
+								'<<$husName>> is still masturbating, looking at you stretched out on the table before you take the dildo out of your ass and start lick it while looking into his eyes.'
+								'The spectacle has him immediately cum all over the floor before you walk over to him and kiss him on the lips. He passionately kisses you back.'
+								gs 'arousal', 'anal_dildo', 5, 'masturbate'
+								$orgasm_or = 'custom'
+								gs 'arousal', 'end'
+								gs 'stat'
+						
+								act 'Finish': gs 'bed_events', 'event_end'
+							end
+						end
+					end
+
+				elseif harakHusb = 1:
+					'"Are you trying to tell me that I''m not enough to satisfy you?" He asks.'
+					'"I''m sorry dear, but I really need this, and you''ve been busy," you reply without stopping.'
+					'"Well then, show me everything now that you know I''ll watch," he says.'
+					'"Want to see me do it in the ass too?" you offer.'
+
+					if izvratH = 0:
+						husband += 1
+						husbizvradd += 1
+						'"No, I think this is enough," he says as he sits on a chair and starts watching you. You continue to satisfy yourself rapidly and soon finish in front of him.'
+						$orgasm_or = 'yes'
+						gs 'arousal', 'clit_finger', 5, 'masturbate'
+						gs 'arousal', 'end'
+						gs 'stat'
+						'<<$husName>> stands up and playfully claps. "Bravo! Encore?" he laughs.'
+						'"Anything for such a lovely audience, but first an intermission," you laugh and <<$husName>> helps you down from the table.'
+
+						act 'Finish': gs 'bed_events', 'event_end'
+
+					elseif izvratH = 1:
+						husband += 1
+						'"Well then, I think you better show me," he says.'
+						'"As you wish," you reply.'
+
+						act 'Show':
+							*clr & cla
+							'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m22.jpg"></center>'
+							'You pull the dildo out of your pussy and, winking at your husband, insert it into your ass. <<$husName>> watches closely as you slide the dildo in and out of your ass.'
+							'You see how his pants swell. "Anything else you want, dear?" you ask while smiling.'
+							'"I don''t just want something, I''ll do something!" he replies, unbuttoning his pants and brings his cock to your mouth.'
+							gs 'arousal', 'anal_dildo', 5
+							gs 'stat'
+
+							act 'Suck him':
+								*clr & cla
+								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m24.jpg"></center>'
+								'You take his flaccid penis in your mouth and start sucking while continuing to drive the dildo into your ass.'
+								'When his cock has finally hardened, <<$husName>> stops you. "Now I''ll take this hole."'
+								gs 'arousal', 'clit_finger', 5
+								gs 'arousal', 'bj', -5
+								gs 'stat'
+
+								act 'Get fucked in the ass':
+									picrand = 89
+									gs 'bed_events', 'exit'
+									gt 'sex', 'anal'
+								end
+							end
+						end
+
+					else
+						'"Itchy hole?" he asks.'
+						'"I''m sorry dear, but I really need it, and you''ve been busy," you reply without stopping.'
+
+						if izvratH = 0:
+							husband += 1
+							husbizvradd += 1
+							'"You should have said something. Now open your mouth," he says while pulling out his cock and forcefully pushing it into your mouth.'
+							'He holds you by the hair and fucks your mouth, telling you not to stop masturbating before he tires of your mouth. "Enough of this rubber shit! I''m going to fuck you."'
+							gs 'arousal', 'vaginal_dildo', 10
+							gs 'arousal', 'bj', -10
+							gs 'stat'
+						
+							act 'Spread your legs ':
+								picrand = 89
+								gs 'bed_events', 'exit'
+								gt 'sex', 'vag'
+							end
+
+						else
+							husband += 1
+							'"You''re going to insert this stupid toy into your pussy, ass and mouth. You''ll pulverize them for as long as I like," he says while sitting down to watch.'
+							'You quickly and submissively do as you''re told.'
+							gs 'arousal', 'vaginal_dildo', 5
+							gs 'arousal', 'anal_dildo', -5
+							gs 'stat'
+
+							act 'Offer your mouth':
+								*clr & cla
+								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m24.jpg"></center>'
+								'Still using the dildo on your pussy and ass, you offer <<$husName>> your mouth. He gets up and walks over to you.'
+								'You take his flaccid penis and start sucking until his cock is finally hard and he stops you. "Now I''ll fuck your ass."'
+								gs 'arousal', 'vaginal_dildo', 5
+								gs 'arousal', 'anal_dildo', 5
+								gs 'arousal', 'bj', -10
+								gs 'stat'
+								
+								act 'Offer your ass':
+									picrand = 89
+									gs 'bed_events', 'exit'
+									gt 'sex', 'anal'
+								end
+							end
+						end
+					end
+				end
+			end
+		end
+	end
+end
+
+--- bed_events ---------------------------------

+ 42 - 0
locations/bed_get_out.qsrc

@@ -0,0 +1,42 @@
+# bed_get_out
+$sleep_loc = 'bed_get_out'
+menu_off = 1
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	minut -= 1
+	InSleep = 0
+	slept_in = 0
+	strip_here = 0
+	SleepHorny = 0
+	!! to fudge the first hour wake up sleep loss.
+
+	gs 'bed_get_out', 'mod_triggers'
+
+	xgt 'bed_get_out_events', 'start'
+end
+
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Check for: if $sleep_loc = 'bed_get_out' and $ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
+end
+
+
+if $ARGS[0] = 'end':
+	menu_off = 0
+	killvar '$sleep_loc'
+	if fullmorrout = 1:
+		if $loc = 'bedrPar':
+			gt 'vanrPar'
+		elseif $loc = 'bedr':
+			gt 'vanr'
+		end
+	end
+
+	gt $loc, $loc_arg
+end
+
+--- bed_get_out ---------------------------------

+ 134 - 0
locations/bed_get_out_events.qsrc

@@ -0,0 +1,134 @@
+# bed_get_out_events
+$sleep_loc = 'bed_get_out_events'
+menu_off = 1
+
+!! wakeup events trigger during when waking up
+!!
+!! Moved here from wakeup
+!! When done: Move to bed2
+
+	!!=====================================!!
+	!!                                     !!
+	!!          Event handlers             !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+
+	if sleepVars['events_active'] = 1:
+		sleepVars['events_done'] = 0
+		
+		if vomit['morning_sick'] = 1 or vomit['hangover'] = 1 or vomit['unlucky'] = 1:
+			$sleep_events[] = 'gt ''bed_get_out_events'', ''vomit'' '
+		end
+
+		xgt 'bed_get_out_events', 'mod_events'
+	end
+	
+	xgt 'bed_get_out_events', 'continue'
+end
+
+if $ARGS[0] = 'mod_events':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'bed_get_out_events' and $ARGS[0] = 'mod_events'
+	!!
+	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!! A random event will be chosen from amongst the added ones.
+	!! If an event MUST trigger (due to quest timing), add it tp $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!!
+	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'bed_get_out_events', 'event_end'
+	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'bed_get_out_events', 'exit'
+	!!
+	!! This is to cleanup all necessary variables.
+	!!
+	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
+	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
+
+	xgt 'bed_get_out_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'event_handler':
+	if sleepVars['events_done'] < 1:
+		if arrsize('$sleep_events_priority') > 0:
+			xgt 'bed_get_out_events', 'event_handler2', 'priority'
+		elseif arrsize('$sleep_events') > 0:
+			xgt 'bed_get_out_events', 'event_handler2'
+		end
+	end
+
+	gs 'bed_get_out_events', 'continue'
+end
+
+if $ARGS[0] = 'event_handler2':
+	sleepVars['events_done'] += 1
+
+	if $ARGS[1] = 'priority':
+		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
+		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
+		killvar '$sleep_events_priority', temp_slev_id
+	else
+		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
+		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
+		killvar '$sleep_events', temp_slev_id
+	end
+
+	killvar 'temp_slev_id'
+	dynamic $temp_sleep_event_chosen
+end
+
+
+if $ARGS[0] = 'event_end':
+	killvar '$temp_sleep_event_chosen'
+
+!!	if arrsize('$sleep_events_priority') > 0:
+!!		xgt 'bed_get_out_events', 'event_handler2', 'priority'
+!!	end
+
+	xgt 'bed_get_out_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'exit':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+end
+
+if $ARGS[0] = 'continue':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+
+	xgt 'bed_get_out', 'end'
+end
+
+
+
+
+	!!=====================================!!
+	!!                                     !!
+	!!              Events                 !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'vomit':
+	gs 'bed_get_out_events', 'exit'
+
+	gt 'home_activity', 'vomiting_exit'
+end
+
+
+
+--- bed_get_out_events ---------------------------------

+ 5 - 4
locations/bedr.qsrc

@@ -17,7 +17,8 @@ if rembedr = 0:
 	'A tight, little room with a <a href="exec:gt ''bed'', ''start''">double bed</a>.'
 	*nl
 	
-	'Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt $loc">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt $loc">ON</a>.')
+	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
+
 	*nl
 	'An old wooden <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> stands near the door to the corridor. The windows are closed with faded, heavy curtains.'
 else
@@ -25,10 +26,10 @@ else
 	*nl
 	'A bright and beautiful room, with a large, kingsized <a href="exec:gt ''bed'', ''start''">double bed</a>.'
 	*nl
-	if budilnikOn = 0:
-		'There is an <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> on the bedside table, and it is set to '+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+' and is currently turned <a href="exec: budilnikOn = 1 & gt ''<<$loc>>''">off</a>.'
+	if alarmOn = 0:
+		'There is an <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> on the bedside table, and it is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> and is currently turned <a href="exec: alarmVars[''alarmOn''] = 1 & gt ''<<$loc>>''">off</a>.'
 	else
-		'There is an <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> on the bedside table, and it is set to '+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+' and is currently turned <a href="exec: budilnikOn = 0 & gt ''<<$loc>>''">on</a>.'
+		'There is an <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> on the bedside table, and it is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> and is currently turned <a href="exec: alarmVars[''alarmOn''] = 0 & gt ''<<$loc>>''">on</a>.'
 	end
 	*nl
 	'A modern <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> stands near the door to the corridor. Against the wall stands a make-up table with a <a href="exec:gt ''mirror'', ''start''">mirror</a> on it.'

+ 1 - 1
locations/bedr2x.qsrc

@@ -22,7 +22,7 @@ if pcs_magik >= 6 and spellbefshild = 1 and tobiQW = 0:gt'tobiQW','start'
 'A bright and beautiful bedroom, with modern and stylish furniture.'
 *nl
 'The room is dominated by <a href="exec:gt ''bed'',''start''">full sized bed</a>'
-'Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt $loc">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt $loc">ON</a>.')
+'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
 *nl
 'Near the entrance stands a modern <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a>.'
 *nl

+ 2 - 2
locations/bedrPar.qsrc

@@ -136,7 +136,7 @@ if $ARGS[0] = '' or $ARGS[0] = 'start':
 		end
 
 		if $home['current'] = 'parents_home':
-			'<table><tr><td valign="top">Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt $loc">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt $loc">ON</a>.')
+			'<table><tr><td valign="top">Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
 
 			if mc_inventory['contraceptive_pill'] > 0 and mc_inventory['equipped_condoms'] + mc_inventory['normal_condoms'] + mc_inventory['sabotaged_condoms'] > 0:
 				'Your <a href="exec:gt ''stol'', ''bc''">birth control</a> is hidden in one of your desk drawers, as are your <a href="exec:gt ''stol'', ''bc''">condoms</a>.'
@@ -362,7 +362,7 @@ if $ARGS[0] = 'intro':
 						'<center><h1><font color="maroon">Your Bedroom</font></h1></center>'
 						'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/prost5.jpg"></center>'
 						'Before you can finish, she cuts you off. "I''m not going to have you running around town like so many of those other girls I see! Opening their legs for any boy that comes around..." She shakes her head in disgust. "I want a referral every month and it better tell me you''re still a virgin or else, understand?" she says before she storms out of the room without giving you a chance to respond.'
-						act 'I understand...':gt 'budilnik', 'start'
+						act 'I understand...':gt 'alarmclock', 'start'
 					end
 				end
 			end

+ 7 - 4
locations/begin.qsrc

@@ -3,10 +3,13 @@
 if $ARGS[0] = 'start':
 	$loc_arg = 'start'
 	$loc = 'begin'
-	timerEnd = 8
-	timerEndM = 0
-	timer = 6
-	timerM = 30
+	alarmVars['timerEndH'] = 8
+	alarmVars['timerEndM'] = 0
+	alarmVars['timerH'] = 6
+	alarmVars['timerM'] = 30
+	sleepVars['events_active'] = 1
+	sleepVars['dreams_active'] = 1
+
 	settingmode = 0
 	$checkimg = {
 		if $ARGS[0]=$ARGS[1]:

+ 2 - 2
locations/brothel.qsrc

@@ -283,9 +283,9 @@ if $ARGS[0] = 'abducted4':
 	InSleep = 1
 	pain['killer'] = 0
 	if mid($start_type,1,2) = 'sg' and SchoolAtestat = 0:
-		notathomesleep += 1
+		sleepQW['notathomesleep'] += 1
 	else
-		notathomesleep = 0
+		sleepQW['notathomesleep'] = 0
 	end
 	:loopson
 	minut += 1

+ 8 - 32
locations/city_sauna.qsrc

@@ -112,8 +112,8 @@ if $ARGS[0] = 'saunaroom':
 	end
 	*nl
 
-	'Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt ''city_sauna'', ''saunaroom''">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt ''city_sauna'', ''saunaroom''">ON</a>.')
-	
+	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
+
 	*nl
 
 	'If you run out of personal hygeine or beauty products, you can ask for more at a cost.'
@@ -202,52 +202,28 @@ if $ARGS[0] = 'saunaroom':
 		else
 			$sleep_txt = 'Undress and go to sleep'
 		end
+
 		if succubusQW = 2:
 			act '<<$sleep_txt>>':
-				$lastwornclothingtype['bed'] = $clothingworntype
-				lastwornclothingnumber['bed'] = clothingwornnumber
-				$lastwornpantytype['bed'] = $pantyworntype
-				lastwornpantynumber['bed'] = pantywornnumber
-				$lastwornbratype['bed'] = $braworntype
-				lastwornbranumber['bed'] = brawornnumber
-				if $clothingworntype ! 'nude': gs 'clothing', 'strip'
-				gt 'sleep', 'succhoice'
+				gt 'pre_sleep_events', 'start'
 			end
+
 		else
 			if workDolg > 0 or money >= 850:
 				act '<<$sleep_txt>>':
-					$lastwornclothingtype['bed'] = $clothingworntype
-					lastwornclothingnumber['bed'] = clothingwornnumber
-					$lastwornpantytype['bed'] = $pantyworntype
-					lastwornpantynumber['bed'] = pantywornnumber
-					$lastwornbratype['bed'] = $braworntype
-					lastwornbranumber['bed'] = brawornnumber
 					if workDolg > 0:
 						workDolg += 850
 					elseif workDolg <= 0:
 						money -= 850
 					end
-					if disable_autosave = 0:
-						if mid($start_type,1,4) = 'city':
-							savegame 'autosave_city.sav'
-						elseif mid($start_type,1,3) = 'uni':
-							savegame 'autosave_uni.sav'
-						else
-							savegame 'autosave_sg.sav'
-						end
-					end
-					if $clothingworntype ! 'nude': gs 'clothing', 'strip'
-					if magf2bdo = 2:
-						gt 'sleep', 'magbstchoice'
-					else
-						gt 'sleep', 'sleep'
-					end
+					gt 'pre_sleep_events', 'start'
 				end
-				killvar '$sleep_txt'
 			else
 				'<br>You don''t have enough money to sleep here tonight.'
 			end
 		end
+
+		killvar '$sleep_txt'
 	end
 end
 

+ 340 - 174
locations/dreams.qsrc → locations/dream_events.qsrc

@@ -1,95 +1,306 @@
-# dreams
-
+# dream_events
+$sleep_loc = 'dream_events'
 menu_off = 1
 
-if $ARGS[0] = 'start':
-	if stepdadqw = 3:
-		'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/vladimir/sex/bath_voyer_1.jpg"></center>'
-		'You had a very strange dream: You were blindfolded while having sex with a stranger. When you were done, you removed the blindfold to see your stepfather grinning at you.'
-		pcs_horny = 100
-		stepdadqw += 1
-	elseif canBraidHair = 0 and mid($start_type,1,2) ! 'sg' and pcs_hairlng > 80:
-		canBraidHair = 1
-		'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/anya/braid.jpg"></center>'
-		'You dream about the time your sister taught you how to braid your hair. It was one of the more memorable sister bonding moments the two of you had not long before you moved out.'
-	elseif succubusQW = 1 or succubusQW = 2:
-		!this is for initial dream and a reoccuring dream if the feeling was ignored
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/succubdream.jpg"></center>'
-		if succubusQW = 1:
-			'You dream of sex with multiple partners, absorbing energy from each of them.'
-		else
-			'You have the same dream of absorbing energy from multiple partners.'
+!! Dream events trigger after deciding to go to sleep, but before any time has advanced.
+!! Note that dreams are supposed to stick on the screen during the sleep cycle. So only use xgt and gs!!
+!!
+!! Moved here from pre_sleep
+!! When done: Move to sleep
+
+	!!=====================================!!
+	!!                                     !!
+	!!          Event handlers             !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+
+	if sleepVars['dreams_active'] = 1:
+		sleepVars['events_done'] = 0
+
+		if stepdadQW = 3:
+			$sleep_events_priority[] = 'gs ''dream_events'', ''stepdad_dream'' '
 		end
-		succubusQW = 2
-		pcs_horny = 100
-	elseif rand(1,100) > Enable_nodream:
-		!nodream chance cheat
-		if hypnoTime > rand(0,3):
-			haveHypnoDream = 1
-		else
-		haveHypnoDream = 0
+		if canBraidHair = 0 and mid($start_type, 1, 2) ! 'sg' and pcs_hairlng > 80:
+			$sleep_events_priority[] = 'gs ''dream_events'', ''braid_hair_dream'' '
+		end
+		if succubusQW = 1 or succubusQW = 2:
+			!this is for initial dream and a reoccuring dream if the feeling was ignored
+			$sleep_events_priority[] = 'gs ''dream_events'', ''succubus_dream'' '
 		end
-		if pcs_horny > 50:
-			!erotic dream
-			if pcs_vag = 0 and stat['think_virgin'] = 1 and pcs_ass = 0 and stat['anal'] = 0 and stat['bj'] = 0 and stat['hj'] = 0 and stat['cuni'] = 0 and girl = 0 and guy = 0:
-				!dreams only for virgin
-				ivrand = rand(1,5)
-			elseif haveHypnoDream = 1:
+
+		if rand(1, 100) <= sleepVars['cheat_nodream_chance']:
+			!nodream chance cheat
+			$sleep_events[] = 'gs ''dream_events'', ''no_dream'' '
+		else
+			if pcs_horny <= 50:
+				$sleep_events[] = 'gs ''dream_events'', ''d_dreams_switch'' '
+			elseif rand(0, 3) < hypnoTime:
 				!dreams for hypnotized girls
-				gs 'dreams', 'hypno_dreams'
-			elseif succubusflag = 1:
-				ivsuctmp = 6 + succublvl
-				ivrand = rand(1,ivsuctmp)
+				$sleep_events[] = 'gs ''dreams_events'', ''hypno_dreams_switch'' '
 			else
-				ivrand = rand(1,6)
-			end
-			if haveHypnoDream = 0:
-				if ivrand = 1:
-					gs 'dreams','d_dreams'
-				elseif ivrand = 2:
-					gs 'dreams','ero_dreams'
-				elseif ivrand = 3:
-					gs 'dreams','sex_dreams'
-				elseif ivrand = 4:
-					gs 'dreams','bj_dreams'
-				elseif ivrand = 5:
-					gs 'dreams','anal_dreams'
-				elseif ivrand = 6:
-					gs 'dreams','gang_dreams'
-				elseif ivrand >= 7 and ivrand <= ivsuctmp:
-					gs 'dreams','succub_dreams'
-				end
+				!erotic dream
+				$sleep_events[] = 'gs ''dreams_events'', ''erotic_dreams_switch'' '
 			end
-		else
-			gs 'dreams','d_dreams'
 		end
+
+		gt 'dream_events', 'mod_events'
+	end
+
+	xgt 'dream_events', 'continue'
+end
+
+if $ARGS[0] = 'mod_events':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'dream_events' and $ARGS[0] = 'mod_events'
+	!!
+	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!! A random event will be chosen from amongst the added ones.
+	!! If an event MUST trigger (due to quest timing), add it tp $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!!
+	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'dream_events', 'event_end'
+	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'dream_events', 'exit'
+	!!
+	!! This is to cleanup all necessary variables.
+	!!
+	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
+	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
+
+	gt 'dream_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'event_handler':
+	if sleepVars['events_done'] < 1:
+		if arrsize('$sleep_events_priority') > 0:
+			xgt 'dream_events', 'event_handler2', 'priority'
+		elseif arrsize('$sleep_events') > 0:
+			xgt 'dream_events', 'event_handler2'
+		end
+	end
+
+	xgt 'dream_events', 'continue'
+end
+
+if $ARGS[0] = 'event_handler2':
+	sleepVars['events_done'] += 1
+
+	if $ARGS[1] = 'priority':
+		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
+		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
+		killvar '$sleep_events_priority', temp_slev_id
 	else
-		if $start_type[1] = 'tg':
-			temp = rand(1,10)
-			if temp = 1:
-				'You have hazy dreams about your past.'
-			elseif temp = 2:
-				'You dream about the moon looking at the world with his one bloody eye.'
-			elseif temp = 3:
-				'You dream that you are a man again.'
-			else
-				'You sleep without dreaming.'
-			end
+		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
+		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
+		killvar '$sleep_events', temp_slev_id
+	end
+
+	killvar 'temp_slev_id'
+	dynamic $temp_sleep_event_chosen
+end
+
+
+if $ARGS[0] = 'event_end':
+	killvar '$temp_sleep_event_chosen'
+
+!!	if arrsize('$sleep_events_priority') > 0:
+!!		gt 'bed_events', 'event_handler2', 'priority'
+!!	end
+
+	xgt 'dream_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'exit':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+end
+
+if $ARGS[0] = 'continue':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+
+	xgt 'sleep', 'start'
+end
+
+
+
+
+	!!=====================================!!
+	!!                                     !!
+	!!              Events                 !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'stepdad_dream':
+	'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/vladimir/sex/bath_voyer_1.jpg"></center>'
+	'You had a very strange dream: You were blindfolded while having sex with a stranger. When you were done, you removed the blindfold to see your stepfather grinning at you.'
+	pcs_horny = 100
+	stepdadQW += 1
+	gs 'dream_events', 'event_end'
+end
+
+if $ARGS[0] = 'braid_hair_dream':
+	canBraidHair = 1
+	'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/anya/braid.jpg"></center>'
+	'You dream about the time your sister taught you how to braid your hair. It was one of the more memorable sister bonding moments the two of you had not long before you moved out.'
+	gs 'dream_events', 'event_end'
+end
+
+if $ARGS[0] = 'succubus_dream':
+	'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/succubdream.jpg"></center>'
+	if succubusQW = 1:
+		'You dream of sex with multiple partners, absorbing energy from each of them.'
+	else
+		'You have the same dream of absorbing energy from multiple partners.'
+	end
+	succubusQW = 2
+	pcs_horny = 100
+	gs 'dream_events', 'event_end'
+end
+
+
+if $ARGS[0] = 'no_dream':
+	if $start_type[1] = 'tg':
+		temp = rand(1,10)
+		if temp = 1:
+			'You have hazy dreams about your past.'
+		elseif temp = 2:
+			'You dream about the moon looking at the world with his one bloody eye.'
+		elseif temp = 3:
+			'You dream that you are a man again.'
 		else
 			'You sleep without dreaming.'
-		end   
+		end
+	else
+		'You sleep without dreaming.'
 	end
-	exit
+	gs 'dream_events', 'event_end'
 end
 
-if $ARGS[0] = 'hypno_dreams':
+
+
+!!----------------------------Erotic Dreams----------------------------------------------------------------!!
+
+if $ARGS[0] = 'erotic_dream_switch':
+	if pcs_horny <= 50:
+		gs 'dream_events', 'd_dreams_switch'
+
+	elseif rand(0, 3) < hypnoTime:
+		!dreams for hypnotized girls
+		gs 'dreams_events', 'hypno_dreams_switch'
+
+	else
+		!erotic dream
+		if pcs_vag = 0 and stat['think_virgin'] = 1 and pcs_ass = 0 and stat['anal'] = 0 and stat['bj'] = 0 and stat['hj'] = 0 and stat['cuni'] = 0 and girl = 0 and guy = 0:
+			!dreams only for virgin
+			ivrand = rand(1, 5)
+
+		else
+			ivrand = rand(1, 6 + succublvl)
+		end
+
+		if ivrand = 1:
+			gs 'dreams_events', 'd_dreams_switch'
+		elseif ivrand = 2:
+			gs 'dreams_events', 'ero_dreams'
+		elseif ivrand = 3:
+			gs 'dreams_events', 'sex_dreams'
+		elseif ivrand = 4:
+			gs 'dreams_events', 'bj_dreams'
+		elseif ivrand = 5:
+			gs 'dreams_events', 'anal_dreams'
+		elseif ivrand = 6:
+			gs 'dreams_events', 'gang_dreams'
+		else
+			gs 'dreams_events', 'succub_dreams'
+		end
+
+		killvar 'ivrand'
+	end
+	gs 'dream_events', 'event_end'
+end
+
+
+if $ARGS[0] = 'd_dreams_switch':
+	!! Roll between 1 and 12 if ClownQW = 0 and between 1 and 13 if clownQW = 1.
+	if clownQW = 1:
+		gs 'dream_events', 'd_dreams', rand(1, 13)
+	else
+		gs 'dream_events', 'd_dreams', rand(1, 12)
+	end
+	gs 'dream_events', 'event_end'
+end
+
+if $ARGS[0] = 'hypno_dreams_switch':
 	if therapistFuckedPussyStage < 1:
-		ivrand = rand(1,2)
+		gs 'hypno_dreams', rand(1, 2)
 	else
-		ivrand = rand(1,7)
+		gs 'hypno_dreams', rand(1, 7)
 	end
-	
-	if ivrand = 1:
+	gs 'dream_events', 'event_end'
+end
+
+if $ARGS[0] = 'd_dreams':
+	!random dreams about nothing
+	if $ARGS[1] = 1:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream1.jpg"></center>'
+		'You dream about an old town, standing on the opposite shores of high falls. Between its steeples fly strange creatures.'
+	elseif $ARGS[1] = 2:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream2.jpg"></center>'
+		'You dream about a tower, standing on frozen rocks, covered in snow and ice.'
+	elseif $ARGS[1] = 3:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream3.jpg"></center>'
+		'You dream about an ice mountain, on top of which stands a strange building, almost like a monastery.'
+	elseif $ARGS[1] = 4:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream4.jpg"></center>'
+		'You dream about an unknown girl, running in the pouring rain on a dark and narrow street.'
+	elseif $ARGS[1] = 5:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream5.jpg"></center>'
+		'You dream about your smiling mother standing in a room full of old things from the past. Strange. What could it mean?'
+	elseif $ARGS[1] = 6:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream6.jpg"></center>'
+		'You dream about a rider, standing by the lake, surrounded by high and steep mountains.'
+	elseif $ARGS[1] = 7:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream7.jpg"></center>'
+		'You dream about a scary man with charred skin, holding a strange creature on a chain, ready to fight a white haired middle-aged guy with a sword in his hand. It''s probably time to stop watching TV before bed...'
+	elseif $ARGS[1] = 8:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream8.jpg"></center>'
+		'You dream about the white-haired guy again, but he''s noticeably aged and has a thick beard. Next to him stands a beautiful white haired girl. Maybe it''s his daughter?'
+	elseif $ARGS[1] = 9:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream9.jpg"></center>'
+		'You dream about standing in a street among other people, looking at a nuclear explosion. It''s really scary!'
+	elseif $ARGS[1] = 10:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream10.jpg"></center>'
+		'You dream about a futuristic looking street littered with garbage.'
+	elseif $ARGS[1] = 11:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream11.jpg"></center>'
+		'You dream about a beautiful and majestic cathedral on the banks of the river.'
+	elseif $ARGS[1] = 12:
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream12.jpg"></center>'
+		'You dream about being at a lake in the winter watching a dark figure. He''s standing in a pavilion in the middle of the lake, the pale light of the moon giving the scene an eerie aura.'
+	else
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream13.jpg"></center>'
+		'You had a nightmare about a scary clown that tries to lure you into the sewers.'
+	end
+end
+
+if $ARGS[0] = 'hypno_dreams':
+	if ARGS[1] = 1:
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/schoolSitBlow2.mp4"></video></center>'
 		'You dream that you''re sucking someone''s cock.'
 		if guy = 0:
@@ -97,7 +308,7 @@ if $ARGS[0] = 'hypno_dreams':
 		else
 			'It almost feel real, like you''re actually sucking cock, and it feels good! However, you can''t will yourself to look up and see whose dick you''re sucking.'
 		end
-	elseif ivrand = 2:
+	elseif ARGS[1] = 2:
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/throatFuck1.mp4"></video></center>'
 		'You dream that your throat is being fucked hard and deep. It hurts and you can''t breathe, but you just sit still and allow yourself to be used. The man''s balls rythmically slap against your face as he buries his cock into your throat.'
 		if guy = 0:
@@ -105,7 +316,7 @@ if $ARGS[0] = 'hypno_dreams':
 		else
 			'It almost feels real, like you actually have a huge cock down your throat! Your throat hurts, but for some reason you feel like you''re on the edge of an orgasm. You can''t tell who''s fucking you though.'
 		end
-	elseif ivrand = 3:
+	elseif ARGS[1] = 3:
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/hypnoAnalPiledriver1.mp4"></video></center>'
 		'You dream that you''re being fucked hard in your ass. Your legs are pulled up over your head and you''re desperately stimulating your clit.'
 		if guy = 0:
@@ -113,7 +324,7 @@ if $ARGS[0] = 'hypno_dreams':
 		else
 			'It almost feels real, like you''re actually getting your ass rammed full of cock. It feels great, but you can''t tell who''s fucking you.'
 		end
-	elseif ivrand = 4:
+	elseif ARGS[1] = 4:
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/hypnoRide4.mp4"></video></center>'
 		
 		if dreamedOfTherapistFucking = 2:
@@ -126,7 +337,7 @@ if $ARGS[0] = 'hypno_dreams':
 				'It almost feels real, like you''re actually riding someone''s huge cock! You can''t will yourself to turn and look at who you''re riding though.'
 			end
 		end
-	elseif ivrand = 5:
+	elseif ARGS[1] = 5:
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/hypnoFuckCouchKneel1.mp4"></video></center>'
 		if dreamedOfTherapistFucking = 2:
 			'You dream that you''re being fucked hard from behind by your therapist.'
@@ -139,7 +350,7 @@ if $ARGS[0] = 'hypno_dreams':
 				'It almost feels real, like you''re actually getting your pussy rammed full of cock and it feels great! You can''t tell who''s fucking you and you can''t will yourself to look behind you.'
 			end
 		end
-	elseif ivrand = 6:
+	elseif ARGS[1] = 6:
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/schoolDoggy3.mp4"></video></center>'
 		if dreamedOfTherapistFucking = 2:
 			'You dream that you are being fucked hard from behind by your therapist as your hands are being held behind your back.'
@@ -152,12 +363,12 @@ if $ARGS[0] = 'hypno_dreams':
 				'It almost feels real, like your actually getting your pussy rammed full of cock and it feels great! You can''t tell who''s fucking you and you can''t will yourself to look behind you.'
 			end
 		end
-	elseif ivrand = 7:
+	else
 		'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/sex/schoolFuckCouchBack1.mp4"></video></center>'
-		if dreamedOfTherapistFucking <= 0:dreamedOfTherapistFucking = 1
 		if dreamedOfTherapistFucking = 2:
 			'You dream that you''re being fucked hard in the pussy by your therapist. You spread your legs as wide as you can so his cock can go as deep as possible. It feels amazing.'
 		else
+			if dreamedOfTherapistFucking <= 0: dreamedOfTherapistFucking = 1
 			'You dream that you''re being fucked hard in the pussy. You''re spreading and holding your legs as wide as possible so their cock goes as deep as possible.'
 			if guy = 0:
 				'You''ve never had sex before, but it feels amazing! You try to focus and realize... your therapist is fucking you?'
@@ -166,7 +377,9 @@ if $ARGS[0] = 'hypno_dreams':
 			end
 		end
 	end
-	''
+
+	*nl
+
 	if guy = 0:
 		'You wake up feeling strange and excited. Even though you''ve never had sex, the dream felt very real.'
 	elseif pcs_vag > 0 and stat['vaginal'] = 0:
@@ -181,55 +394,6 @@ if $ARGS[0] = 'hypno_dreams':
 	end
 end
 
-if $ARGS[0] = 'd_dreams':
-	!random dreams about nothing
-	if ClownQW = 1:
-		ivrand = rand(1,13)
-	else
-		ivrand = rand(1,12)
-	end
-	if ivrand = 1:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream1.jpg"></center>'
-		'You dream about an old town, standing on the opposite shores of high falls. Between its steeples fly strange creatures.'
-	elseif ivrand = 2:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream2.jpg"></center>'
-		'You dream about a tower, standing on frozen rocks, covered in snow and ice.'
-	elseif ivrand = 3:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream3.jpg"></center>'
-		'You dream about an ice mountain, on top of which stands a strange building, almost like a monastery.'
-	elseif ivrand = 4:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream4.jpg"></center>'
-		'You dream about an unknown girl, running in the pouring rain on a dark and narrow street.'
-	elseif ivrand = 5:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream5.jpg"></center>'
-		'You dream about your smiling mother standing in a room full of old things from the past. Strange. What could it mean?'
-	elseif ivrand = 6:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream6.jpg"></center>'
-		'You dream about a rider, standing by the lake, surrounded by high and steep mountains.'
-	elseif ivrand = 7:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream7.jpg"></center>'
-		'You dream about a scary man with charred skin, holding a strange creature on a chain, ready to fight a white haired middle-aged guy with a sword in his hand. It''s probably time to stop watching TV before bed...'
-	elseif ivrand = 8:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream8.jpg"></center>'
-		'You dream about the white-haired guy again, but he''s noticeably aged and has a thick beard. Next to him stands a beautiful white haired girl. Maybe it''s his daughter?'
-	elseif ivrand = 9:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream9.jpg"></center>'
-		'You dream about standing in a street among other people, looking at a nuclear explosion. It''s really scary!'
-	elseif ivrand = 10:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream10.jpg"></center>'
-		'You dream about a futuristic looking street littered with garbage.'
-	elseif ivrand = 11:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream11.jpg"></center>'
-		'You dream about a beautiful and majestic cathedral on the banks of the river.'
-	elseif ivrand = 12:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream12.jpg"></center>'
-		'You dream about being at a lake in the winter watching a dark figure. He''s standing in a pavilion in the middle of the lake, the pale light of the moon giving the scene an eerie aura.'
-	elseif ivrand = 13:
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/dream13.jpg"></center>'
-		'You had a nightmare about a scary clown that tries to lure you into the sewers.'
-	end
-	exit
-end
 
 if $ARGS[0] = 'sex_dreams':
 	!only vaginal sex
@@ -251,6 +415,8 @@ if $ARGS[0] = 'sex_dreams':
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/sex5.jpg"></center>'
 		'You dream that you''re sitting on top of a guy, bouncing up and down on his cock.'
 	end
+	killvar 'ivrand'
+
 	if stat['think_virgin'] = 1:
 		'You wake up feeling strange and excited. Even though you''ve never had sex, the dream felt very real.'
 	elseif pcs_vag > 0 and stat['vaginal'] = 0:
@@ -258,19 +424,18 @@ if $ARGS[0] = 'sex_dreams':
 	else
 		'It seems your <<$vaginatipe>> pussy urgently needs some attention.'
 	end
-	exit
 end
 
 if $ARGS[0] = 'anal_dreams':
 	!only anal sex
-	ivrand = rand(1,2)
-	if ivrand = 1:
+	if rand(0, 1) = 0:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/anal1.jpg"></center>'
 		'You dream that you''re bent over as a man rhythmically pumps your ass with his cock while you caress your clit.'
-	elseif ivrand = 2:
+	else
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/anal2.jpg"></center>'
 		'You dream that you''re laying on your side as a guy fucks your ass. You moan loudly from the sensation.'
 	end
+	
 	if stat['anal'] = 0 and pcs_ass = 0:
 		'You wake up feeling strange and excited. Even though you''ve never had anal sex, the dream felt very real.'
 	elseif stat['anal'] = 0:
@@ -278,30 +443,28 @@ if $ARGS[0] = 'anal_dreams':
 	else
 		'It seems your <<$anustipe>> anus urgently needs some attention.'
 	end
-	exit
 end
 
 if $ARGS[0] = 'bj_dreams':
 	!only Blowjob
-	ivrand = rand(1,2)
-	if ivrand = 1:
+	if rand(0, 1) = 0:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/bj1.jpg"></center>'
 		'You dream about sucking a guy''s dick during sunset near the ocean.'
-	elseif ivrand = 2:
+	else
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/bj2.jpg"></center>'
 		'You have a dream where you''re tied to a staircase, squatting down with your legs wide open sucking and savouring the dick of a guy dressed in an expensive looking suit.'
 	end
+
 	if stat['bj'] = 0:
 		'You''ve never given anyone a blowjob before, but the feeling of the dick in your mouth felt very real. The dream has excited you a little.'
 	else
 		'It seems you subconsciously want to suck a dick...'
 	end
-	exit
 end
 
 if $ARGS[0] = 'ero_dreams':
 	!only erotica
-	ivrand = rand(1,5)
+	ivrand = rand(1, 5)
 	if ivrand = 1:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/ero1.jpg"></center>'
 		'You dream that you''re at a school where all the girls are required to attend lessons naked.'
@@ -318,45 +481,50 @@ if $ARGS[0] = 'ero_dreams':
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/ero5.jpg"></center>'
 		'You dream that you''re naked while making out with a stranger.'
 	end
-	exit
+	killvar 'ivrand'
 end
 
 if $ARGS[0] = 'gang_dreams':
 	!only Gangbang
-	ivrand = rand(1,2)
-	if ivrand = 1:
+	if rand(0, 1) = 0:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/gang1.jpg"></center>'
 		'You dream about two men fucking you. You''re lying between them sucking one of them while the other is fucking your ass.'
-	elseif ivrand = 2:
+	else
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sex/gang2.jpg"></center>'
 		'You dream that you''re in-between two hot guys as one fucks your pussy and the other fucks your ass. Both of them fuck you with force, causing you to moan loudly with pleasure.'
 	end
-	if stat['think_virgin'] = 1 and pcs_ass = 0 and stat['anal'] = 0 and stat['bj'] = 0 and stat['hj'] = 0 and gang = 0 and guy = 0 and girl = 0:
-		'You haven''t even had normal sex, least of all a threesome. Even though you''re excited, the dream still scared you a little.'
-	elseif stat['vaginal'] > 0 and pcs_ass = 0 and stat['anal'] = 0 and stat['bj'] = 0 and stat['hj'] = 0 and gang = 0:
-		'Even though you''ve had sex, the thought of a gangbang, even in a dream, is a little alarming.'
-	elseif pcs_vag = 0 and stat['vaginal'] = 0 and pcs_ass > 0 and gang = 0 and guy > 0 and girl = 0:
-		'Even though you''re technically still a virgin, the thought of a gangbang, even in a dream, is a little alarming.'
-	elseif pcs_ass = 0 and stat['anal'] = 0 and gang = 0 and guy > 0 and girl = 0:
-		'It seems that, in your dreams, one guy at a time is not enough...'
-	elseif gang > 0 and guy > 0 and girl = 0:
-		'It seems that your experience with swinging with a few guys was not in vain and your subconscious is actively reminding you about it.'
-	elseif gang > 0 and guy = 0 and girl > 0:
-		'It seems that your experience with swinging with several girls was not in vain and your subconscious is actively reminding you about it.'
-	elseif gang > 0 and guy > 0 and girl > 0:
-		'It seems that your experience with swinging was not in vain and your subconscious is actively reminding you about it.'
+
+	if gang = 0:
+		if stat['think_virgin'] = 1 and pcs_ass = 0 and stat['anal'] = 0 and stat['bj'] = 0 and stat['hj'] = 0 and guy = 0 and girl = 0:
+			'You haven''t even had normal sex, least of all a threesome. Even though you''re excited, the dream still scared you a little.'
+		elseif stat['vaginal'] > 0 and pcs_ass = 0 and stat['anal'] = 0 and stat['bj'] = 0 and stat['hj'] = 0:
+			'Even though you''ve had sex, the thought of a gangbang, even in a dream, is a little alarming.'
+		elseif pcs_vag = 0 and stat['vaginal'] = 0 and pcs_ass > 0 and guy > 0 and girl = 0:
+			'Even though you''re technically still a virgin, the thought of a gangbang, even in a dream, is a little alarming.'
+		elseif pcs_ass = 0 and stat['anal'] = 0 and guy > 0 and girl = 0:
+			'It seems that, in your dreams, one guy at a time is not enough...'
+		else
+			'The dream felt very real and left you feeling a little excited.'
+		end
 	else
-		'The dream felt very real and left you feeling a little excited.'
+		if guy > 0 and girl = 0:
+			'It seems that your experience with swinging with a few guys was not in vain and your subconscious is actively reminding you about it.'
+		elseif guy = 0 and girl > 0:
+			'It seems that your experience with swinging with several girls was not in vain and your subconscious is actively reminding you about it.'
+		elseif guy > 0 and girl > 0:
+			'It seems that your experience with swinging was not in vain and your subconscious is actively reminding you about it.'
+		else
+			'The dream felt very real and left you feeling a little excited.'
+		end
 	end
-	exit
 end
 
 if $ARGS[0] = 'succub_dreams':
 !!Succubus dreams
 	if sucpcinfo < 4:
-		ivrand = rand(1,5)
+		ivrand = rand(1, 5)
 	else
-		ivrand = rand (2,5)
+		ivrand = rand (2, 5)
 	end
 
 	if ivrand = 1:
@@ -367,12 +535,10 @@ if $ARGS[0] = 'succub_dreams':
 		else
 			'and that you have become something inhuman!'
 		end
-	end
-	if ivrand = 2:
+	elseif ivrand = 2:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sucrandream2.jpg"></center>'
 		'You dream that you were victorious over Toby and the entire Order of Dawn.'
-	end
-	if ivrand = 3:
+	elseif ivrand = 3:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sucrandream3.jpg"></center>'
 		if succublvl < 3:
 			$sucselftmp = 'a personification of <<$sucself1>> in your core'
@@ -381,13 +547,11 @@ if $ARGS[0] = 'succub_dreams':
 		end
 		'You dream that you''re arguing with <<$sucselftmp>>.'
 		'You don''t know what it''s about, but you think you won...'
-	end
-	if ivrand = 4:
+	elseif ivrand = 4:
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sucrandream4.jpg"></center>'
 		'You dream that you''re walking through a crowded convention hall filled with people in costumes.'
 		'You don''t know why you''re here until you see <i>her</i>, then you just <b>know</b>. You''re here for <b>reproduction</b>!'
-	end
-	if ivrand = 5:
+	else
 		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/dream/sucrandream5.jpg"></center>'
 		'You dream about an encounter with another succubus on <i>your</i> territory!'
 		if succhungry < (0 - 1 - succublvl):
@@ -396,8 +560,10 @@ if $ARGS[0] = 'succub_dreams':
 			'You can''t allow that!'
 		end
 	end
-	exit
+	killvar 'ivrand'
 end
 
---- dreams ---------------------------------
 
+
+
+--- dream_events ---------------------------------

+ 1 - 1
locations/gadhouse.qsrc

@@ -1747,7 +1747,7 @@ if $ARGS[0] = 'intro':
 						'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/prost5.jpg"></center>'
 						*nl
 						'Before you can finish, she cuts you off. "I''m not going to have you running around town like so many of those other girls I see! Opening their legs for any boy that comes around..." She shakes her head in disgust. "I want a referral every month and it better tell me you''re still a virgin or else, understand?" <<$npc_nickname[''A29'']>> says as she storms off towards your grandparent''s outside door. "Don''t forget to talk to your grandparents and ask if they need help!" she shouts. Then, without waiting for your response, she closes the door, and with that, she''s gone.'
-						act 'I understand...':gt 'budilnik', 'start'
+						act 'I understand...':gt 'alarmclock', 'start'
 					end
 				end
 			end

+ 8 - 8
locations/home_activity.qsrc

@@ -237,7 +237,7 @@ if $ARGS[0] = 'think_preg_react':
 		'You don''t like the frequency with which this is happening. More and more, the evidence is pointing towards you being pregnant.'
 		*nl
 		'<i>What am I going to do?</i> you think to yourself.'
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 
 	act'I better not be pregnant':
@@ -246,7 +246,7 @@ if $ARGS[0] = 'think_preg_react':
 		'Disgust and irritation fill you as you reach out to flush the toilet.'
 		*nl
 		'<i>Oh God,</i> you groan internally. <i>I swear, this better be a stomach bug and not pregnancy. I am not ready for motherhood.</i>'
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 
 	act'I can''t wait for this baby':
@@ -255,7 +255,7 @@ if $ARGS[0] = 'think_preg_react':
 		'Even through the pain and the horrid taste on your lips, you can''t help but smile.'
 		*nl
 		'<i>I''m so ready for this baby!</i> you think excitedly.'
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 
 	act'Baby good, morning sickness bad':
@@ -264,7 +264,7 @@ if $ARGS[0] = 'think_preg_react':
 		'You clutch your head, wincing at the sharp pain that lances through it.'
 		*nl
 		'<i>This baby can not come sooner,</i> you think to yourself. <i>Really looking forward to watching it grow, but <b>really</b> hate this pregnancy stuff.</i>'
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 end
 
@@ -273,14 +273,14 @@ if $ARGS[0] = 'preg_scare_react':
 		cla & *clr
 		$home_activity['vomit_bathroom']
 		'<i>I need to take a pregnancy test right now!</i> you think urgently. <i>I need to figure out what is going on!</i>'
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 
 	act'This is really bad':
 		cla & *clr
 		$home_activity['vomit_bathroom']
 		'<i>This is really really bad!</i> you think, the blood draining from your face. <i>I don''t want to be a mom! Not now!</i>'
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 
 	act'This is wonderful!':
@@ -291,7 +291,7 @@ if $ARGS[0] = 'preg_scare_react':
 		else
 			'<i>I''m going to have another baby!</i> you think, smiling to yourself. <i>This is wonderful!</i>'
 		end
-		act'Continue':gt'sleep','end'
+		act'Continue': gt 'bed_get_out', 'start'
 	end
 
 	if stat['think_virgin'] = 1:
@@ -299,7 +299,7 @@ if $ARGS[0] = 'preg_scare_react':
 			cla & *clr
 			$home_activity['vomit_bathroom']
 			'<i>This doesn''t make any sense,</i> you think to yourself, putting your hand on your head, feeling woozy again.'
-			act'Continue':gt'sleep', 'end'
+			act'Continue': gt 'bed_get_out', 'start'
 		end
 	end
 end

+ 2 - 2
locations/korrPar.qsrc

@@ -449,8 +449,8 @@ elseif motherWorry = 1 and locat['Fam_inGad'] > 0:
 	motherWorry = 0
 end
 
-if notathomesleep > 7 and hour >= 16 and hour < 21 and locat['Mom_athome'] = 1:
-	notathomesleep = 0
+if sleepQW['notathomesleep'] > 7 and hour >= 16 and hour < 21 and locat['Mom_athome'] = 1:
+	sleepQW['notathomesleep'] = 0
 	*clr & cla
 	*pl $korrParMomHeader
 	if npc_rel['A29'] < 40:

+ 2 - 2
locations/marisha_ev.qsrc

@@ -161,7 +161,7 @@ if $ARGS[0] = 'Mall':
 				$loc_arg = 'start'
 				MarishaQW["marisha_sleepover"] = 1
 				gs 'stat'
-				gt 'sleep', 'sleep'
+				gt 'sleep_simple', 'simple'
 			end
 		end
 
@@ -178,7 +178,7 @@ if $ARGS[0] = 'Mall':
 				$loc_arg = 'start'
 				MarishaQW["marisha_sleepover"] = 1
 				gs 'stat'
-				gt 'sleep', 'sleep'
+				gt 'pre_sleep', 'prepare_sleep'
 			end
 		end
 	end

+ 1 - 1
locations/mey_home.qsrc

@@ -229,7 +229,7 @@ if $ARGS[0] = 'guest_bedroom':
 	'It feels and looks like a standard room in a hotel.'
 	'There is a <a href="exec:gt ''bed'', ''start''">bed</a>, a small <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> (where you can choose outfits and organize your clothing), and a <a href="exec:gt ''stol'' ,''stolPar''">desk</a>.'
 	*nl
-	'Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt $loc, $loc_arg">ON</a>.')
+	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
 	*nl
 	'A <a href="exec:gt ''mirror'', ''start''">mirror</a> hangs on the wall near the front door.'
 	if $ml_guitar['location'] = $loc: 'Your guitar rests on its stand next to your bed.'

+ 71 - 57
locations/mother_sextalk.qsrc

@@ -393,18 +393,23 @@ if $ARGS[0] = 'bathroom_dildos5':
 	act'Continue':gt $loc, $loc_arg
 end
 
+
+
+!! Changes made to leave actions in accordance to the new sleep stuff.
+!! Blame Anjuna
 if $ARGS[0] = 'dildo_wakeup1':
 	motherQW['dildo_wakeup'] = 1
 	InSleep = 0
-	gs'stat'
+	gs 'stat'
 !!	if motherKnowSpravka > 0 or motherKnowWhore > 0:gt'mother_sextalk','dildo_wakeup4'
 	if motherQW['dildo_caught'] = 0:
 		motherQW['dildo_caught'] += 1
 	elseif motherQW['dildo_caught'] = 1:
-		gt'mother_sextalk','dildo_wakeup2'
+		gt 'mother_sextalk', 'dildo_wakeup2'
 	elseif motherQW['dildo_caught'] >= 2 and motherKnowDildo = 1:
-		gt'mother_sextalk','dildo_wakeup3'
+		gt 'mother_sextalk', 'dildo_wakeup3'
 	end
+
 	'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 	if motherQW['bathroom_dildos'] = 1:
 		'"<<$pcs_firstname>> what the hell is this?!"'
@@ -417,17 +422,17 @@ if $ARGS[0] = 'dildo_wakeup1':
 	end
 	motherQW['bathroom_dildos'] = 0
 	
-	act'Shamelessly lie your ass off':
+	act 'Shamelessly lie your ass off':
 		cla & *clr
 		'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 		'"What''re you talkin'' about...?" you say blearily, feigning being drowsy from just having woken up. It''s an obvious lie, made even more obvious by the fact that your face turns bright red when you say it. "Is that a dildo? I-"'
 		'"Don''t you lie to me <<$pcs_firstname>>, <i>I am your mother.</i> And I know it''s yours. Anya isn''t stupid enough to bring home another one of these after the last time I caught her with one, let alone stupid enough to leave it in the bathroom where Kolka or Vladimir could find it! What were you thinking?! You''ll ruin your brother''s innocence behaving like this, give your father a heart attack too! And you''ll ruin yourself for marriage if you- She cuts off suddenly with a horrified look on her face.'
 		'"My God... you haven''t..."'
 		'You can see where this is going and you don''t like it.'
-		gs'mother_sextalk','bathroom_dildo_response_single'
+		gs 'mother_sextalk', 'bathroom_dildo_response_single'
 	end
 	
-	act'Blame it on Anya':
+	act 'Blame it on Anya':
 		cla & *clr
 		'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 		'"It''s not mine," you say blearily, feigning being drowsy from just having woken up. "It must be Anya''s."'
@@ -435,10 +440,10 @@ if $ARGS[0] = 'dildo_wakeup1':
 		'"Ahuh. You were saying?" Your mother puts her hands on her hips and glares at you. "I can''t believe you''re stupid enough to leave this in the bathroom where Kolka or Vladimir could find it! What were you thinking?! You''ll ruin your brother''s innocence behaving like this, give your father a heart attack too! And you''ll ruin yourself for marriage if you- She cuts off suddenly with a horrified look on her face.'
 		'"My God... you haven''t..."'
 		'You can see where this is going and you don''t like it.'
-		gs'mother_sextalk','bathroom_dildo_response_single'
+		gs 'mother_sextalk', 'bathroom_dildo_response_single'
 	end
 	
-	act'Well I need some kind of outlet!':
+	act 'Well I need some kind of outlet!':
 		cla & *clr
 		'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 		'"Well I need some kind of outlet!" you say, sitting up in bed and throwing your arms up in exasperation.'
@@ -446,20 +451,22 @@ if $ARGS[0] = 'dildo_wakeup1':
 		'"You''re always telling me to stay away from men and not to act like a slut. Well, I gotta tell you <<$npc_nickname[''A29'']>>, <i>I get horny sometimes.</i> And if you don''t want me fucking boys, getting pregnant, or worse, then this is what it takes!"'
 		'"Mmmm. She''s right mom. Horny girls need satisfaction," your sister mumbles before rolling over to her other side and going back to sleep.'
 		'She blinks at your outburst but recomposes herself, taking a dignified stance.'
+
 		if motherQW['bathroom_dildos'] = 2:
 			'"Well, there are other ways you can deal with that," she sniffs. "You didn''t have to ruin yourself for marriage. You certainly don''t need <i>two</i> of these." You roll your eyes in response.'
 		else
 			'"Well, there are other ways you can deal with that," she sniffs. "You didn''t have to ruin yourself for marriage." You roll your eyes in response.'
 		end
+
 		'"Regardless, you shouldn''t be leaving stuff like this around the house. I''m taking these as punishment," she says.'
 		'"But <<$npc_nickname[''A29'']>>!"'
 		'"No buts young lady! Other people live in this household too! You need to learn to control yourself. If you can''t do that much then you don''t deserve to have these either."'
 		*nl
 		if motherQW['dildo_shower_discovery'] = 1:
 			motherQW['dildo_shower_discovery'] = 0
-			gs'mother_sextalk','dildo_shower_ending1'
+			gs 'mother_sextalk', 'dildo_shower_ending1'
 		else
-			gs'mother_sextalk','dildo_ending1'
+			gs 'mother_sextalk', 'dildo_ending1'
 		end
 		*nl
 		'<i>Ugh. Great. Now I need new ones.</i>'
@@ -469,7 +476,8 @@ if $ARGS[0] = 'dildo_wakeup1':
 		vanrPar_suction_dildo = 0
 		motherQW['bathroom_dildos'] = 0
 		motherKnowDildo = 1
-		act'Continue':gt 'sleep', 'wake'
+
+		act 'Continue': gt 'wakeup_events', 'event_end'
 	end
 end
 
@@ -483,9 +491,10 @@ if $ARGS[0] = 'dildo_wakeup2':
 		'You wake up in a shock when your door bangs open and you see your mother standing in the doorway holding a pair of dildos.'
 		'Oh <i>fuck</i>, you left them in the bathroom again.'
 	end
+
 	'"What''s your excuse this time?" she glares at you'
 	if motherKnowDildo = 1 or dildo_ownership = 1:
-		act'"Sorry...?"':
+		act '"Sorry...?"':
 			vanrPar_bathtub_dildo = 0
 			vanrPar_bath_shower_dildo = 0
 			vanrPar_suction_dildo = 0
@@ -500,7 +509,8 @@ if $ARGS[0] = 'dildo_wakeup2':
 			'She walks out of your bedroom and shuts the door.'
 			*nl
 			'<i>Well, so much for that...</i>'
-			act'Continue':gt 'sleep', 'wake'
+
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		end
 	else
 		vanrPar_bathtub_dildo = 0
@@ -508,17 +518,18 @@ if $ARGS[0] = 'dildo_wakeup2':
 		vanrPar_suction_dildo = 0
 		motherQW['bathroom_dildos'] = 0
 		motherKnowDildo = 1
-		act'"No..."':
+		act '"No..."':
 			gs 'npc_relationship', 'modify', 'A29', -10
 			cla & *clr
 			'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 			'"No..." you say dejectedly.'
 			'"Honestly," she huffs, shaking her head in disappointment. "I expected more of you <<$pcs_firstname>>."'
 			'She walks out of your bedroom and shuts the door.'
-			act'Continue':gt 'sleep', 'wake'
+
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		end
 		
-		act'Well I need some kind of outlet!':
+		act 'Well I need some kind of outlet!':
 			vanrPar_bathtub_dildo = 0
 			vanrPar_bath_shower_dildo = 0
 			vanrPar_suction_dildo = 0
@@ -536,8 +547,9 @@ if $ARGS[0] = 'dildo_wakeup2':
 			'She walks out of your bedroom and shuts the door.'
 			*nl
 			'<i>Ugh. Great.</i> you think, throwing your head back against your pillow. <i>Now I need a new one. But maybe at least this gets <<$npc_nickname[''A29'']>> off my back...</i>'
-			act'Continue':gt 'sleep', 'wake'
-		end		
+
+			act 'Continue': gt 'wakeup_events', 'event_end'
+		end
 	end
 end
 
@@ -549,6 +561,7 @@ if $ARGS[0] = 'dildo_wakeup3':
 	motherQW['dildo_caught'] += 1
 	mc_inventory['dildo_suction'] += motherQW['bathroom_dildos']
 	motherQW['bathroom_dildos'] = 0
+
 	'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 	if motherQW['bathroom_dildos'] = 1:
 		'You wake up in shock to something made of rubber slapping you in the face. Startled, you sit up in bed and look around, seeing a dildo laying on your covers.'
@@ -558,13 +571,14 @@ if $ARGS[0] = 'dildo_wakeup3':
 		'"Again, <<$pcs_firstname>>?" Looking up, you see your mother sighing in the doorway to your bedroom with a hand on her forehead. "God, I hope you washed everything before I touched those. I''m not going to throw them away this time because I know you''re just going to buy more. But please <<$pcs_nickname>>. Think of your brother and father. Stop leaving these lying around like that."'
 	end
 	'She walks out of your bedroom and shuts the door.'
-	act'Continue':gt 'sleep', 'wake'
+
+	act'Continue': gt 'wakeup_events', 'event_end'
 end
 
 !! branching path if a SINGLE dildo was left in the bathroom
 if $ARGS[0] = 'bathroom_dildo_response_single':
 	if dildo_ownership ! 1:
-		act'I swear! It''s not mine!':
+		act 'I swear! It''s not mine!':
 			vanrPar_bathtub_dildo = 0
 			vanrPar_bath_shower_dildo = 0
 			vanrPar_suction_dildo = 0
@@ -578,7 +592,8 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 			'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 			'"I swear <<$npc_nickname[''A29'']>>! It''s not mine! I don''t know where it came from!"'
 			'"Oh yeah? Then you won''t mind if I throw this straight into the garbage. And you won''t mind getting a referral from the clinic either. <i>Today</i> <<$pcs_firstname>>."'
-			gs'mother_sextalk','dildo_dumpster_ending1'
+
+			gs 'mother_sextalk', 'dildo_dumpster_ending1'
 			*nl
 			if stat['think_virgin'] = 0:
 				'<i>Great. Now I''m going to get in even bigger trouble. <b>And</b> I lost my dildo...</i>'
@@ -586,14 +601,14 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 				'<i>Great. Now I have to do that too. I didn''t even get to use it...</i>'
 			end
 			if motherQW['dildo_wakeup'] = 1:
-				act'Continue':gt 'sleep', 'wake'
+				act 'Continue': gt 'wakeup_events', 'event_end'
 			else
-				act'Continue':gt $loc, $loc_arg
+				act 'Continue': gt $loc, $loc_arg
 			end
 		end
 	end
-	
-	act'I didn''t get to use it yet':
+
+	act 'I didn''t get to use it yet':
 		vanrPar_bathtub_dildo = 0
 		vanrPar_bath_shower_dildo = 0
 		vanrPar_suction_dildo = 0
@@ -610,7 +625,7 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 			'"You think I''m going to fall for an obvious lie like that <<$pcs_firstname>>??"'
 			'"No! I swear! It''s true!"'
 			'"Oh yeah? Then you won''t mind if I throw this straight into the garbage. And you won''t mind getting a referral from the clinic either. <i>Today</i> <<$pcs_firstname>>."'
-			gs'mother_sextalk','dildo_dumpster_ending1'
+			gs 'mother_sextalk', 'dildo_dumpster_ending1'
 			*nl
 			'<i>Great. Now I have to do that too. I didn''t even get to use it...</i>'
 		else
@@ -619,17 +634,18 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 			'"You think I''m going to fall for an obvious lie like that <<$pcs_firstname>>??"'
 			'"No! I swear! It''s true!"'
 			'"Then prove it. Get a new referral from the clinic either. <i>Today</i> <<$pcs_firstname>>. And I''m taking this. It''s going in the trash right now."'
-			gs'mother_sextalk','dildo_dumpster_ending1'
+			gs 'mother_sextalk', 'dildo_dumpster_ending1'
 			*nl
 			'<i>Great. Now I''m going to get in even bigger trouble. <b>And</b> I lost my dildo...</i>'
 		end
 		if motherQW['dildo_wakeup'] = 1:
-			act'Continue':gt 'sleep', 'wake'
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		else
-			act'Continue':gt $loc, $loc_arg
+			act 'Continue': gt $loc, $loc_arg
 		end
 	end
-	act'I just suck on it':
+
+	act 'I just suck on it':
 		vanrPar_bathtub_dildo = 0
 		vanrPar_bath_shower_dildo = 0
 		vanrPar_suction_dildo = 0
@@ -645,7 +661,7 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 		'"Do you expect me to believe that <<$pcs_firstname>>?"'
 		'"Yes! It''s the truth!" you lie.'
 		'"Oh yeah? Then you won''t mind if I throw this straight into the garbage. And you won''t mind getting a referral from the clinic either. <i>Today</i> <<$pcs_firstname>>."'
-		gs'mother_sextalk','dildo_dumpster_ending1'
+		gs 'mother_sextalk', 'dildo_dumpster_ending1'
 		*nl
 		if stat['think_virgin'] = 0:
 			'<i>Great. Now I''m going to get in even bigger trouble. <b>And</b> I lost my dildo...</i>'
@@ -653,13 +669,12 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 			'<i>Great. Now I have to do that too. I didn''t even get to use it...</i>'
 		end
 		if motherQW['dildo_wakeup'] = 1:
-			act'Continue':gt 'sleep', 'wake'
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		else
-			act'Continue':gt $loc, $loc_arg
+			act 'Continue': gt $loc, $loc_arg
 		end
 	end
-	
-	
+
 	act'Well I need some kind of outlet!':
 		vanrPar_bathtub_dildo = 0
 		vanrPar_bath_shower_dildo = 0
@@ -678,16 +693,16 @@ if $ARGS[0] = 'bathroom_dildo_response_single':
 		*nl
 		if motherQW['dildo_shower_discovery'] = 1:
 			motherQW['dildo_shower_discovery'] = 0
-			gs'mother_sextalk','dildo_shower_ending1'
+			gs 'mother_sextalk', 'dildo_shower_ending1'
 		else
-			gs'mother_sextalk','dildo_ending1'
+			gs 'mother_sextalk', 'dildo_ending1'
 		end
 		*nl
 		'<i>Ugh. Great. Now I need a new one.</i>'
 		if motherQW['dildo_wakeup'] = 1:
-			act'Continue':gt 'sleep', 'wake'
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		else
-			act'Continue':gt $loc, $loc_arg
+			act 'Continue': gt $loc, $loc_arg
 		end
 	end
 end
@@ -696,7 +711,7 @@ end
 !! if MULTIPLE dildos were left in the bathroom
 if $ARGS[0] = 'bathroom_dildo_response_multiple':
 	if dildo_ownership ! 1:
-		act'I swear! They''re not mine!':
+		act 'I swear! They''re not mine!':
 			vanrPar_bathtub_dildo = 0
 			vanrPar_bath_shower_dildo = 0
 			vanrPar_suction_dildo = 0
@@ -710,7 +725,7 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 			'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
 			'"I swear <<$npc_nickname[''A29'']>>! They''re not mine! I don''t know where they came from!"'
 			'"Oh yeah? Then you won''t mind if I throw these straight into the garbage. And you won''t mind getting a referral from the clinic either. <i>Today</i> <<$pcs_firstname>>."'
-			gs'mother_sextalk','dildo_dumpster_ending1'
+			gs 'mother_sextalk', 'dildo_dumpster_ending1'
 			*nl
 			if stat['think_virgin'] = 0:
 				'<i>Great. Now I''m going to get in even bigger trouble. <b>And</b> I lost my dildo...</i>'
@@ -718,14 +733,14 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 				'<i>Great. Now I have to do that too. I didn''t even get to use it...</i>'
 			end
 			if motherQW['dildo_wakeup'] = 1:
-				act'Continue':gt 'sleep', 'wake'
+				act 'Continue': gt 'wakeup_events', 'event_end'
 			else
-				act'Continue':gt $loc, $loc_arg
+				act 'Continue': gt $loc, $loc_arg
 			end
 		end
 	end
-	
-	act'I didn''t get to use them yet':
+
+	act 'I didn''t get to use them yet':
 		vanrPar_bathtub_dildo = 0
 		vanrPar_bath_shower_dildo = 0
 		vanrPar_suction_dildo = 0
@@ -742,7 +757,7 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 			'"You think I''m going to fall for an obvious lie like that <<$pcs_firstname>>? There were <i>two of them</i> in there!"'
 			'"No! I swear! It''s true!"'
 			'"Oh yeah? Then you won''t mind if I throw these straight into the garbage. And you won''t mind getting a referral from the clinic either. <i>Today</i> <<$pcs_firstname>>."'
-			gs'mother_sextalk','dildo_dumpster_ending1'
+			gs 'mother_sextalk', 'dildo_dumpster_ending1'
 			*nl
 			'<i>Great. Now I have to do that too. I didn''t even get to use it...</i>'
 		else
@@ -751,18 +766,18 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 			'"You think I''m going to fall for an obvious lie like that <<$pcs_firstname>>??"'
 			'"No! I swear! It''s true!"'
 			'"Then prove it. Get a new referral from the clinic either. <i>Today</i> <<$pcs_firstname>>. And I''m taking this. It''s going in the trash right now."'
-			gs'mother_sextalk','dildo_dumpster_ending1'
+			gs 'mother_sextalk', 'dildo_dumpster_ending1'
 			*nl
 			'<i>Great. Now I''m going to get in even bigger trouble. <b>And</b> I lost my dildo...</i>'
 		end
 		if motherQW['dildo_wakeup'] = 1:
-			act'Continue':gt 'sleep', 'wake'
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		else
-			act'Continue':gt $loc, $loc_arg
+			act 'Continue': gt $loc, $loc_arg
 		end
 	end
-	
-	act'I just suck on it':
+
+	act 'I just suck on it':
 		vanrPar_bathtub_dildo = 0
 		vanrPar_bath_shower_dildo = 0
 		vanrPar_suction_dildo = 0
@@ -786,13 +801,12 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 			'<i>Great. Now I have to do that too. I didn''t even get to use it...</i>'
 		end
 		if motherQW['dildo_wakeup'] = 1:
-			act'Continue':gt 'sleep', 'wake'
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		else
-			act'Continue':gt $loc, $loc_arg
+			act 'Continue': gt $loc, $loc_arg
 		end
 	end
 	
-	
 	act'Well I need some kind of outlet!':
 		cla & *clr
 		'<center><img <<$set_imgh>> src="images/characters/pavlovsk/resident/mom/mother.jpg"></center>'
@@ -808,7 +822,7 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 		'"But <<$npc_nickname[''A29'']>>!"'
 		'"No buts young lady! Other people live in this household too! You need to learn to control yourself. If you can''t do that much then you don''t deserve to have these either."'
 		*nl
-		gs'mother_sextalk','dildo_ending1'
+		gs 'mother_sextalk','dildo_ending1'
 		*nl
 		'<i>Ugh. Great. Now I need new ones.</i>'
 		
@@ -819,9 +833,9 @@ if $ARGS[0] = 'bathroom_dildo_response_multiple':
 		motherKnowDildo = 1
 		
 		if motherQW['dildo_wakeup'] = 1:
-			act'Continue':gt 'sleep', 'wake'
+			act 'Continue': gt 'wakeup_events', 'event_end'
 		else
-			act'Continue':gt $loc, $loc_arg
+			act 'Continue': gt $loc, $loc_arg
 		end
 	end
 end

+ 1 - 1
locations/natbel_friend.qsrc

@@ -977,7 +977,7 @@ if $ARGS[0] = 'netbelapt_sex_climax':
 			'"She leans over and gives you a soft passionate kiss. "Stay with me," she asks, lovingly. She then slowly moves down to your boobs and gives them a final kiss before settling down next to you.'
 			'You answer by cuddling up to her and you both drift off to sleep.'
 			gs 'arousal', 'end'
-			gs 'sleep', 'simple'
+			gs 'sleep_simple', 'simple'
 			gs 'stat'
 			act 'Return to her room': gt 'natbelapt', 'natroom'
 		end

+ 45 - 27
locations/nichBedroomServant.qsrc

@@ -26,7 +26,7 @@ if $ARGS[0] = '' or $ARGS[0] = 'start' or $ARGS[0] = 'return':
 	'<center><b>Your Bedroom in Nicholas'' Apartment</b></center>'
 	'<center><img <<$set_imgh>> src="images/locations/city/citycenter/nichApartment/bedroomServant.jpg"></center>'
 
-	'Your bedroom is fairly large, considering you''re only an employee. There is a small <a href="exec:gt ''bed'', ''start''">double bed</a> and an <a href="exec:gt ''budilnik'', ''start''">alarm clock</a>.'
+	'Your bedroom is fairly large, considering you''re only an employee. There is a small <a href="exec:gt ''bed'', ''start''">double bed</a> and an <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a>.'
 	if $ml_guitar['location'] = $loc: 'Your guitar rests on its stand next to your bed.'
 	'Half a wall is taken up by an expensive-looking <a href="exec:gt ''wardrobe'', ''start''">wardrobe</a> (where you can choose outfits and organize your clothing). There''s a make-up table with a <a href="exec:gt ''mirror'', ''start''">mirror</a> next to it.'
 	if mc_inventory['tech_computer'] = 1:
@@ -208,15 +208,20 @@ elseif $ARGS[0] = 'redeemSalary':
 
 elseif $ARGS[0] = 'sleepEvents':
 	menu_off = 1
+	!! Replicated in pre_sleep_events. AGSS[1] should never be 0.
 	if ARGS[1] = 0:
 		if nichGalaOpponent = 30 and hour <= 23 and hour >= 19 and nichDebug = 1:
 			!! Start abduction
 			!! TODO
-			gt 'nichBedroomServant','sleepEvents', 1000
+			gt 'nichBedroomServant', 'sleepEvents', 1000
 		elseif nichGalaContractTaras = 1 and nichGalaContractTarasLast + rand(3,10) <= daystart:
 			!! Taras visits
-			gt 'nichBedroomServant','sleepEvents', 100
+			gt 'nichBedroomServant', 'sleepEvents', 100
 		end
+
+	!! ARGS[1] = 100 currently always has Sveta go back to sleep.
+	!! If this stops being the case, then the corresponding entry in pre_sleep_events needs to be changed!
+	!! Blame Anjuna
 	elseif ARGS[1] = 100:
 		nichGalaContractTarasLast = daystart
 	
@@ -243,7 +248,8 @@ elseif $ARGS[0] = 'sleepEvents':
 			killvar 'nichTarSauna'
 			killvar 'nichTarSaunaPay'
 			!!TODO: CONT
-			act 'Back to sleep': gt 'sleep', 'dream'
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 		elseif nichTarSaunaPay > 10000:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/chat.jpg"></center>'
 			'You wake up to the feeling of something heavy resting on you. A little bit sleepy you open your eyes and see the face of Taras directly in front of yours.'
@@ -251,7 +257,8 @@ elseif $ARGS[0] = 'sleepEvents':
 			'"Don''t slack off now! I need 20000 <b>₽</b> in total from you. I am sure you can easily earn them for me. You are already more than half-way there."'
 			'He gives you a light smack on your face, then he stands up and leaves your room.'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 		elseif nichGalaContractTarasCount = 10:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/chat.jpg"></center>'
 			'You wake up to the feeling of something heavy resting on you. A little bit sleepy you open your eyes and see the face of Taras directly in front of yours.'
@@ -271,7 +278,8 @@ elseif $ARGS[0] = 'sleepEvents':
 			nichTarSauna = 1
 			nichTarSaunaPay = 0
 			SaunaWhore = 1
-			act 'Back to sleep': gt 'sleep', 'dream'
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 		elseif nichGalaContractTarasCount = 0 or nichRand = 0:
 			
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed7.jpg"></center>'
@@ -287,8 +295,9 @@ elseif $ARGS[0] = 'sleepEvents':
 			'"I know you prefer the real deal. Don''t worry, it won''t take long before you can experience it again."'
 			'He unties you and leaves your room.'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
-		elseif nichGalaContractTarasCount = 1 or nichRand = 1:	
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
+		elseif nichGalaContractTarasCount = 1 or nichRand = 1:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed9.jpg"></center>'
 			'You have an erotic dream of being tied up tightly.'
 			'Suddenly you are wide awake as your nostrils are blocked. You open your mouth to gasp for air and feel a dick being pushed into it.'
@@ -304,8 +313,9 @@ elseif $ARGS[0] = 'sleepEvents':
 			gs 'cum_call', 'mouth_swallow', 'A513', 1
 			gs 'stat'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
-		elseif nichGalaContractTarasCount = 2 or nichRand = 2:	
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
+		elseif nichGalaContractTarasCount = 2 or nichRand = 2:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed3.jpg"></center>'
 			'Just as you are falling asleep, you feel yourself being lifted out of bed. You are immediately wide awake.'
 			'Realizing you are awake, Taras places you on your feet and twists your arm behind your back while pushing you forward. There is no way for you to fight back.'
@@ -322,8 +332,9 @@ elseif $ARGS[0] = 'sleepEvents':
 			gs 'cum_call', 'anus', 'A513', 1
 			gs 'stat'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
-		elseif nichGalaContractTarasCount = 3 or nichRand = 3:	
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
+		elseif nichGalaContractTarasCount = 3 or nichRand = 3:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed6.jpg"></center>'
 			'You wake up to a painful hit on your butt. Instinctively you try to reach down there, but your wrists and ankles are tied to the opposite corners of your bed. There is nothing you can do besides lie on your stomach.'
 			'"Good, you are awake."'
@@ -337,9 +348,10 @@ elseif $ARGS[0] = 'sleepEvents':
 			'You are just too exhausted to stay awake for much longer. During another pause of the vibrator you fall asleep. You have some erotic dreams about being fucked by various guys and girls with the ongoing vibrations of the vibrator being a part of it.'
 			'You don''t know how long Taras left the vibrator inside of you, but when you wake up next, you are untied and the vibrator is gone.'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 			!! TODO: CONT
-		elseif nichGalaContractTarasCount = 4 or nichRand = 4:	
+		elseif nichGalaContractTarasCount = 4 or nichRand = 4:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed4x1.jpg"></center>'
 			'You get pulled out of your sleep abruptly as your legs get pulled upwards. You want to scream in surprise, but your mouth is taped shut, as are your eyes.'
 			'You try to get away, but your hands are tied up as well. The person who restrained you also tied your ankles with a rope connected to the head end of the bed, leaving you completely exposed.'
@@ -367,9 +379,10 @@ elseif $ARGS[0] = 'sleepEvents':
 				'"I am sure you will enjoy this."'
 				'He unties your right wrist, allowing you to remove the other restraints, before he leaves your room again.'
 				nichGalaContractTarasCount += 1
-				act 'Back to sleep': gt 'sleep', 'dream'
+
+				act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 			end
-		elseif nichGalaContractTarasCount = 5 or nichRand = 5:	
+		elseif nichGalaContractTarasCount = 5 or nichRand = 5:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed2.jpg"></center>'
 			'You are suddenly awake as you are dragged out of your bed. You want to scream, but a rope around your neck makes it hard for you to breath and impossible to make a sound.'
 			'Starting to panic you try to struggle free as you get pushed to the floor. Your left arm is twisted behind your back, making every attempt to get free futile.'
@@ -382,7 +395,8 @@ elseif $ARGS[0] = 'sleepEvents':
 			'"Well done, slut. If you haven''t struggled that much, I wouldn''t have had so much fun."'
 			'It was Taras all along. He picks up his rope and leaves your room.'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 		elseif nichGalaContractTarasCount = 6 or nichRand = 6:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed10.jpg"></center>'
 			'Suddenly you wake up. Your butt hurts. You realize that you are tied to your bed and that somebody is sitting next to you, spanking your ass.'
@@ -395,8 +409,9 @@ elseif $ARGS[0] = 'sleepEvents':
 			'He gives you three last hits, then he stands up and unties you.'
 			'"At least you have a nice ass, slave."'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
-		elseif nichGalaContractTarasCount = 7 or nichRand = 7:	
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
+		elseif nichGalaContractTarasCount = 7 or nichRand = 7:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed1x1.jpg"></center>'
 			'You get woken up by a slap to your breast. You want to shriek, but once again you are tied to your bed. A ball gag in your mouth prevents you from making any sound.'
 			'Opening your eyes you see Taras standing above you.'
@@ -423,10 +438,11 @@ elseif $ARGS[0] = 'sleepEvents':
 					'"I knew you would enjoy it. While normal people like me sleep at night, sluts like you want to get fucked all night long, and I am nothing but supportive in this regard."'
 					'He leaves you with a grin on his face.'
 					nichGalaContractTarasCount += 1
-					act 'Back to sleep': gt 'sleep', 'dream'
+
+					act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 				end
 			end
-		elseif nichGalaContractTarasCount = 8 or nichRand = 8:	
+		elseif nichGalaContractTarasCount = 8 or nichRand = 8:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed11.jpg"></center>'
 			'Suffocation... '
 			'You open your eyes in panic. A rope around your neck makes it impossible for you to breath. You try to struggle, but you are completely tied up.'
@@ -437,8 +453,9 @@ elseif $ARGS[0] = 'sleepEvents':
 			'"Damn. My services are required. I am sorry, but I am afraid we will have to continue our little fun another time."'
 			'He unties you and leaves your room without saying another word.'
 			nichGalaContractTarasCount += 1
-			act 'Back to sleep': gt 'sleep', 'dream'
-		elseif nichGalaContractTarasCount = 9 or nichRand = 9:	
+
+			act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
+		elseif nichGalaContractTarasCount = 9 or nichRand = 9:
 			'<center><img <<$set_imgh>> src="images/characters/city/gala/slave/taras/bed5.jpg"></center>'
 			'No air...'
 			'You open your eyes in panic. There is a plastic bag over your head. You desperately try to remove it, but your hands are tied behind your back.'
@@ -464,7 +481,8 @@ elseif $ARGS[0] = 'sleepEvents':
 						'As you wake up this time, Taras is gone and you are untied.'
 						'One horrific thought comes to your mind and makes you shiver: this man shows utter neglect for your safety. What if one day he kills you by accident?'
 						nichGalaContractTarasCount += 1
-						act 'Back to sleep': gt 'sleep', 'dream'
+
+						act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 					end
 				end
 			end
@@ -501,13 +519,13 @@ elseif $ARGS[0] = 'sleepEvents':
 						gs 'stat'
 						'He unties you and leaves your room again.'
 						nichGalaContractTarasCount += 1
-						act 'Back to sleep': gt 'sleep', 'dream'
+
+						act 'Back to sleep': gs 'pre_sleep_events', 'event_end'
 					end
 				end
 			end
 		end
-		
-		
+
 	elseif ARGS[1] = 1000:
 		hour = 23
 		minut += 180

+ 1 - 2
locations/nichTanya.qsrc

@@ -931,8 +931,7 @@ if $ARGS[0] = 'date_end':
 												act 'sleep':
 													$loc = 'nichTanya'
 													$loc_arg = 'date_next_morning'
-													$sleep_txt = 'Go to bed'
-													gs 'sleep', 'full'
+													gt 'pre_sleep_events', 'start'
 												end
 											end
 										end

+ 2 - 2
locations/pav_shared_apt.qsrc

@@ -716,9 +716,9 @@ if $ARGS[0] = 'pcsRoom':
 	*nl
 	'The living room was never used by the other apartment occupants, so it''s now rented out as a bedroom. It''s sparsely decorated, with, a <a href="exec:gt ''bed'', ''start''">sofa bed</a>, against the back wall.'
 	*nl
-	'Beside the sofa bed is an old cabinet, with your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> on top.'
+	'Beside the sofa bed is an old cabinet, with your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> on top.'
 	*nl
-	'Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt $loc, $loc_arg">ON</a>.')
+	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
 	*nl
 	if $ml_guitar['location'] = $loc: 'Your guitar rests on its stand next to your bed.'
 	*nl

+ 1 - 1
locations/placer_sex.qsrc

@@ -1430,7 +1430,7 @@ if $args[0] = 'sleep':
 	end
 	*clr & cla
 	clr
-	notathomesleep=0
+	sleepQW['notathomesleep'] = 0
 	pcs_health += 5
 	pcs_hairbsh = 0
 	InSleep = 1

+ 185 - 0
locations/pre_sleep.qsrc

@@ -0,0 +1,185 @@
+# pre_sleep
+$sleep_loc = 'pre_sleep'
+menu_off = 1
+
+!! Deals with all the triggers that happen to prepare to for the sleep cycle, before the dream events start.
+!!
+!! Moved here from pre_sleep_events
+!! When done: Move to dream_events
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	gt 'pre_sleep_events', 'start'
+end
+
+if $ARGS[0] = 'pre_sleep2':
+	menu_off = 1
+	if clo_flag['bed'] = 0:
+		clo_flag['bed'] = 1
+		$lastwornclothingtype['bed'] = $clothingworntype
+		lastwornclothingnumber['bed'] = clothingwornnumber
+		$lastwornpantytype['bed'] = $pantyworntype
+		lastwornpantynumber['bed'] = pantywornnumber
+		$lastwornbratype['bed'] = $braworntype
+		lastwornbranumber['bed'] = brawornnumber
+	end
+	if bedPanty = 2:
+		gs 'underwear', 'remove'
+	elseif bedPanty = 1:
+		gs 'underwear', 'wear'
+	end
+	if $clothingworntype ! 'nude':
+		strip_here = 1
+		gs 'clothing', 'strip'
+	end
+
+	if disable_autosave = 0:
+		if mid($start_type,1,4) = 'city':
+			savegame 'autosave_city.sav'
+		elseif mid($start_type,1,3) = 'uni':
+			savegame 'autosave_uni.sav'
+		else
+			savegame 'autosave_sg.sav'
+		end
+	end
+
+	gt 'pre_sleep', 'prepare_sleep'
+end
+
+if $ARGS[0] = 'prepare_sleep':
+	menu_off = 1
+	if $clothingworntype ! 'nude':
+		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
+	else
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
+	end
+	gs 'stat'
+	*nl
+	if alarmVars['alarmOn'] = 1:
+		if alarm_holiday = 1 and kanikuli ! 0 or ((hour => alarmVars['timerEndH'] and (week = 5 or week = 6)) or (hour < alarmVars['timerEndH'] and (week = 6 or week = 7))):
+			'You run through your regular nightly routine, setting your alarm for <<func(''bed2'', ''alarm_display'', timerEnd, timerEndM)>>, you undress, and prepare for sleep:'
+		else
+			'You run through your regular nightly routine, setting your alarm for <<func(''bed2'', ''alarm_display'', timer, timerM)>>, you undress, and prepare for sleep:'
+		end
+	else
+		'You run through your regular nightly routine, not bothering to setting your alarm, you undress, and prepare for sleep:'
+	end
+
+	pcs_hairbsh = 0
+	pain['killer'] = 0
+
+	if mid($start_type, 1, 2) = 'sg' and $loc ! 'bedrPar' and SchoolAtestat = 0:
+		sleepVars['notathomesleep'] += 1
+	else
+		sleepVars['notathomesleep'] = 0
+	end
+
+	if succubusflag = 1 and sucwalkday <= daystart and (succhungry < (0 - 1 - succublvl) or pcs_willpwr < ((succublvl * willpowermax) / 13) or sucpowzeroed >= 3): gs 'succubus', 'sucwalkinginit'
+
+	if analplugIN = 1 and vibratorIN = 1:
+		*nl
+		if sleepVars['bedAnal'] = 1 and sleepVars['bedVibrator'] = 1:
+			analplugIN = 0
+			vibratorIN = 0
+			gs 'stat'
+			'You remove your butt plug and your vibrator.'
+		elseif sleepVars['bedAnal'] = 1 and sleepVars['bedVibrator'] = 0:
+			vibratorIN = 0
+			gs 'stat'
+			'You decide to leave your butt plug in, but remove your vibrator.'
+		elseif sleepVars['bedAnal'] = 0 and sleepVars['bedVibrator'] = 1:
+			analplugIN = 0
+			gs 'stat'
+			'You decide to remove your butt plug, but leave your vibrator in.'
+		else
+			'You decide to leave your butt plug and vibrator in.'
+		end
+	elseif analplugIN = 1 and vibratorIN = 0:
+		*nl
+		if sleepVars['bedAnal'] = 1:
+			analplugIN = 0
+			gs 'stat'
+			'You remove your butt plug.'
+		else
+			*nl
+			'You decide to leave your butt plug in.'
+		end
+	elseif analplugIN = 0 and vibratorIN = 1:
+		*nl
+		if sleepVars['bedVibrator'] = 1:
+			vibratorIN = 0
+			'You remove your vibrator.'
+		else
+			'You decide to leave your vibrator in.'
+		end
+	end
+
+	if $shoeworntype = 'none':
+		$bed['shoetype'] = 'none'
+	else
+		$bed['shoetype'] = $shoeworntype
+		bed['shoenumber'] = shoewornnumber
+!!		gs 'shoes', 'strip'
+	end
+
+	*nl
+	if bedPanty = 1:
+		if $pantyworntype = 'none' and $braworntype = 'none':
+			'You put on your bra and panties.'
+		elseif $pantyworntype ! 'none' and $braworntype = 'none':
+			'You put on your bra.'
+		elseif $pantyworntype ! 'none' and $braworntype ! 'none':
+			'You put on your panties.'
+		else
+			'You change your bra and panties.'
+		end
+	elseif bedPanty = 2:
+		if $pantyworntype ! 'none' or $braworntype ! 'none':
+			'You remove your bra and panties.'
+		elseif $pantyworntype ! 'none' and $braworntype = 'none':
+			'You remove your panties.'
+		elseif $braworntype ! 'none':
+			'You remove your bra.'
+		end
+	else
+		'You were too tired to worry about your underwear, so for tonight you left it as is.'
+	end
+
+	*nl
+	if $hairstyle ! '':
+		$hairstyle
+	else
+		'Your hair is loose and free.'
+	end
+
+	if pcs_makeup > 1 and cosmetic_tattoo = 0:
+		pcs_makeup = 0
+		vidageday -= 1
+		gs 'body', 'SkinLoss', 'MakeUpSleep'
+		*nl
+		'You went to bed wearing your makeup, which will smear your face as you sleep; your skin will age faster from this!'
+	end
+
+	if fat > 5 and stringimplant = 1: silicone += 1 & fat -= 5
+
+	gs 'pre_sleep', 'mod_triggers'
+
+	act 'Sleep...':
+	!!flag to stop autosave breaking my awesome clothing thingy
+		clo_flag['bed'] = 0
+		InSleep = 1
+		gs 'stat'
+
+		gt 'dream_events', 'start'
+	end
+end
+
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
+end
+
+
+--- pre_sleep ---------------------------------

+ 277 - 0
locations/pre_sleep_events.qsrc

@@ -0,0 +1,277 @@
+# pre_sleep_events
+$sleep_loc = 'pre_sleep_events'
+menu_off = 1
+
+!! Pre-sleep events trigger after deciding to go to sleep, but before dreaming and falling asleep (and thus before the auto-save).
+!!
+!! Moved here from pre_sleep
+!! When done: move to pre_sleep, pre_sleep2
+
+	!!=====================================!!
+	!!                                     !!
+	!!          Event handlers             !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+
+	if sleepVars['events_active'] = 1:
+		sleepVars['events_done'] = 0
+
+		if succubusQW = 2:
+			$sleep_events_priority[] = 'gs ''sleep_events'', ''succhoice'' '
+		end
+		if magf2bdo = 2:
+			$sleep_events_priority[] = 'gs ''sleep_events'', ''magbstchoice'' '
+		end
+
+		if nichGalaOpponent = 30 and hour <= 23 and hour >= 19 and nichDebug = 1:
+			!! Start abduction
+			!! TODO
+			$sleep_events_priority[] = 'gt ''pre_sleep_events'', ''nichServentSleepEvents2'' '
+		elseif nichGalaContractTaras = 1 and daystart >= nichGalaContractTarasLast + rand(3, 10):
+			!! Taras visits
+			$sleep_events_priority[] = 'gt ''pre_sleep_events'', ''nichServentSleepEvents1'' '
+		end
+
+		gt 'pre_sleep_events', 'mod_events'
+	end
+
+	gt 'pre_sleep_events', 'continue'
+end
+
+if $ARGS[0] = 'mod_events':
+	!! This location is here to allow mods to hook into the system.
+	!! Check for: if $sleep_loc = 'pre_sleep_events' and $ARGS[0] = 'mod_events'
+	!!
+	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!! A random event will be chosen from amongst the added ones.
+	!! If an event MUST trigger (due to quest timing), add it to $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!!
+	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'pre_sleep_events', 'event_end'
+	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'pre_sleep_events', 'exit'
+	!!     Example: Act: 'Leave': gs 'pre_sleep_events', 'exit' & gt $new_loc, $new_log_arg
+	!!
+	!! This is to cleanup all necessary variables.
+	!!
+	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
+	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
+
+	gt 'pre_sleep_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'event_handler':
+	if sleepVars['events_done'] < 1:
+		if arrsize('$sleep_events_priority') > 0:
+			gt 'pre_sleep_events', 'event_handler2', 'priority'
+		elseif arrsize('$sleep_events') > 0:
+			gt 'pre_sleep_events', 'event_handler2'
+		end
+	end
+
+	gt 'pre_sleep_events', 'continue'
+end
+
+if $ARGS[0] = 'event_handler2':
+	sleepVars['events_done'] += 1
+
+	if $ARGS[1] = 'priority':
+		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
+		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
+		killvar '$sleep_events_priority', temp_slev_id
+	else
+		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
+		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
+		killvar '$sleep_events', temp_slev_id
+	end
+
+	killvar 'temp_slev_id'
+	dynamic $temp_sleep_event_chosen
+end
+
+
+if $ARGS[0] = 'event_end':
+	killvar '$temp_sleep_event_chosen'
+
+!!	if arrsize('$sleep_events_priority') > 0:
+!!		gt 'bed_events', 'event_handler2', 'priority'
+!!	end
+
+	gt 'pre_sleep_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'exit':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+end
+
+if $ARGS[0] = 'continue':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+
+	gt 'pre_sleep', 'pre_sleep2'
+end
+
+
+
+
+	!!=====================================!!
+	!!                                     !!
+	!!              Events                 !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'succhoice':
+	menu_off = 1
+	minut += 15
+	gs 'stat'
+	cla
+	if $clothingworntype ! 'nude':
+		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
+	else
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
+	end
+	''
+	'You toss and turn for a while, but the energy that has been buzzing under your skin since that dream just won''t let you sleep.'
+	''
+	'Thinking about it you realize that you could push the energy out or pull it in!'
+	''
+	'<font color="red"><b>You also feel that both are <i>permanent</i> choices.</b></font>'
+	act 'Try to ignore it and go to sleep':
+		if disable_autosave = 0:
+			if mid($start_type,1,4) = 'city':
+				savegame 'autosave_city.sav'
+			elseif mid($start_type,1,3) = 'uni':
+				savegame 'autosave_uni.sav'
+			else
+				savegame 'autosave_sg.sav'
+			end
+		end
+		gs 'pre_sleep_events', 'end'
+	end
+	act 'Push the Energy out for all time': gt 'pre_sleep_events', 'succhoiceNO'
+	act 'Pull the Energy in and let it change you permanently': gt 'pre_sleep_events', 'succhoiceYES'
+end
+
+
+if $ARGS[0] = 'succhoiceNO':
+	menu_off = 1
+	if $clothingworntype ! 'nude':
+		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
+	else
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
+	end
+	''
+	'You push the energy out of you and it dissipates.'
+	succubusQW = 3
+	pcs_horny = 0
+	minut +=5
+	gs 'stat'
+	act 'Go to sleep':
+		gs 'pre_sleep_events', 'end'
+	end
+end
+
+
+if $ARGS[0] = 'succhoiceYES':
+	menu_off = 1
+	if $clothingworntype ! 'nude':
+		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
+	else
+		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
+	end
+	succubusQW = 4
+	''
+	'You pull the energy deeper into yourself and hold it there.'
+	''
+	'Then you feel pressure building...'
+	wait 450
+	minut += 5
+	gs 'stat'
+	'BUILDING...'
+	wait 450
+	minut += 5
+	gs 'stat'
+	'<b>BUILDING...</b>'
+	wait 450
+	minut += 5
+	gs 'stat'
+	'Power bursts through your body causing you to hop out of bed.'
+	act 'Continue': gt 'pre_sleep_events', 'succubinit'
+end
+
+if $ARGS[0] = 'succubinit':
+	menu_off = 1
+	minut += 10
+	gs 'stat'
+
+	!!Sets the succubus flag, succubus level (succublvl), Initial lesbian sex count (suclezsnapshot), initial Succubus hunger (succhungry),
+	!! & the succubus descriptor ($sucself1). The -2 on succhungry is to give th PC 2 days to get in the Succubus grove.
+	succubusflag = 1
+	succublvl = 1
+	suclezsnapshot = lesbian
+	succhungry = -2
+	sucwalkday = daystart + 2 + rand(0,5)
+	$sucself1 = 'that feeling'
+	pcs_horny = 100
+	InSleep = 0
+	slept_in = 0
+	strip_here = 0
+	'<center><img <<$set_imgh>> src="images/pc/body/succubusself.jpg"></center>'
+	*nl
+	'<font color="red">You feel the power flowing around your body for several minutes, leaking through your skin and making changes all throughout you, before fading to a presence deep in your core leaving you looking the same as before... but feeling so different! </font>'
+
+	if preg = 1:
+		gs 'medical_din', 'remove_preg'
+		RecovH = 0
+	end
+
+	act 'Finish': gs 'pre_sleep_events', 'end'
+end
+
+
+if $ARGS[0] = 'magbstchoice':
+	*clr & cla
+	menu_off = 1
+	tittmp = tits + 1
+	'<center><img <<$set_imgh>> src="images/pc/body/tits/t<<tittmp>>.jpg"></center>'
+	killvar 'tittmp'
+	'You have an odd dream where you are looking at your naked chest in a mirror and your breasts seem larger...'
+	'As the dream starts to drift away, you find yourself gazing at the reflection of your breasts and think:'
+	act 'Nice, I wish my breasts really would grow.':
+		magf2bdo = 1
+		magtarcup += 1
+		killvar 'mgf2bnocnt'
+		gt 'pre_sleep_events', 'end'
+	end
+	act 'Eh, I don''t like them like that.': magf2bdo = 0 & mgf2bnocnt += 1 & gs 'pre_sleep_events', 'end'
+end
+
+
+if $ARGS[0] = 'nichServentSleepEvents':
+	!! the 100 events return back to sleep!
+	gt 'nichBedroomServant', 'sleepEvents', 100
+end
+
+if $ARGS[0] = 'nichServentSleepEvents2'
+	gs 'pre_sleep_events', 'exit'
+	gt 'nichBedroomServant', 'sleepEvents', 1000
+end
+
+
+--- pre_sleep_events ---------------------------------

+ 21 - 1
locations/saveupdater.qsrc

@@ -2145,7 +2145,27 @@ if temp_current_save_version < 00090003:
 	killvar '$detec_type'
 
 
-	if legal_fine			> 0:	policeQW['legal_fine']				= legal_fine			& killvar 'legal_fine'
+	if legal_fine > 0: policeQW['legal_fine'] = legal_fine & killvar 'legal_fine'
+	
+	
+	!! Sleep update.
+	killvar 'varsleep'
+
+	if bedPanty			> 0: sleepVars['bedPanty']				= bedPanty			& killvar 'bedPanty'
+	if bedAnal			> 0: sleepVars['bedAnal']				= bedAnal			& killvar 'bedAnal'
+	if bedVibrator		> 0: sleepVars['bedVibrator']			= bedVibrator		& killvar 'bedVibrator'
+	if cheatVib			> 0: sleepVars['cheatVib']				= cheatVib			& killvar 'cheatVib'
+	if notathomesleep	> 0: sleepVars['notathomesleep']		= notathomesleep	& killvar 'notathomesleep'
+	if Enable_nodream 	> 0: sleepVars['cheat_nodream_chance']	= Enable_nodream	& killvar 'Enable_nodream'
+	
+	sleepVars['events_active'] = 1
+	sleepVars['dreams_active'] = 1
+
+	if budilnikOn	> 0: alarmVars['alarmOn']	= budilnikOn	& killvar 'budilnikOn'
+	if timer		> 0: alarmVars['timerH']	= timer			& killvar 'timer'
+	if timerM		> 0: alarmVars['timerM']	= timerM		& killvar 'timerM'
+	if timerEnd		> 0: alarmVars['timerEndH']	= timerEnd		& killvar 'timerEnd'
+	if timerEndM	> 0: alarmVars['timerEndM']	= timerEndM		& killvar 'timerEndM'
 	
 end
 

+ 18 - 18
locations/sex_ev_after.qsrc

@@ -1148,7 +1148,7 @@ if $ARGS[0] = 'cum_clean':
 				end
 			end
 			
-            if mc_inventory['makeup_wipes'] > 0:
+			if mc_inventory['makeup_wipes'] > 0:
 				act'Use your wipes':
 					gs'sex_ev_after', 'wipe_menu'
 					act'Clean everything':
@@ -1341,13 +1341,13 @@ if $ARGS[0] = 'after_sex2':
 			cla & *clr
 			'<center><img <<$set_imgh>> src="images/shared/sex/after/cuddle2.jpg"></center>'
 			'Your midnight fuck over, you and <<$npc_firstname[$boy]>> cuddle up together and fall asleep again.'
-			act'Sleep':gt'sex_ev_after', 'sleep_function'
+			act 'Sleep': gt'sex_ev_after', 'sleep_function'
 		end
 	else
 		if $sex_ev['type'] = 'hookup':
-			gs'sex_ev_hookup_leave', 'gotta_go'
+			gs 'sex_ev_hookup_leave', 'gotta_go'
 		else
-			act'Get dressed':gt'sex_ev_leave', 'dressing1'
+			act 'Get dressed': gt 'sex_ev_leave', 'dressing1'
 		end
 	end
 	if sex_ev['npc_late'] ! 1 and $clothingworntype = 'nude' and sex_ev['boy_in_shower'] ! 1:
@@ -1853,7 +1853,7 @@ if $ARGS[0] = 'birth_control_pill_take':
 		act'Take your birth control':
 			birth_control['message_skip'] = daystart
 			sex_ev['bc_take'] = 1
-			gs'fertility','birth_control', 1
+			gs 'din_bad', 'quick_takepill'
 			cla & *clr
 			$sex_ev['bed_room']
 			if birth_control['remind_hour'] > 0 and hour >= birth_control['remind_hour'] and hour <= birth_control['remind_hour'] + 1 and tabletkiday ! daystart and sex_ev['bc_take'] ! 1:
@@ -2330,10 +2330,10 @@ if $ARGS[0] = 'sore_pussy_msg':
 end
 
 if $ARGS[0] = 'sleep':
-	act'Fall asleep':
+	act 'Fall asleep':
 		cla & *nl
 		'You lay there, your eyelids slowly grow heavier until they close completely and your consciousness drifts slowly into darkness...'
-		act'. . .':gt'sex_ev_after', 'sleep_function'
+		act '. . .': gt 'sex_ev_after', 'sleep_function'
 	end
 end
 
@@ -2364,10 +2364,10 @@ if $ARGS[0] = 'sleep_function':
 		else
 			sex_ev['sleepover'] = 1
 			if alko > 6:
-				gs'sleep', 'simple'
-				gs'pain', 3, 'head', 'ache'
+				gs 'sleep_simple', 'simple'
+				gs 'pain', 3, 'head', 'ache'
 			else
-				gs'sleep', 'simple'
+				gs 'sleep_simple', 'simple'
 			end
 			sex_ev['extra_cum'] += npc_sexdrive[$boy]
 			sex_ev['wake_fuck'] = 1
@@ -2377,14 +2377,14 @@ if $ARGS[0] = 'sleep_function':
 		sex_ev['sleepover'] = 1
 		if alko > 6:
 			sex_ev['hangover'] = 1
-			gs'sleep', 'simple'
-			gs'pain', 3, 'head', 'ache'
+			gs 'sleep_simple', 'simple'
+			gs 'pain', 3, 'head', 'ache'
 		else
-			gs'sleep', 'simple'
+			gs 'sleep_simple', 'simple'
 		end
 
 		if mid($start_type,1,2) = 'sg' and func('homes_properties', 'has_access', 'parents_home'): sveta_punishment['no_come_home'] = 1
-		gt'sex_ev_wakeup', 'start'
+		gt 'sex_ev_wakeup', 'start'
 	end
 	
 	if npc_latesleeper[$boy] = 0 and npc_caretaker[$boy] = 1 and rand(1,4) < 4 and $sex_ev['loc'] ! 'hotel_room':
@@ -2401,14 +2401,14 @@ if $ARGS[0] = 'sleep_function':
 	end
 	
 	if sex_ev['wake_fuck'] = 1:
-		gt'sex_ev_sex', 'wakeup_sex'
+		gt 'sex_ev_sex', 'wakeup_sex'
 	elseif sex_ev['sleep_fuck'] = 0:
-		gt'sex_ev_wakeup', 'start'
+		gt 'sex_ev_wakeup', 'start'
 	elseif sex_ev['sleep_fuck'] = 1:
-		gt'sex_ev_sex', 'sleep_sex'
+		gt 'sex_ev_sex', 'sleep_sex'
 	else
 		!! failsafe option
-		gt'sex_ev_wakeup', 'start'
+		gt 'sex_ev_wakeup', 'start'
 	end
 end
 --- sex_ev_after ---------------------------------

+ 2 - 2
locations/sex_ev_wakeup.qsrc

@@ -12,7 +12,7 @@ if $ARGS[0] = 'start':
 !!		end
 	else
 		'<center><video autoplay loop src="images/shared/romance/misc/wakeup1.mp4"></video></center>'
-		if budilnikOn = 0:
+		if alarmVars['alarmOn'] = 0:
 			!!{	if hangover = daystart:
 				'A loud sound pierces your consciousness like a spear through the brain, bringing you out of sleep. You wake up blearily, head <i>pounding</i> with an awful hangover, as you look around in bewilderment at what is making that awful sound, only to find it is your phone alarm going off.'
 				act'<i>Ugh, my head</i>':gt'sex_ev_morning', 'hangover'
@@ -64,7 +64,7 @@ end
 
 if $ARGS[0] = 'wake_alone':
 	'<center><video autoplay loop src="images/shared/romance/misc/wakeup1.mp4"></video></center>'
-	if budilnikOn = 0:
+	if alarmVars['alarmOn'] = 0:
 		!!{	if hangover = daystart:
 			'A loud sound pierces your consciousness like a spear through the brain, bringing you out of sleep. You wake up blearily, head <i>pounding</i> with an awful hangover, as you look around in bewilderment at what is making that awful sound, only to find it is your phone alarm going off.'
 		else}

+ 85 - 696
locations/sleep.qsrc

@@ -1,394 +1,133 @@
 # sleep
+$sleep_loc = 'sleep'
+menu_off = 1
 
-if $ARGS[0] = 'simple':
-!! to avoid sleeping the whole day I decide to calculate the duration of the sleep in advance
-!! the quality of the sleep depends on many factors, so the time of sleep can be modify later, especially the part when the time of sleep is shortened
+!! Deals with the sleep cycle, advancing both time and stats during sleep.
+!!
+!! Moved here from dream_events
+!! When busy moves back and forth to sleep_events (and can be redirected from there)
+!! When done: Move to wakeup
 
-	varsleep['time_to_full'] = (100 - pcs_sleep) * 6
-!! fully exhausted Sveta can recover in 420 minutes = 7 hours of sleep
-!! healthy Sveta can hardly sleep more then 10 hours = 600 minutes
-!! so we can add about 3 hours to time to full as a limit
-	varsleep['time_to_full'] += 150 + rand(0,60)
-
-	varsleep['time_now'] = daystart*1440 + hour * 60 + minut
-	varsleep['alarm_time_end'] = daystart*1440 + timerEnd * 60 + timerEndM
-	if varsleep['time_now'] >= varsleep['alarm_time_end']: varsleep['alarm_time_end'] += 1440
-	varsleep['alarm_time'] = daystart*1440 + timer * 60 + timerM
-	if varsleep['time_now'] >= varsleep['alarm_time']: varsleep['alarm_time'] += 1440
-	if budilnikOn = 1:
-		varsleep['minutes to wakeup'] = min(varsleep['time_to_full'], varsleep['alarm_time'] - varsleep['time_now'])
-		varsleep['minutes to wakeup end'] = min(varsleep['time_to_full'], varsleep['alarm_time_end'] - varsleep['time_now'])
-	else
-		varsleep['minutes to wakeup'] = varsleep['time_to_full']
-		varsleep['minutes to wakeup end'] = varsleep['time_to_full']
-	end
+if $ARGS[0] = 'full':
+	msg 'gt ''sleep'', ''full'' is depricated! Please report this bug.'
+	gt 'pre_sleep_events', 'start'
+end
 
-	InSleep = 1
-	:loopson_sleep
-	minut += 1
-	stime += 1
-	if recuperation = 0:pcs_health += 5
+if $ARGS[0] = 'sleep':
+	msg 'gt ''sleep'', ''sleep'' is depricated! Please report this bug.'
+	gt 'pre_sleep', 'prepare_sleep'
+end
 
-	if stime >= 60:
-		stime = 0
-		pcs_sleep += 15
-		gs 'stat'
-	end
+if $ARGS[0] = 'dream':
+	msg 'gt ''sleep'', ''dream'' is depricated! Please report this bug.'
+	gt 'dream_events', 'start'
+end
 
-	varsleep['minutes to wakeup'] -= 1
-	varsleep['minutes to wakeup end'] -= 1
-
-	if alarm_holiday = 1 and kanikuli > 0:
-	!! use weekend time alarm
-		varsleep['alarm_time'] = daystart*1440 + timerEnd * 60 + timerEndM
-		if varsleep['minutes to wakeup end'] > 0:jump 'loopson_sleep'
-	elseif week > 5:
-	!! use weeken time alarm
-		varsleep['alarm_time'] = daystart*1440 + timerEnd * 60 + timerEndM
-		if varsleep['minutes to wakeup end'] > 0:jump 'loopson_sleep'
-	else
-		varsleep['alarm_time'] = daystart*1440 + timer * 60 + timerM
-		if varsleep['minutes to wakeup'] > 0:jump 'loopson_sleep'
-	end
-	varsleep['time_now'] = daystart*1440 + hour * 60 + minut
-	InSleep = 0
-	gs'stat'
+if $ARGS[0] = 'wake':
+	msg 'gt ''sleep'', ''wake'' is depricated! Please report this bug.'
+	gt 'wakeup', 'start'
 end
 
-if $ARGS[0] = 'full':
-	if succubusQW = 2:
-		act '<<$sleep_txt>>':
-			if clo_flag['bed'] = 0:
-				clo_flag['bed'] = 1
-				$lastwornclothingtype['bed'] = $clothingworntype
-				lastwornclothingnumber['bed'] = clothingwornnumber
-				$lastwornpantytype['bed'] = $pantyworntype
-				lastwornpantynumber['bed'] = pantywornnumber
-				$lastwornbratype['bed'] = $braworntype
-				lastwornbranumber['bed'] = brawornnumber
-			end
-			menu_off = 1
-			if bedPanty = 2:
-				gs 'underwear', 'remove'
-			elseif bedPanty = 1:
-				gs 'underwear', 'wear'
-			end
-			if $clothingworntype ! 'nude':
-				strip_here = 1
-				gs 'clothing', 'strip'
-			end
-			gt 'sleep', 'succhoice'
-		end
-	else
-		act '<<$sleep_txt>>':
-			if clo_flag['bed'] = 0:
-				clo_flag['bed'] = 1
-				$lastwornclothingtype['bed'] = $clothingworntype
-				lastwornclothingnumber['bed'] = clothingwornnumber
-				$lastwornpantytype['bed'] = $pantyworntype
-				lastwornpantynumber['bed'] = pantywornnumber
-				$lastwornbratype['bed'] = $braworntype
-				lastwornbranumber['bed'] = brawornnumber
-			end
-			menu_off = 1
-			if bedPanty = 2:
-				gs 'underwear', 'remove'
-			elseif bedPanty = 1:
-				gs 'underwear', 'wear'
-			end
-			if disable_autosave = 0:
-				if mid($start_type,1,4) = 'city':
-					savegame 'autosave_city.sav'
-				elseif mid($start_type,1,3) = 'uni':
-					savegame 'autosave_uni.sav'
-				else
-					savegame 'autosave_sg.sav'
-				end
-			end
-			if $clothingworntype ! 'nude':
-				strip_here = 1
-				gs 'clothing', 'strip'
-			end
-			if magf2bdo = 2:
-				gt 'sleep', 'magbstchoice'
-			else
-				gt 'sleep', 'sleep'
-			end
-		end
-		killvar '$sleep_txt'
-	end
+if $ARGS[0] = 'end':
+	msg 'gt ''sleep'', ''end'' is depricated! Please report this bug.'
+	gt 'bed_get_out', 'start'
 end
 
 
-if $ARGS[0] = 'nap_bed':
-	act 'Take a nap (1:00)':
-		if pcs_sleep >= 10 and pcs_sleep <= 90:
-			cla
-			InSleep = 1
-			pcs_sleep += 10
-			pcs_health += 5
-			minut += 60
-			gs 'stat'
-			*nl
-			'You sleep about an hour.'
-			act 'Get up': InSleep = 0 & gt $loc, $loc_arg
-		elseif pcs_sleep < 10:
-			gt 'sleep', 'sleep'
-		else
-			cla
-			minut += 5
-			gs 'stat'
-			*nl
-			'You are not tired enough to sleep, even for a short nap.'
-			act 'Get up': gt $loc, $loc_arg
-		end
-	end
-end
 
-if $ARGS[0] = 'sleep':
-	*clr & cla
-	menu_off = 1
-	if $clothingworntype ! 'nude':
-		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
-	else
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
-	end
-	gs 'stat'
-	*nl
-	if budilnikOn = 1 and ((hour => timer and week + 1 < 6) or (hour < timer and week < 6)):
-		'You run through your regular nightly routine, setting your alarm for <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b>, you undress, and prepare for sleep:'
-	elseif budilnikOn = 1 and alarm_holiday = 1 and (week > 5 or kanikuli > 0):
-		'You run through your regular nightly routine, setting your alarm for <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b>, you undress, and prepare for sleep:'
-	elseif budilnikOn = 1 and (week > 5):
-		'You run through your regular nightly routine, setting your alarm for <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b>, you undress, and prepare for sleep:'
-	elseif budilnikOn = 1:
-		'You run through your regular nightly routine, setting your alarm for <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b>, you undress, and prepare for sleep:'
-	else
-		'You run through your regular nightly routine, not bothering to setting your alarm, you undress, and prepare for sleep:'
-	end
-	pcs_hairbsh = 0
-	pain['killer'] = 0
-	if mid($start_type,1,2) = 'sg' and $loc ! 'bedrPar' and SchoolAtestat = 0:
-		notathomesleep += 1
-	else
-		notathomesleep = 0
-	end
 
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+!! to avoid sleeping the whole day I decide to calcululate the duration of the sleep in advance
+!! the quality of the sleep depends on many factors, so the time of sleep can be modify later, especially the part when the time of sleep is shortened
 
-	if succubusflag = 1 and sucwalkday <= daystart and (succhungry < (0 - 1 - succublvl) or pcs_willpwr < ((succublvl * willpowermax) / 13) or sucpowzeroed >= 3): gs 'succubus', 'sucwalkinginit'
+	sleepVars['time_to_full'] = (100 - pcs_sleep) * 6
+!! fully exhausted Sveta can recover in 420 minutes = 7 hours of sleep
+!! healthy Sveta can hardly sleep more then 10 hours = 600 minutes
+!! so we can add about 3 hours to time to full as a limit
+	sleepVars['time_to_full'] += 150 + rand(0, 60)
 
-	if analplugIN = 1 and vibratorIN = 1:
-		if bedAnal = 1 and bedVibrator = 1:
-			analplugIN = 0
-			vibratorIN = 0
-			gs 'stat'
-			*nl
-			'You remove your butt plug and your vibrator.'
-		elseif bedAnal = 0 and bedVibrator = 0:
-			*nl
-			'You decide to leave your butt plug and vibrator in.'
-		elseif bedAnal = 1 and bedVibrator = 0:
-			vibratorIN = 0
-			gs 'stat'
-			*nl
-			'You decide to leave your butt plug in, but remove your vibrator.'
-		elseif bedAnal = 0 and bedVibrator = 1:
-			analplugIN = 0
-			gs 'stat'
-			*nl
-			'You decide to remove your butt plug, but leave your vibrator in.'
-		end
-	elseif analplugIN = 1 and vibratorIN = 0:
-		if bedAnal = 1:
-			analplugIN = 0
-			gs 'stat'
-			*nl
-			'You remove your butt plug.'
-		elseif bedAnal = 0:
-			*nl
-			'You decide to leave your butt plug in.'
-		end
-	elseif analplugIN = 0 and vibratorIN = 1:
-		if bedVibrator = 1:
-			vibratorIN = 0
-			*nl
-			'You remove your vibrator.'
-		elseif bedVibrator = 0:
-			*nl
-			'You decide to leave your vibrator in.'
-		end
-	end
-	if $shoeworntype = 'none':
-		$bed['shoetype'] = 'none'
-	else
-		$bed['shoetype'] = $shoeworntype
-		bed['shoenumber'] = shoewornnumber
-!!		gs 'shoes', 'strip'
-	end
-	if bedPanty = 1:
-		if $pantyworntype = 'none' and $braworntype = 'none':
-			*nl
-			'You put on your bra and panties.'
-		elseif $pantyworntype ! 'none' and $braworntype = 'none':
-			*nl
-			'You put on your bra.'
-		elseif $pantyworntype ! 'none' and $braworntype ! 'none':
-			*nl
-			'You put on your panties.'
+	sleepVars['time_now'] = daystart * 1440 + hour * 60 + minut
+
+	if alarmVars['alarmOn'] = 1:
+		if alarm_holiday = 1 and kanikuli ! 0 or ((hour < alarmVars['timerEndH'] and (week = 6 or week = 7)) or (hour => alarmVars['timerEndH'] and (week = 5 or week = 6))):
+		!! use weekend time alarm
+			sleepVars['alarm_time'] = daystart * 1440 + alarmVars['timerEndH'] * 60 + alarmVars['timerEndM']
+			if sleepVars['time_now'] >= sleepVars['alarm_time']: sleepVars['alarm_time'] += 1440
+			sleepVars['minutes to wakeup'] = min(sleepVars['time_to_full'], sleepVars['alarm_time_end'] - sleepVars['time_now'])
 		else
-			*nl
-			'You change your bra and panties.'
-		end
-	elseif bedPanty = 2:
-		if $pantyworntype ! 'none' or $braworntype ! 'none':
-			*nl
-			'You remove your bra and panties.'
-		elseif $pantyworntype ! 'none' and $braworntype = 'none':
-			*nl
-			'You remove your panties.'
-		elseif $braworntype ! 'none':
-			*nl
-			'You remove your bra.'
+			sleepVars['alarm_time'] = daystart * 1440 + alarmVars['timerH'] * 60 + alarmVars['timerM']
+			if sleepVars['time_now'] >= sleepVars['alarm_time']: sleepVars['alarm_time'] += 1440
+			sleepVars['minutes to wakeup'] = min(sleepVars['time_to_full'], sleepVars['alarm_time'] - sleepVars['time_now'])
 		end
 	else
-		*nl
-		'You were too tired to worry about your underwear, so for tonight you left it as is.'
-	end
-
-	if $hairstyle ! '' :
-		*nl
-		$hairstyle
-	else
-		*nl
-		'Your hair is loose and free.'
+		sleepVars['minutes to wakeup'] = sleepVars['time_to_full']
 	end
 
-	if pcs_makeup > 1 and cosmetic_tattoo = 0:
-		pcs_makeup = 0
-		vidageday -= 1
-		gs 'body', 'SkinLoss', 'MakeUpSleep'
-		*nl
-		'You went to bed wearing your makeup, which will smear your face as you sleep; your skin will age faster from this!'
-	end
-	if fat > 5 and stringimplant = 1: silicone += 1 & fat -= 5
-	act 'Sleep...':
-	!!flag to stop autosave breaking my awesome clothing thingy
-		clo_flag['bed'] = 0
-		gt 'sleep', 'dream'
-	end
+	xgt 'sleep', 'sleep_loop'
 end
 
-if $ARGS[0] = 'dream':
-
-	if $loc = 'nichBedroomServant':
-		gs 'nichBedroomServant', 'sleepEvents'
+if $ARGS[0] = 'sleep_handler':
+	if sleepVars['minutes to wakeup'] > 0:
+		xgt 'sleep', 'sleep_loop'
+	else
+		xgt 'sleep', 'post_sleep'
 	end
+end
 
-	*clr & cla
-	menu_off = 1
-	InSleep = 1
-	gs 'stat'
-	gs 'dreams', 'start'
-	wake_up = 0
-!! to avoid sleeping the whole day I decide to calcululate the duration of the sleep in advance
-!! the quality of the sleep depends on many factors, so the time of sleep can be modify later, especially the part when the time of sleep is shortened
 
-	varsleep['time_to_full'] = (100 - pcs_sleep) * 6
-!! fully exhausted Sveta can recover in 420 minutes = 7 hours of sleep
-!! healthy Sveta can hardly sleep more then 10 hours = 600 minutes
-!! so we can add about 3 hours to time to full as a limit
-	varsleep['time_to_full'] += 150 + rand(0,60)
-
-	varsleep['time_now'] = daystart*1440 + hour * 60 + minut
-	varsleep['alarm_time_end'] = daystart*1440 + timerEnd * 60 + timerEndM
-	if varsleep['time_now'] >= varsleep['alarm_time_end']: varsleep['alarm_time_end'] += 1440
-	varsleep['alarm_time'] = daystart*1440 + timer * 60 + timerM
-	if varsleep['time_now'] >= varsleep['alarm_time']: varsleep['alarm_time'] += 1440
-	if budilnikOn = 1:
-		varsleep['minutes to wakeup'] = min(varsleep['time_to_full'], varsleep['alarm_time'] - varsleep['time_now'])
-		varsleep['minutes to wakeup end'] = min(varsleep['time_to_full'], varsleep['alarm_time_end'] - varsleep['time_now'])
-	else
-		varsleep['minutes to wakeup'] = varsleep['time_to_full']
-		varsleep['minutes to wakeup end'] = varsleep['time_to_full']
-	end
-	:loopson_bed
+if $ARGS[0] = 'sleep_loop':
+	:sleep_loop_loop
 		minut += 1
-		stime += 1
-		if recuperation = 0:pcs_health += 5
+		sleepVars['stime'] += 1
+		sleepVars['minutes to wakeup'] -= 1
+		sleepVars['time_to_full'] -= 1
+
+		if recuperation = 0: pcs_health += 5
 
 		if vibratorIN = 1:
-			vtime += 1
-			if vtime >= 5:
+			sleepVars['vtime'] += 1
+			if sleepVars['vtime'] >= 5:
 				pcs_horny +=1
-				vtime = 0
-			end
-
-			if pcs_horny = 100:
-				*clr & cla
-				pcs_horny = 0
-				orgasm += 1
-				minut += 5
-				gs 'stat'
-				'<center><img <<$set_imgh>> src="images/shared/sex/oface/o_face.jpg"></center>'
-				*nl
-				'You abruptly wake up in the throes of an orgasm. As you recover, you check the time, <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>.'
-
-				act 'Go back to sleep':
-					*clr & cla
-					gt 'sleep', 'dream'
-				end
-
-				act 'Give up trying to sleep':
-					*clr & cla
-					'<center><img <<$set_imgh>> src="images/shared/sex/oface/kotovfirst1.jpg"></center>'
-					*nl
-					'Maybe trying to sleep with a vibrator in your pussy wasn''t such a good idea.'
-					gs 'sleep', 'wake'
-				end
-
-				exit
+				sleepVars['vtime'] = 0
 			end
-		!! Exclusions for succubus dreams as they set horny to 100 and will always get overridden otherwise
-		elseif pcs_horny > 80 and pcs_sleep >= 30 and rand (1,300) = 300 and succubusQW ! 1 and succubusQW ! 2:
-			gs 'stat'
-			$waketext = 'You glance at your alarm clock. It reads <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>.'
-			gt 'sleep', 'wake_horny'
 		end
 
-		if stime >= 60:
-			stime = 0
+		if sleepVars['stime'] >= 60:
+			sleepVars['stime'] = 0
 			pcs_sleep += 15
+
 			if pcs_sleep >= 100:
 				pcs_condition['lack_of_sleep'] = 0
 			elseif pcs_condition['lack_of_sleep'] > 0:
 				pcs_condition['lack_of_sleep'] -= 1
 			end
+
 			gs 'stat'
 		end
 
 		if minut = 60: gs 'stat'
 
-		varsleep['minutes to wakeup'] -= 1
-		varsleep['minutes to wakeup end'] -= 1
-
-		if alarm_holiday = 1 and kanikuli > 0:
-		!! use weekend time alarm
-			varsleep['alarm_time'] = daystart*1440 + timerEnd * 60 + timerEndM
-			if varsleep['minutes to wakeup end'] = 0: wake_up = 1
-		elseif week > 5:
-		!! use weeken time alarm
-			varsleep['alarm_time'] = daystart*1440 + timerEnd * 60 + timerEndM
-			if varsleep['minutes to wakeup end'] = 0: wake_up = 1
-		else
-			varsleep['alarm_time'] = daystart*1440 + timer * 60 + timerM
-			if varsleep['minutes to wakeup'] = 0: wake_up = 1
+		gs 'sleep', 'mod_triggers'
+		
+		if minute mod 5 = 0:
+			gs 'sleep_events', 'start'
 		end
 
-		varsleep['time_now'] = daystart*1440 + hour * 60 + minut
+	if sleepVars['minutes to wakeup'] > 0: jump 'sleep_loop_loop'
+
+	killvar 'sleep_loop_loop'
+	xgt 'sleep', 'post_sleep'
+end
+
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
+end
 
-	!! Ensuring single exit point instead of multiple ones.
-	if wake_up = 0: jump 'loopson_bed'
 
+if $ARGS[0] = 'post_sleep':
 	if pcs_condition['lack_of_sleep'] >= 10:
 	!!Worsening of skin quality if you do not sleep enough.
 		skinDailyPenalty += 2
@@ -399,373 +138,23 @@ if $ARGS[0] = 'dream':
 	else
 		skinDailyPenalty -= 1
 	end
-
-	gs 'stat'
-	if slept_in = 1:
-		$waketext = 'You wake up at <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>, after sleeping-in a little longer than planned, but at least you''ve had plenty of sleep.'
-	elseif pcs_sleep >= 100 and budilnikOn = 1 and varsleep['time_now'] >= varsleep['alarm_time']:
-		$waketext = 'You wake up at <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>, just before your alarm goes off. You''ve had plenty of sleep.'
-	elseif pcs_sleep >= 100:
-		$waketext = 'You wake up at <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>, no longer tired and ready to start the day with plenty of sleep.'
-	elseif budilnikOn = 1 and varsleep['time_now'] = varsleep['alarm_time']:
-		pcs_mood -= 10
-		$waketext = 'Your alarm goes off at <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>, '+iif(pcs_sleep < 90, 'but you could do with some extra sleep.', 'and you''ve had plenty of sleep.')+''
-		gs 'sleep', 'extra'
-	else
-		!! I do not think that it could go here
-		$waketext = ''
-	end
-
-	gs 'sleep', 'wake'
-	*nl
-	'<<$waketext>>'
-
-	killvar 'wake_up'
-end
-
-if $ARGS[0] = 'wake_horny':
-	cla
-	menu_off = 1
-	InSleep = 1
-	SleepHorny += 1
 	gs 'stat'
-	if $pantyworntype = 'none':
-		if SleepHorny = 1:
-			'<center><img <<$set_imgh>> src="images/shared/home/sleep_horny.jpg"></center>'
-		elseif SleepHorny = 2:
-			'<center><img <<$set_imgh>> src="images/shared/sex/mast/klit.jpg"></center>'
-		elseif SleepHorny >= 3:
-			'<center><img <<$set_imgh>> src="images/shared/sex/oface/kotovfirst1.jpg"></center>'
-		end
-	else
-		if SleepHorny = 1:
-			'<center><img <<$set_imgh>> src="images/shared/sex/mast/start.jpg"></center>'
-		elseif SleepHorny = 2:
-			'<center><img <<$set_imgh>> src="images/shared/sex/undress/kiska.jpg"></center>'
-		elseif SleepHorny >= 3:
-			'<center><img <<$set_imgh>> src="images/shared/sex/oface/kotovfirst1.jpg"></center>'
-		end
-	end
-	*nl
-	'<<$waketext>>'
-	*nl
-	if SleepHorny = 1:
-		'Your wet dream and overall horniness rouse you from your sleep. From one moment to the next, you are wide awake and very much aware that your pussy is hot and wet.'
-		*nl
-		'You could try and go back to sleep, of course, but it''s doubtful that you would find this kind of sleep very restful; not to mention the frustration that comes with ignoring your needs, but masturbating is an option, too, and not the worst one in this situation. It might take some time, but you''d be able to sleep like a baby after.'
-		*nl
-		'Of course, you could always just give up on trying to sleep and just get up.'
-	elseif SleepHorny = 2:
-		'You''re so horny that you''ve woken a second time. Your pussy is still wet and wanting attention.'
-		*nl
-		'You could try and get back to sleep again, but it''s doubtful that you will get much sleep, and continuously ignoring your needs won''t help; maybe you should masturbate, and make the most of the time that''s left.'
-		*nl
-		'Soon you will have to get up one way or another.'
-	elseif SleepHorny >= 3:
-		'Once again your horniness has roused you from your sleep. This is getting ridiculous! You are finding it very difficult to get any sleep at all.'
-		*nl
-		'Going back to sleep almost feels like a waste of time at this point;  you won''t get much rest at all, at least until you fix the problem.'
-		*nl
-		if $pantyworntype ! 'none':
-			gs 'underwear', 'remove'
-			'You''ve removed  your underwear, as your panties were soaked through.'
-			*nl
-		end
-		'Maybe you should just get up.'
-	end
-	if $loc = 'bedrPar' and sisterLesb = 6 and hour < 6:
-		*nl
-		'Or... you could wake up Anya and see if your dearest sister would be willing to help you with that.'
-	elseif $loc = 'FedorEv4':
-		*nl
-		'Or... you could wake up Fedor and see if your boyfriend can''t help you with that.'
-	elseif $loc = 'bedr' and husband > 0:
-		*nl
-		'Or... you could wake up <<$husName>> and see if your husband can''t help you with that.'
-	end
-
-	act 'Try and go back to sleep':
-		pcs_mood -= 10
-		pcs_sleep -= 5
-		gt 'sleep', 'dream'
-	end
-
-	act 'Masturbate': InSleep = 0 & gt 'selfplay', 'start'
 
-	act 'Get out of bed (0:10)':
-		minut += 10
-		gs 'sleep', 'end'
-	end
-	if strip_here = 1:
-		act 'Get out of bed and get dressed (0:15)':
-			minut += 15
-			gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
-			gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
-			gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
-			if $bed['shoetype'] ! 'none':
-				gs 'shoes', 'wear', $bed['shoetype'], bed['shoenumber']
-			end
-			gs 'sleep', 'end'
-		end
-	end
-
-	if $loc = 'bedrPar' and sisterLesb = 6 and hour < 6:
-		act 'Wake Anya and see if she''s in the mood': strip_here = 0 & InSleep = 0 & gt 'sistersleep', 'sister_sleep'
-	elseif $loc = 'FedorEv4':
-		act 'Wake Fedor and see if he''s in the mood': strip_here = 0 & InSleep = 0 & gt 'FedorEv4', 'Bedroom 1'
-		!!Intro text doesn''t quite fit event (but doesn''t quite fit - try for baby - scenario either) - custom scene from VK?
-	elseif ($loc = 'bedr' or $loc = 'bedr2x') and husband > 0:
-		act 'Wake your husband and see if he''s in the mood': strip_here = 0 & InSleep = 0 & gt 'husbSex', 'variant'
-		!!Should be custom scene - maybe boyfriend/husband overhaul can cover this?
-	end
+	xgt 'wakeup', 'start'
 end
 
-if $ARGS[0] = 'wake':
-	if mid($start_type,1,2) = 'sg' and locat['Fam_inGad'] = 0 and motherQW['bathroom_dildos'] > 0 and MarishaQW["marisha_sleepover"] = 0:gt'mother_sextalk','dildo_wakeup1'
-	menu_off = 1
-	InSleep = 1
-	gs 'stat'
-	InSleepWake = hour + 1
-	InSleepWake[1] = daystart
-    if vomit['hangover'] = 1  or vomit['unlucky'] = 1 or vomit['morning_sick'] = 1:
-        gs 'home_activity', 'vomiting_check'
-    end
-	if MarishaQW["marisha_sleepover"] = 1: gs 'marisha_ev', 'morning'
-	if daystart < 10 and $start_type[1] = 'tg':'The first thing you think as you wake up is, "Damn! It''s is not a dream, I really am a woman now."'
-	if daystart >= 10 and daystart < 30 and $start_type[1] = 'tg':'Looking at your female body, you are still a little surprised it''s actually you.'
-	if slept_in = 1 and kanikuli = 0 and mid($start_type,1,2) = 'sg' and SchoolAtestat = 0 and SchoolBlock = 0 and week < 6 and hour >= 9 and hour < 14 and suspended['on'] ! 1:
-		if schoolprogul > 2 and schoolPredupr = 2:
-			pcs_mood -= 35
-			gs 'stat'
-			msg '<center>Damn it''s <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be furious. I don''t know what she might do...</center>'
-		elseif schoolprogul > 2 and schoolPredupr = 1:
-			pcs_mood -= 30
-			gs 'stat'
-			msg '<center>Damn it''s <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be very angry if I miss another day of school.</center>'
-		elseif schoolprogul > 2 and schoolPredupr = 0:
-			pcs_mood -= 25
-			gs 'stat'
-			msg '<center>Damn it''s <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be angry to find out I missed a day of school.</center>'
-		else
-			pcs_mood -= 20
-			gs 'stat'
-			msg '<center>Damn it''s <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be very upset if I''m not at school every day.</center>'
-		end
-	end
-	if kanikuli = 0 and mid($start_type,1,2) = 'sg' and SchoolAtestat = 0 and SchoolBlock = 0 and week < 6 and hour >= 4 and hour < 9:
-		if slept_in = 1 and (hour = 7 or hour = 8) and suspended['on'] ! 1:
-			pcs_mood -= 10
-			gs 'stat'
-			msg '<center>Damn it''s <b><<$mid(100+hour,2,2)>>:<<$mid(100+minut,2,2)>></b>, you''ve slept too long! You need to hurry or you''re going to be late for school!</center>'
-		end
-		act 'Get out of bed and get dressed for school (0:15)':
-			minut += 15
-			gs 'wardrobe', 'school_outfit'
-			gs 'sleep', 'end'
-		end
-	end
-
-	if strip_here = 1:
-		act 'Get out of bed and get dressed (0:15)':
-			minut += 15
-			gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
-			gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
-			gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
-			if $bed['shoetype'] ! 'none':
-				gs 'shoes', 'wear', $bed['shoetype'], bed['shoenumber']
-			end
-			gs 'sleep', 'end'
-		end
-	end
-	if enfullmorrout = 1 and hour >= 4 and hour < 12:
-		act 'Full morning routine (01:00)':
-			minut += 15
-			fullmorrout = 1
-			gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
-			gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
-			gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
-			if $bed['shoetype'] ! 'none':
-				gs 'shoes', 'wear', $bed['shoetype'], bed['shoenumber']
-			end
-			gs 'sleep', 'end'
-		end
-		if kanikuli = 0 and mid($start_type,1,2) = 'sg' and SchoolAtestat = 0 and SchoolBlock = 0 and week < 6 and hour >= 4 and hour < 9 and suspended['on'] ! 1:
-			act 'Full morning routine for School (01:00)':
-				fullmorrout = 1
-				minut += 15
-				gs 'wardrobe', 'school_outfit'
-				gs 'sleep', 'end'
-			end
-		end
-	end
-
-	act 'Get out of bed (0:10)':
-		minut += 10
-		slept_in = 0
-		gs 'sleep', 'end'
-	end
-end
 
 if $ARGS[0] = 'extra':
 	act '"Snooze" a few minutes more...':
 		menu_off = 1
 		slept_in = 1
 		gs 'stat'
-		gt 'sleep', 'dream'
+		gt 'sleep', 'start'
 	end
 end
 
-if $ARGS[0] = 'end':
-	menu_off = 1
-	minut -= 1
-	InSleep = 0
-	slept_in = 0
-	strip_here = 0
-	SleepHorny = 0
-	!! to fudge the first hour wake up sleep loss.
-    if fullmorrout = 1 and $loc = 'bedrPar':
-		gt 'vanrPar'
-	elseif fullmorrout = 1 and $loc = 'bedr':
-		gt 'vanr'
-    elseif vomit['morning_sick'] = 1 or vomit['hangover'] = 1 or vomit['unlucky'] = 1:
-        gt 'home_activity', 'vomiting_exit'
-	else
-		gt $loc, $loc_arg
-	end
-end
 
-if $ARGS[0] = 'succhoice':
-	menu_off = 1
-	minut += 15
-	gs 'stat'
-	cla
-	if $clothingworntype ! 'nude':
-		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
-	else
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
-	end
-	''
-	'You toss and turn for a while, but the energy that has been buzzing under your skin since that dream just won''t let you sleep.'
-	''
-	'Thinking about it you realize that you could push the energy out or pull it in!'
-	''
-	'<font color="red"><b>You also feel that both are <i>permanent</i> choices.</b></font>'
-	act 'Try to ignore it and go to sleep':
-		if disable_autosave = 0:
-			if mid($start_type,1,4) = 'city':
-				savegame 'autosave_city.sav'
-			elseif mid($start_type,1,3) = 'uni':
-				savegame 'autosave_uni.sav'
-			else
-				savegame 'autosave_sg.sav'
-			end
-		end
-		gt 'sleep', 'sleep'
-	end
-	act 'Push the Energy out for all time': gt 'sleep', 'succhoiceNO'
-	act 'Pull the Energy in and let it change you permanently': gt 'sleep', 'succhoiceYES'
-end
 
-if $ARGS[0] = 'succhoiceNO':
-	cla
-	menu_off = 1
-	if $clothingworntype ! 'nude':
-		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
-	else
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
-	end
-	''
-	'You push the energy out of you and it dissipates.'
-	succubusQW = 3
-	pcs_horny = 0
-	minut +=5
-	gs 'stat'
-	act 'Go to sleep':
-		if disable_autosave = 0:
-			if mid($start_type,1,4) = 'city':
-				savegame 'autosave_city.sav'
-			elseif mid($start_type,1,3) = 'uni':
-				savegame 'autosave_uni.sav'
-			else
-				savegame 'autosave_sg.sav'
-			end
-		end
-		gt 'sleep', 'sleep'
-	end
-end
 
-if $ARGS[0] = 'succhoiceYES':
-	cla
-	menu_off = 1
-	if $clothingworntype ! 'nude':
-		'<center><img <<$set_imgh>> src="images/shared/home/bed.jpg"></center>'
-	else
-		'<center><img <<$set_imgh>> src="images/shared/home/bedroom/son.jpg"></center>'
-	end
-	succubusQW = 4
-	''
-	'You pull the energy deeper into yourself and hold it there.'
-	''
-	'Then you feel pressure building...'
-	wait 450
-	minut += 5
-	gs 'stat'
-	'BUILDING...'
-	wait 450
-	minut += 5
-	gs 'stat'
-	'<b>BUILDING...</b>'
-	wait 450
-	minut += 5
-	gs 'stat'
-	'Power bursts through your body causing you to hop out of bed.'
-	act 'Continue': gt 'sleep', 'succubinit'
-end
-
-if $ARGS[0] = 'succubinit':
-	*clr & cla
-	menu_off = 1
-	minut += 10
-	gs 'stat'
-	!!Sets the succubus flag, succubus level (succublvl), Initial lesbian sex count (suclezsnapshot), initial Succubus hunger (succhungry),
-	!! & the succubus descriptor ($sucself1). The -2 on succhungry is to give th PC 2 days to get in the Succubus grove.
-	succubusflag = 1
-	succublvl = 1
-	suclezsnapshot = lesbian
-	succhungry = -2
-	sucwalkday = daystart + 2 + rand(0,5)
-	$sucself1 = 'that feeling'
-	pcs_horny = 100
-	InSleep = 0
-	slept_in = 0
-	strip_here = 0
-	'<center><img <<$set_imgh>> src="images/pc/body/succubusself.jpg"></center>'
-	*nl
-	'<font color="red">You feel the power flowing around your body for several minutes, leaking through your skin and making changes all throughout you, before fading to a presence deep in your core leaving you looking the same as before... but feeling so different! </font>'
-
-	if preg = 1:
-		gs 'medical_din', 'remove_preg'
-		RecovH = 0
-	end
-
-	act 'Finish': gt $loc, $loc_arg
-end
-
-if $ARGS[0] = 'magbstchoice':
-	*clr & cla
-	menu_off = 1
-	tittmp = tits + 1
-	'<center><img <<$set_imgh>> src="images/pc/body/tits/t<<tittmp>>.jpg"></center>'
-	killvar 'tittmp'
-	'You have an odd dream where you are looking at your naked chest in a mirror and your breasts seem larger...'
-	'As the dream starts to drift away, you find yourself gazing at the reflection of your breasts and think:'
-	act 'Nice, I wish my breasts really would grow.':
-		magf2bdo = 1
-		magtarcup += 1
-		killvar 'mgf2bnocnt'
-		gt 'sleep', 'sleep'
-	end
-	act 'Eh, I don''t like them like that.': magf2bdo = 0 & mgf2bnocnt += 1 & gt 'sleep', 'dream'
-end
 
 --- sleep ---------------------------------

+ 286 - 0
locations/sleep_events.qsrc

@@ -0,0 +1,286 @@
+# sleep_events
+$sleep_loc = 'sleep_events'
+menu_off = 1
+
+!! Sleep events trigger during the sleep cycle and can either wake you up or you can continue to sleep
+!!
+!! Moved here from sleep
+!! When done: Move to dream_events, sleep or wakeup
+
+	!!=====================================!!
+	!!                                     !!
+	!!          Event handlers             !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+
+	if sleepVars['events_active'] = 1:
+		sleepVars['events_done'] = 0
+
+		if vibratorIN = 1:
+			if pcs_horny >= 100:
+				$sleep_events[] = 'gs ''sleep_events'', ''vibr_orgasm'' '
+			end
+		elseif pcs_horny > 80 and pcs_sleep >= 30 and rand (0, 299) = 0 and succubusQW ! 1 and succubusQW ! 2:
+			$sleep_events[] = 'gs ''sleep_events'', ''wake_horny'' '
+		end
+
+		gs 'sleep_events', 'mod_events'
+	end
+end
+
+if $ARGS[0] = 'mod_events':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'sleep_events' and $ARGS[0] = 'mod_events'
+	!!
+	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!! A random event will be chosen from amongst the added ones.
+	!! If an event MUST trigger (due to quest timing), add it tp $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!!
+	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'sleep_events', 'event_end'
+	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'sleep_events', 'exit'
+	!!
+	!! This is to cleanup all necessary variables.
+	!!
+	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
+	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
+
+	gs 'sleep_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'event_handler':
+	if sleepVars['events_done'] < 1:
+		if arrsize('$sleep_events_priority') > 0:
+			xgt 'sleep_events', 'event_handler2', 'priority'
+		elseif arrsize('$sleep_events') > 0:
+			xgt 'sleep_events', 'event_handler2'
+		end
+	end
+
+	gs 'sleep_events', 'continue', 'dream'
+end
+
+if $ARGS[0] = 'event_handler2':
+	sleepVars['events_done'] += 1
+	
+	if $ARGS[1] = 'priority':
+		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
+		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
+		killvar '$sleep_events_priority', temp_slev_id
+	else
+		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
+		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
+		killvar '$sleep_events', temp_slev_id
+	end
+
+	killvar 'temp_slev_id'
+	dynamic $temp_sleep_event_chosen
+end
+
+
+if $ARGS[0] = 'event_end':
+	killvar '$temp_sleep_event_chosen'
+
+!!	if arrsize('$sleep_events_priority') > 0:
+!!		gt 'bed_events', 'event_handler2', 'priority'
+!!	end
+
+	if $ARGS[1] = '' or $ARGS[1] = 'sleep':
+		gs 'sleep_events', 'continue', 'sleep'
+	elseif $ARGS[1] = 'dream':
+		gs 'sleep_events', 'continue', 'dream'
+	else
+		gt 'wakeup', 'start'
+	end
+end
+
+
+if $ARGS[0] = 'exit':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+end
+
+if $ARGS[0] = 'continue':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+
+	if $ARGS[1] = '' or $ARGS[1] = 'sleep':
+		xgt 'sleep', 'sleep_handler'
+	elseif $ARGS[1] = 'dream':
+		!! empty on purpose
+	else
+		gt 'dream_events', 'start'
+	end
+end
+
+
+
+
+	!!=====================================!!
+	!!                                     !!
+	!!              Events                 !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'vibr_orgasm':
+	*clr & cla
+	pcs_horny = 0
+	orgasm += 1
+	minut += 5
+	gs 'stat'
+	'<center><img <<$set_imgh>> src="images/shared/sex/oface/o_face.jpg"></center>'
+	*nl
+	'You abruptly wake up in the throes of an orgasm. As you recover, you check the time, <<func(''bed2'', ''alarm_display'', hour, minut)>>.'
+
+	act 'Go back to sleep':
+		gs 'dream_events', 'event_end'
+	end
+
+	act 'Give up trying to sleep':
+		*clr & cla
+		'<center><img <<$set_imgh>> src="images/shared/sex/oface/kotovfirst1.jpg"></center>'
+		*nl
+		'Maybe trying to sleep with a vibrator in your pussy wasn''t such a good idea.'
+		gs 'dream_events', 'event_end', 'wake'
+	end
+
+	exit
+end
+
+!! Exclusions for succubus dreams as they set horny to 100 and will always get overridden otherwise
+if $ARGS[0] = 'wake_horny':
+	menu_off = 1
+	InSleep = 1
+	SleepHorny += 1
+	gs 'stat'
+
+	if $pantyworntype = 'none':
+		if SleepHorny = 1:
+			'<center><img <<$set_imgh>> src="images/shared/home/sleep_horny.jpg"></center>'
+		elseif SleepHorny = 2:
+			'<center><img <<$set_imgh>> src="images/shared/sex/mast/klit.jpg"></center>'
+		elseif SleepHorny >= 3:
+			'<center><img <<$set_imgh>> src="images/shared/sex/oface/kotovfirst1.jpg"></center>'
+		end
+	else
+		if SleepHorny = 1:
+			'<center><img <<$set_imgh>> src="images/shared/sex/mast/start.jpg"></center>'
+		elseif SleepHorny = 2:
+			'<center><img <<$set_imgh>> src="images/shared/sex/undress/kiska.jpg"></center>'
+		elseif SleepHorny >= 3:
+			'<center><img <<$set_imgh>> src="images/shared/sex/oface/kotovfirst1.jpg"></center>'
+		end
+	end
+
+	*nl
+	'You glance at your alarm clock. It reads <<func(''bed2'', ''alarm_display'', hour, minut)>>.'
+	*nl
+
+	if SleepHorny = 1:
+		'Your wet dream and overall horniness rouse you from your sleep. From one moment to the next, you are wide awake and very much aware that your pussy is hot and wet.'
+		*nl
+		'You could try and go back to sleep, of course, but it''s doubtful that you would find this kind of sleep very restful; not to mention the frustration that comes with ignoring your needs, but masturbating is an option, too, and not the worst one in this situation. It might take some time, but you''d be able to sleep like a baby after.'
+		*nl
+		'Of course, you could always just give up on trying to sleep and just get up.'
+	elseif SleepHorny = 2:
+		'You''re so horny that you''ve woken a second time. Your pussy is still wet and wanting attention.'
+		*nl
+		'You could try and get back to sleep again, but it''s doubtful that you will get much sleep, and continuously ignoring your needs won''t help; maybe you should masturbate, and make the most of the time that''s left.'
+		*nl
+		'Soon you will have to get up one way or another.'
+	elseif SleepHorny >= 3:
+		'Once again your horniness has roused you from your sleep. This is getting ridiculous! You are finding it very difficult to get any sleep at all.'
+		*nl
+		'Going back to sleep almost feels like a waste of time at this point;  you won''t get much rest at all, at least until you fix the problem.'
+		*nl
+		if $pantyworntype ! 'none':
+			gs 'underwear', 'remove'
+			'You''ve removed  your underwear, as your panties were soaked through.'
+			*nl
+		end
+		'Maybe you should just get up.'
+	end
+
+	if $loc = 'bedrPar' and sisterLesb = 6 and hour < 6:
+		*nl
+		'Or... you could wake up Anya and see if your dearest sister would be willing to help you with that.'
+	elseif $loc = 'FedorEv4':
+		*nl
+		'Or... you could wake up Fedor and see if your boyfriend can''t help you with that.'
+	elseif $loc = 'bedr' and husband > 0:
+		*nl
+		'Or... you could wake up <<$husName>> and see if your husband can''t help you with that.'
+	end
+
+	act 'Try and go back to sleep':
+		pcs_mood -= 10
+		pcs_sleep -= 5
+		gs 'sleep_events', 'exit'
+		gt 'dream_event', 'dream'
+	end
+
+	act 'Masturbate':
+		InSleep = 0
+		gs 'sleep_events', 'exit'
+		gt 'selfplay', 'start'
+	end
+
+	act 'Get out of bed (0:10)':
+		minut += 10
+		gs 'sleep_events', 'event_end', 'wake'
+	end
+	if strip_here = 1:
+		act 'Get out of bed and get dressed (0:15)':
+			minut += 15
+			gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
+			gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
+			gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
+			if $bed['shoetype'] ! 'none':
+				gs 'shoes', 'wear', $bed['shoetype'], bed['shoenumber']
+			end
+			gs 'sleep_events', 'event_end', 'wake'
+		end
+	end
+
+	if $loc = 'bedrPar' and sisterLesb = 6 and hour < 6:
+		act 'Wake Anya and see if she''s in the mood':
+			strip_here = 0
+			InSleep = 0
+			gs 'sleep_events', 'exit'
+			gt 'sistersleep', 'sister_sleep'
+		end
+	elseif $loc = 'FedorEv4':
+		act 'Wake Fedor and see if he''s in the mood':
+			strip_here = 0
+			InSleep = 0
+			gs 'sleep_events', 'exit'
+			gt 'FedorEv4', 'Bedroom 1'
+		end
+		!!Intro text doesn''t quite fit event (but doesn''t quite fit - try for baby - scenario either) - custom scene from VK?
+	elseif ($loc = 'bedr' or $loc = 'bedr2x') and husband > 0:
+		act 'Wake your husband and see if he''s in the mood':
+			strip_here = 0
+			InSleep = 0
+			gs 'sleep_event', 'exit'
+			gt 'husbSex', 'variant'
+			!!Should be custom scene - maybe boyfriend/husband overhaul can cover this?
+		end
+	end
+end
+
+--- sleep_events ---------------------------------

+ 90 - 0
locations/sleep_simple.qsrc

@@ -0,0 +1,90 @@
+# sleep_simple
+$sleep_loc = 'sleep_simple'
+menu_off = 1
+
+
+if $ARGS[0] = 'simple':
+!! to avoid sleeping the whole day I decide to calculate the duration of the sleep in advance
+!! the quality of the sleep depends on many factors, so the time of sleep can be modify later, especially the part when the time of sleep is shortened
+
+	sleepVars['time_to_full'] = (100 - pcs_sleep) * 6
+!! fully exhausted Sveta can recover in 420 minutes = 7 hours of sleep
+!! healthy Sveta can hardly sleep more then 10 hours = 600 minutes
+!! so we can add about 3 hours to time to full as a limit
+	sleepVars['time_to_full'] += 150 + rand(0, 60)
+
+	sleepVars['time_now'] = daystart * 1440 + hour * 60 + minut
+
+	if alarmVars['alarmOn'] = 1:
+		if alarm_holiday = 1 and kanikuli ! 0 or ((hour < alarmVars['timerEndH'] and (week = 6 or week = 7)) or (hour => alarmVars['timerEndH'] and (week = 5 or week = 6))):
+		!! use weekend time alarm
+			sleepVars['alarm_time'] = daystart * 1440 + alarmVars['timerEndH'] * 60 + alarmVars['timerEndM']
+			if sleepVars['time_now'] >= sleepVars['alarm_time']: sleepVars['alarm_time'] += 1440
+			sleepVars['minutes_to_wakeup'] = min(sleepVars['time_to_full'], sleepVars['alarm_time_end'] - sleepVars['time_now'])
+		else
+			sleepVars['alarm_time'] = daystart * 1440 + alarmVars['timerH'] * 60 + alarmVars['timerM']
+			if sleepVars['time_now'] >= sleepVars['alarm_time']: sleepVars['alarm_time'] += 1440
+			sleepVars['minutes_to_wakeup'] = min(sleepVars['time_to_full'], sleepVars['alarm_time'] - sleepVars['time_now'])
+		end
+	else
+		sleepVars['minutes to wakeup'] = sleepVars['time_to_full']
+	end
+
+	InSleep = 1
+	:sleep_simple_loop
+		minut += 1
+		sleepVars['stime'] += 1
+		sleepVars['minutes to wakeup'] -= 1
+
+		if recuperation = 0: pcs_health += 5
+
+		if sleepVars['stime'] >= 60:
+			sleepVars['stime'] = 0
+			pcs_sleep += 15
+			gs 'stat'
+		end
+
+		gs 'sleep_simple', 'mod_triggers'
+
+
+	if sleepVars['minutes to wakeup end'] > 0: jump 'sleep_simple_loop'
+	killvar 'sleep_simple_loop'
+
+	sleepVars['time_now'] = daystart * 1440 + hour * 60 + minut
+	InSleep = 0
+	gs 'stat'
+end
+
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
+	gs 'stat'
+end
+
+if $ARGS[0] = 'nap_bed':
+	act 'Take a nap (1:00)':
+		cla
+		if pcs_sleep < 10:
+			gt 'sleep', 'prepare_sleep'
+		elseif pcs_sleep <= 90:
+			InSleep = 1
+			pcs_sleep += 10
+			pcs_health += 5
+			minut += 60
+			gs 'stat'
+			*nl
+			'You sleep about an hour.'
+			act 'Get up': InSleep = 0 & gt 'bed_get_out', 'start'
+		else
+			minut += 5
+			gs 'stat'
+			*nl
+			'You are not tired enough to sleep, even for a short nap.'
+			act 'Get up': gt 'bed_get_out', 'start'
+		end
+	end
+end
+
+--- sleep_simple ---------------------------------

+ 4 - 4
locations/succubus.qsrc

@@ -576,14 +576,14 @@ if $args[0] = 'sucwalkinginit':
 	if succublvl <= 2:
 		if $pantyworntype ! 'none': gs 'underwear', 'remove'
 	else
-		if bedPanty = 1: 
+		if sleepQW['bedPanty'] = 1: 
 			gs 'underwear', 'wear'
-		elseif bedPanty = 2:
+		elseif sleepQW['bedPanty'] = 2:
 			gs 'underwear', 'remove'
 		end
 	end
-	if analplugIN = 1 and bedAnal = 1: analplugIN = 0
-	if vibratorIN = 1 and bedVibrator = 1: vibratorIN = 0
+	if analplugIN = 1 and sleepQW['bedAnal'] = 1: analplugIN = 0
+	if vibratorIN = 1 and sleepQW['bedVibrator'] = 1: vibratorIN = 0
 
 !!This is the simple method for the base level succubus
 	if succublvl = 1 and $lastwornclothingtype ! 'nude':

+ 6 - 6
locations/therapist.qsrc

@@ -1806,7 +1806,7 @@ if $ARGS[0] = 'hypnoDress':
 	elseif $pantyworntype = 'none' and hypnoPanty > 0:
 		'"Get dressed, <i>Cunt</i>. I see you didn''t wear underwear. Very good."'
 		'He watches you getting dressed with a small smile on his face.'
-		bedPanty = 2
+		sleepQW['bedPanty'] = 2
 
 	elseif $pantyworntype ! 'none' and hypnoPanty < 1:
 		'"Get dressed, <i>Cunt</i>, but forget the underwear. You didn''t wear any when you came, and you do not like to wear them. You enjoy the thought that people may notice that you do not wear underwear, maybe catch a glimpse of your naked pussy or ass."'
@@ -1816,12 +1816,12 @@ if $ARGS[0] = 'hypnoDress':
 
 		'He throws your panties in the garbage.'
 		hypnoPanty = 1
-		bedPanty = 2
+		sleepQW['bedPanty'] = 2
 
 	else
 		'"Get dressed, <i>Cunt</i>."'
 		'He watches you getting dressed with a small smile on his face, especially enjoying the sight of you not wearing underwear.</font>'
-		bedPanty = 2
+		sleepQW['bedPanty'] = 2
 	end
 	'<center><video autoplay loop src="images/locations/pavlovsk/clinic/therapist/dressup.mp4"></video></center>'
 
@@ -2205,7 +2205,7 @@ if $ARGS[0] = 'hypnoRandom':
 		*clr & cla
 		hypnoRandomCounter = 0
 		hypnoPanty = 1
-		bedPanty = 2
+		sleepQW['bedPanty'] = 2
 		'<center><img <<$set_imgh>> src="images/locations/pavlovsk/clinic/therapist/sittingClothed.jpg"></center>'
 		'"Listen, Cunt. You no longer like to wear panties ever again. You get off on the thought that people may see your naked pussy or ass. Just the thought of it will make you wet. You won''t ever think of putting them on anymore every again." He commands you to strip off your panties and hand them to him.'
 
@@ -2236,7 +2236,7 @@ if $ARGS[0] = 'hypnoRandom':
 		end
 
 		hypnoPanty = 1
-		bedPanty = 2
+		sleepQW['bedPanty'] = 2
 
 	! sveta will now think it''s normal for pavlov to check if she is not wearing panties before their sessions.
 	elseif hypnoCheckPanties ! 1 and rand(1,2) = 1 and hypnoPanty = 1:
@@ -3341,7 +3341,7 @@ $RestTherapyVariables ={
     killvar 'hypnoPanty'
     killvar 'hypnoCheckPanties'
     killvar 'hypnoFlashGreet'
-    killvar 'bedPanty'
+	sleepQW['bedPanty'] = 0
     killvar 'hypnoBra'
     killvar 'hypnoClothes'
     killvar 'hypnoStage'

+ 1 - 1
locations/therapist_hotel.qsrc

@@ -100,7 +100,7 @@ if $ARGS[0] = 'post_shower':
 			if hypnoHardToCum = 2: hypnoHardToCum = 1
 			gs 'stat'
 			act 'Sleep':
-				gs 'sleep', 'simple'
+				gs 'sleep_simple', 'simple'
 				gt 'therapist_hotel', 'morning'
 			end
 		end

+ 1 - 1
locations/uni_dorm.qsrc

@@ -614,7 +614,7 @@ if $ARGS[0] = 'dorm_room':
 	end
 
 	*nl
-	'<table><tr><td valign="top">Your <a href="exec:gt ''budilnik'', ''start''">alarm clock</a> is set to <b>'+iif(timer < 10,'0<<timer>>','<<timer>>')+':'+iif(timerM < 10,'0<<timerM>>','<<timerM>>')+'</b> during the week and <b>'+iif(timerEnd < 10,'0<<timerEnd>>','<<timerEnd>>')+':'+iif(timerEndM < 10,'0<<timerEndM>>','<<timerEndM>>')+'</b> during the weekend. It is currently turned '+iif(budilnikOn = 0, '<a href="exec: budilnikOn = 1 & gt ''uni_dorm'', ''dorm_room''">OFF</a>.', '<a href="exec: budilnikOn = 0 & gt ''uni_dorm'', ''dorm_room''">ON</a>.')
+	'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerH''], alarmVars[''timerM''])>> during the week and <<func(''alarmclock'', ''alarm_display'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
 	*nl
 	gs 'exercise', 'start'
 

+ 99 - 0
locations/wakeup.qsrc

@@ -0,0 +1,99 @@
+# wakeup
+$sleep_loc = 'wakeup'
+menu_off = 1
+
+!! Deals with all the triggers that happen when waking up.
+!!
+!! Moved here from sleep or sleep_events
+!! When done: Move to wakeup_events
+
+if $ARGS[0] = 'start' or $ARGS[0] = 'wake' or $ARGS[0] = '':
+	menu_off = 1
+	InSleep = 1
+	gs 'stat'
+
+	InSleepWake = hour + 1
+	InSleepWake[1] = daystart
+	
+	gs 'wakeup', 'mod_triggers'
+
+	xgt 'wakeup_events', 'start'
+end
+
+if $ARGS[0] = 'mod_triggers':
+	!! This location is here to allow mods to hook into the system.
+	!! Check for: if $sleep_loc = 'pre_sleep' and $ARGS[0] = 'mod_triggers'
+	!!
+	!! This is NOT for events!!
+end
+
+
+if $ARGS[0] = 'get_out':
+	sleepVars['time_now'] = daystart * 1440 + hour * 60 + minut
+	if slept_in = 1:
+		'You wake up at <<func(''alarmclock'', ''alarm_display'', hour, minut)>>, after sleeping-in a little longer than planned, but at least you''ve had plenty of sleep.'
+	elseif pcs_sleep >= 100 and alarmVars['alarmOn'] = 1 and sleepVars['time_now'] >= sleepVars['alarm_time']:
+		'You wake up at <<func(''alarmclock'', ''alarm_display'', hour, minut)>>, just before your alarm goes off. You''ve had plenty of sleep.'
+	elseif pcs_sleep >= 100:
+		'You wake up at <<func(''alarmclock'', ''alarm_display'', hour, minut)>> no longer tired and ready to start the day with plenty of sleep.'
+	elseif alarmVars['alarmOn'] = 1 and sleepVars['time_now'] = sleepVars['alarm_time']:
+		pcs_mood -= 10
+		'Your alarm goes off at <<func(''alarmclock'', ''alarm_display'', hour, minut)>>, '+iif(pcs_sleep < 90, 'but you could do with some extra sleep.', 'and you''ve had plenty of sleep.')+''
+		gs 'sleep', 'extra'
+	else
+		!! I do not think that it could go here
+		''
+	end
+
+	if kanikuli = 0 and mid($start_type,1,2) = 'sg' and SchoolAtestat = 0 and SchoolBlock = 0 and week < 6 and hour >= 4 and hour < 9:
+		act 'Get out of bed and get dressed for school (0:15)':
+			minut += 15
+			gs 'wardrobe', 'school_outfit'
+			xgt 'bed_get_out', 'start'
+		end
+	end
+
+	if strip_here = 1:
+		act 'Get out of bed and get dressed (0:15)':
+			minut += 15
+			gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
+			gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
+			gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
+			if $bed['shoetype'] ! 'none':
+				gs 'shoes', 'wear', $bed['shoetype'], bed['shoenumber']
+			end
+			xgt 'bed_get_out', 'start'
+		end
+	end
+
+	if enfullmorrout = 1 and hour >= 4 and hour < 12:
+		act 'Full morning routine (01:00)':
+			minut += 15
+			fullmorrout = 1
+			gs 'clothing', 'wear', $lastwornclothingtype['bed'], lastwornclothingnumber['bed']
+			gs 'panties', 'wear', $lastwornpantytype['bed'], lastwornpantynumber['bed']
+			gs 'bras', 'wear', $lastwornbratype['bed'], lastwornbranumber['bed']
+			if $bed['shoetype'] ! 'none':
+				gs 'shoes', 'wear', $bed['shoetype'], bed['shoenumber']
+			end
+			xgt 'bed_get_out', 'start'
+		end
+		if kanikuli = 0 and mid($start_type,1,2) = 'sg' and SchoolAtestat = 0 and SchoolBlock = 0 and week < 6 and hour >= 4 and hour < 9 and suspended['on'] ! 1:
+			act 'Full morning routine for School (01:00)':
+				fullmorrout = 1
+				minut += 15
+				gs 'wardrobe', 'school_outfit'
+			xgt 'bed_get_out', 'start'
+			end
+		end
+	end
+
+	act 'Get out of bed (0:10)':
+		minut += 10
+		slept_in = 0
+		xgt 'bed_get_out', 'start'
+	end
+end
+
+
+--- wakeup ---------------------------------

+ 210 - 0
locations/wakeup_events.qsrc

@@ -0,0 +1,210 @@
+# wakeup_events
+$sleep_loc = 'wakeup_events'
+menu_off = 1
+
+!! wakeup events trigger during when waking up
+!!
+!! Moved here from wakeup
+!! When done: Move to bed2
+
+	!!=====================================!!
+	!!                                     !!
+	!!          Event handlers             !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'start' or $ARGS[0] = '':
+	menu_off = 1
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+
+	if sleepVars['events_active'] = 1:
+		sleepVars['events_done'] = 0
+
+		if mid($start_type, 1, 2) = 'sg' and locat['Fam_inGad'] = 0 and motherQW['bathroom_dildos'] > 0 and MarishaQW["marisha_sleepover"] = 0:
+			$sleep_events[] = 'gs ''wakeup_events'', ''mother_sextalk'' '
+		end
+
+		if vomit['hangover'] = 1  or vomit['unlucky'] = 1 or vomit['morning_sick'] = 1:
+			$sleep_events[] = 'gs ''wakeup_events'', ''vomiting_check'' '
+		end
+
+		if MarishaQW['marisha_sleepover'] = 1: $sleep_events[] = 'gs ''wakeup_events'', ''marisha_ev_morning'' '
+		if $start_type[1] = 'tg' and daystart < 10:
+			$sleep_events_priority[] = 'gs ''wakeup_events'', ''trans_early_shocked'' '
+		elseif $start_type[1] = 'tg' and daystart < 30:
+			$sleep_events_priority[] = 'gs ''wakeup_events'', ''trans_little_shocked'' '
+		end
+
+
+		if mid($start_type, 1, 2) = 'sg' and slept_in = 1 and kanikuli = 0 and SchoolAtestat = 0 and SchoolBlock = 0 and week < 6 and suspended['on'] ! 1:
+			if (hour = 7 or hour = 8):
+				$sleep_events_priority[] = 'gs ''wakeup_events'', ''sg_go_school'' '
+			elseif hour >= 9 and hour < 14:
+				$sleep_events_priority[] = 'gs ''wakeup_events'', ''sg_slept_in'' '
+			end
+			
+		end
+
+		xgt 'wakeup_events', 'mod_events'
+	end
+	
+	xgt 'wakeup_events', 'continue'
+end
+
+if $ARGS[0] = 'mod_events':
+	!! This location is here to allow mods to hook into the system.
+	!! Either check for: if $sleep_loc = 'wakeup_events' and $ARGS[0] = 'mod_events'
+	!!
+	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!! A random event will be chosen from amongst the added ones.
+	!! If an event MUST trigger (due to quest timing), add it tp $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
+	!!
+	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'wakeup_events', 'event_end'
+	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'wakeup_events', 'exit'
+	!!
+	!! This is to cleanup all necessary variables.
+	!!
+	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
+	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.
+
+	xgt 'wakeup_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'event_handler':
+	if sleepVars['events_done'] < 10:
+		if arrsize('$sleep_events_priority') > 0:
+			xgt 'wakeup_events', 'event_handler2', 'priority'
+		elseif arrsize('$sleep_events') > 0:
+			xgt 'wakeup_events', 'event_handler2'
+		end
+	end
+
+	gs 'wakeup_events', 'continue'
+end
+
+if $ARGS[0] = 'event_handler2':
+	sleepVars['events_done'] += 1
+
+	if $ARGS[1] = 'priority':
+		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
+		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
+		killvar '$sleep_events_priority', temp_slev_id
+	else
+		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
+		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
+		killvar '$sleep_events', temp_slev_id
+	end
+
+	killvar 'temp_slev_id'
+	dynamic $temp_sleep_event_chosen
+end
+
+
+if $ARGS[0] = 'event_end':
+	killvar '$temp_sleep_event_chosen'
+
+	if arrsize('$sleep_events_priority') > 0:
+		gt 'wakeup_events', 'event_handler2', 'priority'
+	end
+
+	xgt 'wakeup_events', 'event_handler'
+end
+
+
+if $ARGS[0] = 'exit':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+end
+
+if $ARGS[0] = 'continue':
+	sleepVars['events_done'] = 0
+	killvar '$sleep_loc'
+	killvar '$sleep_events'
+	killvar '$sleep_events_priority'
+	killvar 'temp_slev_id'
+	killvar '$temp_sleep_event_chosen'
+
+	xgt 'wakeup', 'get_out'
+end
+
+
+
+
+	!!=====================================!!
+	!!                                     !!
+	!!              Events                 !!
+	!!                                     !!
+	!!=====================================!!
+
+
+if $ARGS[0] = 'mother_sextalk':
+	gt 'mother_sextalk', 'dildo_wakeup1'
+end
+
+
+if $ARGS[0] = 'vomiting_check':
+	!! if not one of these locations, event will not fire
+	if at_home = 1 or at_home = 2 or at_home = 3 or at_home = 4 or $loc = 'bedrPar' or at_home = 6 or at_home = 13 or at_home = 15 or $loc = 'mey_home':
+		gs 'wakeup_event', 'exit'
+		gs 'home_activity', 'vomiting_images'
+		gt 'home_activity', 'morning_vomit'
+	else
+		vomit['morning_sick'] = 0
+		vomit['hangover'] = 0
+		vomit['unlucky'] = 0
+	end
+end
+
+
+if $ARGS[0] = 'marisha_ev_morning':
+	'<center><img src="images/characters/pavlovsk/resident/marisha/marisha.jpg"></center>'
+	'You wake up feeling relaxed then look over to see Marisha already up. She gives you a smile and says, "Thanks for everything <<$pcs_firstname>>. See you later." She then leaves as you continue getting up.'
+	MarishaQW['marisha_sleepover'] = 0
+	gs 'wakeup_events', 'event_end'
+end
+
+if $ARGS[0] = 'trans_early_shocked':
+	'The first thing you think as you wake up is, "Damn! It''s is not a dream, I really am a woman now."'
+	gs 'wakeup_events', 'event_end'
+end
+
+if $ARGS[0] = 'trans_little_shocked':
+	'Looking at your female body, you are still a little surprised it''s actually you.'
+	gs 'wakeup_events', 'event_end'
+end
+
+if $ARGS[0] = 'sg_slept_in':
+	if schoolprogul > 2 and schoolPredupr = 2:
+		pcs_mood -= 35
+		gs 'stat'
+		msg '<center>Damn it''s <<func(''alarmclock'', ''alarm_display'', hour, minut)>>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be furious. I don''t know what she might do...</center>'
+	elseif schoolprogul > 2 and schoolPredupr = 1:
+		pcs_mood -= 30
+		gs 'stat'
+		msg '<center>Damn it''s <<func(''alarmclock'', ''alarm_display'', hour, minut)>>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be very angry if I miss another day of school.</center>'
+	elseif schoolprogul > 2 and schoolPredupr = 0:
+		pcs_mood -= 25
+		gs 'stat'
+		msg '<center>Damn it''s <<func(''alarmclock'', ''alarm_display'', hour, minut)>>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be angry to find out I missed a day of school.</center>'
+	else
+		pcs_mood -= 20
+		gs 'stat'
+		msg '<center>Damn it''s <<func(''alarmclock'', ''alarm_display'', hour, minut)>>. It''s too late to go to school now!<br><<$npc_nickname[''A29'']>> will be very upset if I''m not at school every day.</center>'
+	end
+	gs 'wakeup_events', 'event_end'
+end
+
+if $ARGS[0] = 'sg_go_school':
+	pcs_mood -= 10
+	gs 'stat'
+	msg '<center>Damn it''s <<func(''alarmclock'', ''alarm_display'', hour, minut)>>, you''ve slept too long! You need to hurry or you''re going to be late for school!</center>'
+end
+
+--- wakeup_events ---------------------------------