3 Commits aa8071b506 ... 8f9a1518a4

Author SHA1 Message Date
  Scarlett Schäfer 8f9a1518a4 School Calendar 2 years ago
  Scarlett Schäfer 837c6574ba School Times 2 years ago
  Scarlett Schäfer 4f0d56b9b3 School Pictures 2 years ago

+ 43 - 0
source/event/school/calendar.qsps

@@ -0,0 +1,43 @@
+# event_school_calendar
+
+if $ARGS[0] = 'schoolMode':
+
+    gs 'event_school_calendar','schoolModeCalculate'
+
+    _dayOfWeek_esc = FUNC('util_time','dayOfWeek',time_current)
+
+    if time_current >= school_calendar['vacation_summer_start'] and time_current < school_calendar['vacation_summer_end']:
+        $RESULT = 'vacation_summer'
+    elseif (time_current >= school_calendar['vacation_xmas_start'] and time_current < school_calendar['vacation_xmas_end_nextYear']) or time_current < school_calendar['vacation_xmas_end_thisYear']:
+        $RESULT = 'vacation_xmas'
+    
+    elseif _dayOfWeek_esc = 5 or _dayOfWeek_esc = 6:
+        $RESULT = 'weekend'
+    else:
+        $RESULT = 'schoolday'
+    end
+    
+elseif $ARGS[0] = 'schoolModeCalculate':
+    gs 'util_time','timeInfo_load',time_current
+    _year = time_year
+    if school_calendar_calculatedYear ! _year:
+
+        school_calendar['vacation_summer_start'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year,7,3),5)
+        school_calendar['vacation_summer_end'] = school_calendar['vacation_summer_start'] + (6 * 7 + 2) * 86400
+
+        *PL FUNC('util_time','time2date',school_calendar['vacation_summer_start'])
+        *PL FUNC('util_time','time2date',school_calendar['vacation_summer_end'])
+
+        school_calendar['vacation_xmas_start'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year,12,24) - 6 * 86400,5)
+        school_calendar['vacation_xmas_end_nextYear'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year+1,1,2),0)
+        school_calendar['vacation_xmas_end_thisYear'] = FUNC('util_time','getNextDayOfWeekDate',FUNC('util_time','date2time',_year,1,2),0)
+
+        *PL FUNC('util_time','time2date',school_calendar['vacation_xmas_start'])
+        *PL FUNC('util_time','time2date',school_calendar['vacation_xmas_end_thisYear'])
+        *PL FUNC('util_time','time2date',school_calendar['vacation_xmas_end_nextYear'])
+
+        school_calendar_calculatedYear = _year
+    end
+end
+
+-

+ 21 - 4
source/event/school/schoolday.qsps

@@ -4,15 +4,18 @@
 
 if $ARGS[0] = 'start':
 
-    _initialized = FUNC('util_vars','get','school','initialized')
+    
+
+    gs 'util_action','render_action','<b style="font-size: 150%;">Start Schoolday</b>','gt ''event_school_schoolday'',''execute'' '
 
-    if _initialized = 0 : gs'event_school_schoolday','initialize'
 
     $_hang_out_with = FUNC('util_vars','get','school','$socialgroup_hangoutwith')
     if $_hang_out_with = '' or $_hang_out_with = 'nerds':
         $_hang_out_with_text = 'During pauses you will hang out with the nerds in the computer lab.'
+        $_hang_out_with_picture = 'events/school/schoolday/nerds.png'
     elseif $_hang_out_with = 'sports':
         $_hang_out_with_text = 'During pauses you will hang out with sports team on the school grounds.'
+        $_hang_out_with_picture = 'events/school/schoolday/sports.jpg'
     end
 
     _performance = FUNC('util_vars','get','school','performance')
@@ -27,9 +30,10 @@ if $ARGS[0] = 'start':
     elseif _performance = 4:
         $_performance_text = 'You put no effort into your school work.'
     end
