Browse Source

Fixed missing daily check that wayward from revisions and other code wrangling, and corrected variable type on check at various locations.

Hooded Silence 1 year ago
parent
commit
2b3581585c
3 changed files with 16 additions and 31 deletions
  1. 1 1
      locations/city_industrial.qsrc
  2. 1 1
      locations/city_residential.qsrc
  3. 14 29
      locations/emp_functions.qsrc

+ 1 - 1
locations/city_industrial.qsrc

@@ -51,7 +51,7 @@ if $ARGS[0] = '':
 	if hour >= 4 and hour <= 23:
 		act 'Walk to the Metro': minut += 5 & gt 'metro', 'start'
 	end
-	if evt_chk = '1':
+	if evt_chk = 1:
 		!! We've got an event today, check it's location:
 		gs 'emp_functions', 'disp_evt', 3
 	end

+ 1 - 1
locations/city_residential.qsrc

@@ -93,7 +93,7 @@ end
 
 act 'Walk to the central park (0:20)': minut += 20 & gt 'city_park', 'start'
 act 'Walk to the lake': minut += 40 & gt 'city_lake', 'start'
-if evt_chk = '1':
+if evt_chk = 1:
 	!! We've got an event today, check it's location:
 	gs 'emp_functions', 'disp_evt', 3
 end

+ 14 - 29
locations/emp_functions.qsrc

@@ -233,7 +233,7 @@ if $ARGS[0] = 'disp_evt':
 	end
 
 	!! Display the location acts
-	if ARGS[1] = 3 and evt_chk = '1':
+	if ARGS[1] = 3 and evt_chk = 1:
 		act_idx = 0
 		act_tracker = 0
 		act_found = 0
@@ -466,34 +466,6 @@ if $ARGS[0] = 'del_evt':
 	end 
 end
 
-if $ARGS[0] = 'evt_day_suffix':
-
-	if ARGS[1] ! '': 
-		query_day = ARGS[1]
-	else
-		query_day = transient_evt_day
-	end
-	if query_day => 20 and query_day <= 29:
-		test_day = query_day - 20
-	else
-		test_day = query_day
-	end
-
-	if test_day => 4 and test_day <= 10:
-		$evt_suffix = 'th'
-	elseif test_day = 1 or test_day = 31:
-		$evt_suffix = 'st'
-	elseif test_day = 2:
-		$evt_suffix = 'nd'    
-	elseif test_day= 3: 
-		$evt_suffix = 'rd'
-	else
-		$evt_suffix = 'th'
-	end
-
-	killvar 'test_day'
-	killvar 'query_day'
-end
 
 if $ARGS[0] = 'evt_day_suffix':
 
@@ -523,6 +495,19 @@ if $ARGS[0] = 'evt_day_suffix':
 	killvar 'test_day'
 	killvar 'query_day'
 end
+
+if $ARGS[0] = 'evt_day_chk':
+	!! Daily event trigger to check if there is an event at currently location to reduce calls/overheads
+	evt_chk = 0
+	if evt_daily_chk ! daystart:
+		evt_daily_chk = daystart
+		job_idx = 0
+		:evt_day_chk		
+			if month = evt_month and day = evt_day: evt_chk = 1
+			job_idx += 1
+		if job_idx < arrsize('evt_event') : jump 'evt_day_chk'
+	end
+end
 !! --------------------- End Event Generator
 
 !! --------------------- Job management system