+    $_performance_picture = 'events/school/schoolday/classes/participate_'+FUNC('pc','get','genderMedia')+'_<<_performance>>.jpg'
 
-    gs 'util_action','render_action',$_hang_out_with_text,'gt ''event_school_schoolday'',''startSwitchHangout'' '
-    gs 'util_action','render_action',$_performance_text,'gt ''event_school_schoolday'',''startSwitchPerformance'' '
+    gs 'util_action','render_action',$_hang_out_with_text,'gt ''event_school_schoolday'',''startSwitchHangout'' ',0,$_hang_out_with_picture
+    gs 'util_action','render_action',$_performance_text,'gt ''event_school_schoolday'',''startSwitchPerformance'' ',0,$_performance_picture
 
     gs 'util_action','render_action','<b style="font-size: 150%;">Start Schoolday</b>','gt ''event_school_schoolday'',''execute'' '
 
@@ -56,7 +60,10 @@ elseif $ARGS[0] = 'initialize':
     gs 'util_vars','set','school','performance',2
     gs 'util_vars','set','school','performanceTotal',500
 
+    
     gs 'util_vars','set','school','time_end',140000
+    gs 'util_vars','set','school','time_start_earliest',73000
+    gs 'util_vars','set','school','time_start_begin',80000
 
     gs 'util_vars','set','school','initialized',1
 
@@ -111,6 +118,15 @@ elseif $ARGS[0] = 'performance':
     end
 
 
+    _time_at_school = FUNC('util_time','timeUntilTimeOfDay',FUNC('util_vars','get','school','time_end'))
+    _time_at_school_required  = FUNC('util_time','timeOfDay2Seconds',FUNC('util_vars','get','school','time_end')) - FUNC('util_time','timeOfDay2Seconds',FUNC('util_vars','get','school','time_start_begin'))
+
+    if _time_at_school_required > _time_at_school:
+        _hours_missed = (_time_at_school_required - _time_at_school + 3599) / 3600
+        _p = rand(_hours_missed,_hours_missed * 2)
+        $_performance_text[] = 'You missed <<_hours_missed>> hours of school and your grades therefore dropped by <<_p>>.'
+    end
+
     !foreach($_performance_text as key => $value){
         *PL $value
     }
@@ -173,6 +189,7 @@ elseif $ARGS[0] = 'social':
     end
 
     *PL '<div class="npcGrid"><<$content_sidebarL>></div>'
+    $content_sidebarL = ''
 
     gs 'util_vars','set','school','socialgroup_interactionCounter_'+$_hang_out_with,_interaction_counter + 1
 

+ 18 - 1
source/location/school/grounds.qsps

@@ -6,6 +6,9 @@ if $ARGS[0] = 'info':
     $location_mode = 'outdoors'
     $location_access = 'private'
 elseif $ARGS[0] = 'show':
+    _initialized = FUNC('util_vars','get','school','initialized')
+    if _initialized = 0 : gs'event_school_schoolday','initialize'
+
     gs 'util_location','render_title','School Grounds'
 
     if FUNC('util_time','sunPosition',-1) = 'night':
@@ -15,7 +18,21 @@ elseif $ARGS[0] = 'show':
     end
 
     gs 'util_location','render_goto','residential',300,'Leave'
-    gs 'util_location','render_goto','school_hallway',60,'Enter'
+
+    $_schoolMode = FUNC('event_school_calendar','schoolMode')
+    if $_schoolMode = 'vacation_summer':
+        *P 'School is closed for summer.'
+    elseif $_schoolMode = 'vacation_xmas':
+        *P 'School is closed for Christmas vacations.'
+    elseif $_schoolMode = 'weekend':
+        *P 'School is closed for weekend.'
+    elseif FUNC('util_time','timeOfDay',time_current) < FUNC('util_vars','get','school','time_start_earliest'):
+        *P 'The school door is still locked.'
+    elseif FUNC('util_time','timeOfDay',time_current) >= FUNC('util_vars','get','school','time_end'):
+        *P 'The school door is locked for the rest of the day.'
+    else:
+        gs 'util_location','render_goto','school_hallway',60,'Enter'
+    end
 
 end 
 

+ 5 - 1
source/location/school/hallway.qsps

@@ -14,7 +14,11 @@ elseif $ARGS[0] = 'show':
         gs 'util_image','render_image','locations/school/hallway.jpg'
     end
 
-    if FUNC('util_vars','get','school','isStudent') = 1:
+    gs 'util_vars','set','school','time_start_earliest',73000
+    gs 'util_vars','set','school','time_start_late',80000
+
+    _timeOfDay = FUNC('util_time','timeOfDay',time_current)
+    if FUNC('util_vars','get','school','isStudent') = 1 and FUNC('util_vars','get','school','time_start_earliest') <= _timeOfDay and FUNC('util_vars','get','school','time_end') > _timeOfDay:
         gs 'util_action','render_action','Go to school','gt ''util_event'',''start'',''school_schoolday'' ','','','R'
     end
 

+ 13 - 1
source/onNewloc.qsps

@@ -37,6 +37,11 @@ $_style = '
         color : black;  
     }
 
+    .mainarea >.actionButton > img{
+        max-height: 300px;
+        max-width: 80%;
+    }
+
     .npcGrid{
         display:grid;
         grid-template-columns: repeat(auto-fit, 150px);
@@ -62,17 +67,24 @@ $_style = '
     .npcGrid > .actionButton > p{
         text-align:center; 
     }
+
+    .sidebar >.actionButton > img{
+        max-height: 200px;
+        max-width: 80%;
+    }
 '
 
 
 $_text  = '<head><style>'+Replace($_style,'
-','')+'</style></head>'+ $MAINTXT
+','')+'</style></head><div style="display:grid; grid-template-columns: 1fr 3fr 1fr;grid-template-rows: auto;grid-auto-flow: column dense;"><div style="grid-column:2;" class="mainarea">'+ $MAINTXT + '<div style="grid-column:1;" class="sidebar sidebarLeft"><<$content_sidebarL>></div><div style="grid-column:3;" class="sidebar sidebarRight"><<$content_sidebarR>></div></div>'
 
 *CLR
 
 
 *P $_text
 
+$content_sidebarL = '' 
+$content_sidebarR = ''
 
 
 

+ 5 - 1
source/pc/pc.qsps

@@ -1,5 +1,9 @@
 # pc
 
-
+if $ARGS[0] = 'get':
+    if $ARGS[1] = 'genderMedia':
+        $RESULT = $gender_appearance
+    end
+end
 
 -

+ 1 - 1
source/util/action.qsps

@@ -26,7 +26,7 @@ if $ARGS[0] = 'render_action':
         $temp_image = ''
         
     else
-        $temp_image = '<img src="media/<<$ARGS[4]>>" style="height:100px;width:100px;display: block;margin-left: auto; margin-right: auto;"/>'
+        $temp_image = '<img src="media/<<$ARGS[4]>>" style="height:display: block;margin-left: auto; margin-right: auto;"/>'
     end
 
     if ARGS[3] > 0:

+ 1 - 8
source/util/location.qsps

@@ -12,16 +12,12 @@ elseif $ARGS[0] = 'goto':
     !'  $1: Target ID
         2: Interrupts Disabled
     '
-    $content_sidebarL = '' 
-    $content_sidebarR = ''
-    *P '<div style="display:grid; grid-template-columns: 1fr 3fr 1fr;grid-template-rows: auto;grid-auto-flow: column dense;">'
-    *P '<div style="grid-column:2;">'
     if interrupt_disabled = 0 and ARGS[2]=0: gs 'util_interrupt','execute',$location_current,$ARGS[1]
 
     $location_current = $ARGS[1]
     gs 'util_location','info_load',$location_current
     gs 'util_debug', 'refresh_set', "gt 'util_location','goto','<<$location_current>>',1"
-    !gs 'util_stat','render_widget'
+    
     if statsHide = 0 : gs 'util_debug','updateAll' & gs 'util_stat','render_widget'
 
     gs 'util_template','template_update',$location_mode
@@ -32,9 +28,6 @@ elseif $ARGS[0] = 'goto':
 
     *P '</div>'
 
-    *P '<div style="grid-column:1;"><<$content_sidebarL>></div><div style="grid-column:3;"><<$content_sidebarR>></div>'
-
-    *P '</div>'
 elseif $ARGS[0] = 'info_load':
     gs 'util_location','generic_info'
     gs 'location_<<$ARGS[1]>>' , 'info'

+ 5 - 1
source/util/npc.qsps

@@ -1,6 +1,11 @@
 # util_npc
 if $ARGS[0] = 'detailsShow':
+
+
     clr
+
+    P "<p><a href=""exec:gs 'util_debug','refresh'"">Close</a></p>"
+
     showstat 1
     statsHide = 0
 
@@ -532,7 +537,6 @@ elseif $ARGS[0] = 'render_button':
         2: Custom Execution Code (empty will default to npc.button_action)
     }
     $_code = $ARGS[2]
-    *PL $_code
     $temp_label = FUNC('util_npc','get',$ARGS[1],'$name_used')
     $temp = FUNC('util_npc','get',$ARGS[1],'$button_action')
     if $result_desc ! '': $temp_label += '|'+$result_desc

+ 24 - 0
source/util/time.qsps

@@ -52,6 +52,12 @@ elseif $ARGS[0] = 'alarm_time_showDialog':
     :AlarmDialogEND
 
 elseif $ARGS[0] = 'date2time':
+    !{
+        1: Year
+        2: Month
+        3: Day
+    }
+
     temp_dateTime = (ARGS[1]-time_baseYear) * 31536000
     !temp_dateTime += ((ARGS[1]-time_baseYear)/4) * 86400
     if ARGS[2] > 1: temp_dateTime += 86400 * 31
@@ -86,6 +92,11 @@ elseif $ARGS[0] = 'get':
     if $ARGS[1] = 'hour':
         RESULT = time_hour
     end
+elseif $ARGS[0] = 'getNextDayOfWeekDate':
+    _dayOfWeek = FUNC('util_time','dayOfWeek',ARGS[1])
+    _daysMissing = (ARGS[2] - _dayOfWeek + 7) mod 7
+    RESULT = ARGS[1] + _daysMissing * 86400
+
 elseif $ARGS[0] = 'time2dayOfWeekReadable':
     $RESULT = FUNC('util_time','dayOfWeekReadable',FUNC('util_time','dayOfWeek',ARGS[1]))
 elseif $ARGS[0] = 'init':
@@ -234,6 +245,8 @@ elseif $ARGS[0] = 'isTimeOfDay':
         RESULT = 1
     end
 
+
+
 elseif $ARGS[0] = 'timeOfDay':
     temp_seconds = ARGS[1] MOD 86400
     temp_hours = temp_seconds / 3600
@@ -247,6 +260,17 @@ elseif $ARGS[0] = 'timeOfDay2readable':
     else
         $RESULT = FUNC('util_string','formatInt_XX',ARGS[1]/10000)+':'+FUNC('util_string','formatInt_XX',(ARGS[1] / 100) MOD 100)
     end
+
+elseif $ARGS[0] = 'timeOfDay2Seconds':
+    temp_timeOfDay = ARGS[1]
+
+    _hour =  (temp_timeOfDay / 10000)
+    _minute= ((temp_timeOfDay / 100) MOD 100)
+    _seconds=(temp_timeOfDay MOD 100)
+
+
+    RESULT = _hour * 3600 + _minute * 60 + _seconds
+
 elseif $ARGS[0] = 'timeUntilTimeOfDay':
     temp_timeOfDay = ARGS[1]