1
0
Selaa lähdekoodia

New event system implementation, initial code base

Hooded Silence 1 vuosi sitten
vanhempi
sitoutus
09ab46e83e

+ 4 - 0
locations/cikl.qsrc

@@ -1193,5 +1193,9 @@ prostitute['customer_day'] = 0
 !! Moves time for the rented properties
 gs 'homes_properties', 'progress_property_rent_time'
 
+!!------------- Check for Daily Events for event generator, sets evt_chk variable  ------------------------------------------
+gs 'emp_functions', 'evt_day_chk'
+
+
 --- cikl ---------------------------------
 

+ 4 - 0
locations/city_industrial.qsrc

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

+ 4 - 0
locations/city_residential.qsrc

@@ -93,6 +93,10 @@ 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':
+	!! We've got an event today, check it's location:
+	gs 'emp_functions', 'disp_evt', 3
+end
 
 act 'Wait':gs 'obj_din', 'wait'
 

+ 146 - 57
locations/emp_functions.qsrc

@@ -179,66 +179,127 @@ end
 !! v. 02 - UI improvements and feature feedback
 !! V. 03 - Initial integration into mainline code
 
-if $ARGS[0] = 'evt_init'
-
-!! Placeholder, pending integration
-
+if $ARGS[0] = 'evt_init' :
+	!! Placeholder, pending integration
+	gt $loc, $loc_arg
 end
 
 
 if $ARGS[0] = 'disp_evt':
-	*clr & cla
+	
 	
 	if ARGS[1] = '1':
 		gs 'emp_functions','evt_day_suffix'
 
-		'Hi <<$pcs_nickname>>, I have this job for you do you want to acccept it?'
+		'I have this job for you do you want to acccept it?'
 		*nl
-		'Event Scheduled for: ' + transient_evt_day + $evt_suffix + ', '+ $monthName[transient_evt_month] +' '+ ' 20' + transient_evt_year
+		'Event Scheduled for: ' + transient_evt_day + $evt_suffix + ', '+ $monthName[transient_evt_month] +' '+ '20' + transient_evt_year
 		'Job: ' + $evt_job[transient_evt_type]  			
 		'Pay: ' + transient_evt_wages
 		'Time: ' + transient_evt_hour + ':' +  iif(transient_evt_minutes  >= 0 and transient_evt_minutes <= 4, '00',  '30')
 		'Duration: ' + transient_evt_duration  + iif(transient_evt_duration  = 1, ' hour',  ' hours')
-		'location reminder: ' + $transient_mc_locat
+		'Location reminder: ' + $transient_mc_locat
+		'Job Details: ' + $transient_desc
 		
 		act 'Accept the job' : gs 'emp_functions', 'cat_evt'
 		act 'Decline the job': 
 			gs 'emp_functions',  'del_evt', 1
-			gt 'emp_functions', 'init'
+			gt 'emp_functions', 'evt_init'
 		end
 	end
 		
 	
-	! create table for all jobs:
+	!! create table for all jobs:
 	if ARGS[1] = 2:
 	
-	if evt_event[0] ! '':
+		if evt_event[0] ! '':			
+			killvar '$evtbody'
+			job_idx = 0		
+			*nl
+			:jmp_list_create
+				if evt_silent[job_idx] = 1:
+					$evtbody += '<tr><td>' +$week[evt_dow[job_idx]]+' '+ evt_day[job_idx] + $evt_suffix + ', '+ $monthName[evt_month[job_idx]] +' 20'+ evt_year[job_idx] + '</td><td>' + $evt_job[evt_event[job_idx]] + '</td>' 
+					$evtbody += '<td>' + evt_wages[job_idx] + '₽</td><td>' + evt_hour[job_idx] + ':' +  iif(evt_minutes[job_idx] >= 0 and evt_minutes[job_idx] <= 4, '00', '30') + '</td>'
+					$evtbody += '<td>' + evt_duration[job_idx] + iif(evt_duration[job_idx]  = 1, ' hour',  ' hours') + '</td><td>' + $evt_mc_locat[job_idx] + '</td>'
+					$evtbody += '<td><a  href="exec: gs ''emp_functions'',''del_evt'', 2, <<job_idx>>"><img src="images\system\icons\evt_del.png"></a></a></td></tr>'
+				end
+				job_idx += 1
+				if job_idx < arrsize('evt_event') : jump 'jmp_list_create'
+				if evt_silent[job_idx] = 1: 
+					'<center><h2>Current Task List</h2></center>'		
+					$evtheader = '<tr><th>Date</th><th>Task</th><th>Pay</th><th>Time</th><th>Duration</th><th>Location</th><th>Cancel Job</th></tr>'
+					'<center><table width="90%" align="center" width="90%" cellspacing="5" cellpadding="5" valign="top"><tr><<$evtheader>><<$evtbody>></tr></table></center>'
+				end
+				killvar '$evtbody'
+				killvar '$evtheader'
+			else
+				'You haven''t taken on any jobs yet.'
+			end
+	end
+	!! Display the location acts
 	
-		killvar '$tablebody'
-		job_idx = 0
-		'<center><h2>Current Task List</h2></center>'
-		*nl
-		:jmp_list_create
-			
-			
-			$tablebody += '<tr><td>' +$week[evt_dow[job_idx]]+' '+ evt_day[job_idx] + $evt_suffix + ', '+ $monthName[evt_month[job_idx]] +' 20'+ evt_year[job_idx] + '</td><td>' + $evt_job[evt_event[job_idx]] + '</td>' 
-			$tablebody += '<td>' + evt_wages[job_idx] + '</td><td>' + evt_hour[job_idx] + ':' +  iif(evt_minutes[job_idx]  >= 0 and evt_minutes[job_idx] <= 4, '00',  '30') + '</td>'
-			$tablebody += '<td>' + evt_duration[job_idx] + iif(evt_duration[job_idx]  = 1, ' hour',  ' hours') + '</td><td>' + $transient_mc_locat + '</td>'
-			$tablebody += '<td><a  href="exec: gs ''emp_functions'',''del_evt'', 2, <<job_idx>>"><img src="images\system\icons\evt_del.png"></a></a></td></tr>'
-				
-			job_idx += 1
-			if job_idx < arrsize('evt_event') : jump 'jmp_list_create'
-					
-			$tableheader = '<tr><th>Date</th><th>Task</th><th>Pay</th><th>Time</th><th>Duration</th><th>Location</th><th>Cancel Job</th></tr>'
-			'<center><table width="90%" align="center" width="90%" cellspacing="5" cellpadding="5" valign="top"><tr><<$tableheader>><<$tablebody>></tr></table></center>'
-			act 'Return' : killvar '$tablebody' & gt 'emp_functions', 'init'
-		else
-			'You haven''t taken on any jobs yet.'
+	if ARGS[1] = 3 and evt_chk = '1':
+		act_idx = 0
+		act_tracker = 0
+		act_found = 0
+		:jmp_act_create			
+			 if evt_hour[act_tracker] = hour or evt_hour[act_tracker] = (hour -1): 
+				act_found = 1
+				act_idx = act_tracker 				
+			 end
+			 act_tracker +=1 
+		if act_tracker < arrsize('evt_event') or act_found = 0: jump 'jmp_act_create'
+		if ((evt_hour[act_idx] = hour and evt_minutes[act_idx] <= minut) or evt_hour[act_idx] = (hour - 1)) and $loc = $evt_loc[act_idx]:
+			act 'Attend your ' + $evt_job[evt_event[act_idx]] + ' event':
+				gs 'emp_functions', 'array_init'
+				gt $evt_loc[act_idx], $evt_loc_arg[act_idx]
+				killvar 'act_tracker'
+				killvar 'act_found'
+			end
 		end
 	end
 end
 
 if $ARGS[0] = 'gen_evt':	
+	!! Get the current year - remove 2000 to get the right year for search function.
+	transient_evt_year = year - 2000
+	
+	!! Figure out the month for the seed and ensure it rolls over into new calendar year.
+	if month = 12:			
+		evt_mseed = 1
+		transient_evt_year += 1
+	else
+		evt_mseed = month + 1
+	end
+
+	!! randomise the month and month + 1 	
+	transient_evt_month = rand(month,  evt_mseed)      
+	:jmp_job_create
+		if transient_evt_month = month:
+			if (day + 7) > monthsend[transient_evt_month]:
+				transient_evt_month += 1
+				evt_dseed = 1
+			end	
+		else
+			evt_dseed = day + 1
+		end	
+		rnd_day = rand(evt_dseed, monthsend[transient_evt_month])	
+	if transient_evt_month  = month and rnd_day <= day: jump 'jmp_job_create'	
+					
+	!! Set event transients - will be deleted upon completion
+	transient_evt_hour = rand(9, 20)
+	
+	!! For simplicity sake make minutes on the hour or at half hour intervals, store as a single int.
+	transient_evt_minutes = rand(0, 9)
+	
+	!! Set as multiples of 60 	
+	transient_evt_duration = rand(1,8)
+	
+	!! logic check for when randomising event duration
+	
+	if transient_evt_duration + transient_evt_hour >= 22:
+		transient_evt_hour = 22 - transient_evt_duration
+	end
 
 	!! find a suitable date
 
@@ -252,17 +313,14 @@ if $ARGS[0] = 'gen_evt':
 
 	:setdayloop
 	gs 'shortgs', 'dow',  transient_evt_year, transient_evt_month,  srch_day_l
-	! 'idx day: ' + srch_day_l
 	if result =  transient_evt_dow: 
 		transient_evt_day = srch_day_l
-		!'Day of week <<transient_evt_day>> : <<$week[result]>> '
 	srch_day_l = 99
 	else	        
 	srch_day_l += 1					
 	end 	
 
 	if srch_day_l <= srch_day_u: jump 'setdayloop'	
-
 end
 
 ! ------ Helper Functions ------
@@ -281,9 +339,10 @@ if $ARGS[0] = 'job_evt':
 end
 
 if $ARGS[0] = 'wage_evt':
-!! calculate wages
-!! Assume you''ll never earn less than 100 roubles
-!! 0 for none, 1 - for a small payment (100-500),  2 - moderate payment (500-1000) or 3 - large payment (1000-2000)
+	!! calculate wages
+	!! Assume you''ll never earn less than 100 roubles
+	!! 0 for none, 1 - for a small payment (100-500),  2 - moderate payment (500-1000), 3 - large payment (1000-2000),  4 - huge payment (2000-4000)
+	!! 5 is for custom payments
 
 	if ARGS[1] = 0:
 		transient_evt_wages = 0
@@ -293,42 +352,64 @@ if $ARGS[0] = 'wage_evt':
 		transient_evt_wages =  func('shortgs','round_tool',rand(500,1000), 50)
 	elseif ARGS[1] = 3:
 		transient_evt_wages =  func('shortgs','round_tool',rand(1000,2000), 50)
-	elseif ARGS[1] > 4:
-	transient_evt_wages  = ARGS[2]
+	elseif ARGS[1] = 4:
+		transient_evt_wages =  func('shortgs','round_tool',rand(2000,4000), 50)
+	elseif ARGS[1] = 5:
+		transient_evt_wages  = ARGS[2]
 	end
 end
 
 if $ARGS[0] = 'cat_evt':
+	!! Construct Array Table  and clear transients when an event is created and accepted.
 
-!! Construct Array Table  and clear transients when an event is created and accepted.
+	!! Create global variables for the current live event.
 
-!! Create global variables for the current live event.
+	!! Use 0 to create hidden events, 1 to show in journal
 	evt_silent[] = transient_evt_silent
+	!! Event type used in Journal
 	evt_event[] = transient_evt_type
+	!! Additional ID if required 
+	evt_event_sub[] = transient_evt_sub_type 
+	!! Day of Week used in Journal and content areas
 	evt_dow[] = transient_evt_dow
+	!! Event Date to check against current date & used in Journal and content areas
 	evt_day[] = transient_evt_day
+	!! Event month to check against current month & used in Journal and content areas
 	evt_month[] =  transient_evt_month
+	!! Event Year to check against year & used in Journal and content areas
 	evt_year[] = transient_evt_year
+	!! Event hour to check against hour & used in Journal and content areas
 	evt_hour[] = transient_evt_hour
+	!! Event minutes to check against minut & used in Journal and content areas
 	evt_minutes[] = transient_evt_minutes
+	!! How long the event is to last
 	evt_duration[] = transient_evt_duration
+	!! How much wages, generated or manual using function
 	evt_wages[] = transient_evt_wages
+	!! Journal location as reminder
 	$evt_mc_locat[] = $transient_mc_locat
+	!! The following are event location triggers to allow the content to appear in areas such as community centre but host their content elsewhere such as Photography shop
+	!! 	Event area triggers such as city_residential
 	$evt_loc[] = $transient_loc
 	$evt_loc_arg[] = $transient_arg 
-	$evt_exec[] = $transient_trigger
-	$evt_media[] = $transient_img
-
-
-	'Job accepted, you currently have ' + arrsize('evt_event') + ' jobs assigned to you. Please look at your journal for more information.'
-	gs 'emp_functions',  'del_evt', 1
-	act 'Return': gt 'emp_functions', 'evt_init'
+	!! Content location - optional
+	$evt_trigger_exec = $transient_evt_exec
+	$evt_trigger[] = $transient_trigger
+	!! Journal and event description
+	$evt_desc[] = $transient_desc
+	
+	if transient_evt_silent = 1:
+		*clr & cla
+		'Job accepted, you currently have ' + arrsize('evt_event') + ' jobs assigned to you. Please look at your journal for more information.'
+		gs 'emp_functions',  'del_evt', 1
+		act 'Return': gt 'emp_functions', 'evt_init'
+	end
 end
 
 !! delete event after firing or cancelled
 
 if $ARGS[0] = 'del_evt':
-! Delete transients
+	!! Delete transients
 	if ARGS[1] = 1:
 		killvar 'transient_evt_silent'
 		killvar 'transient_event_type'
@@ -342,6 +423,7 @@ if $ARGS[0] = 'del_evt':
 		killvar '$transient_arg'
 		killvar '$transient_trigger'	
 		killvar '$transient_img'
+		killvar '$transient_desc'
 		killvar 'rnd_min'	
 		killvar 'mseed'
 		killvar 'dseed' 
@@ -378,6 +460,8 @@ if $ARGS[0] = 'del_evt':
 					killvar '$evt_loc_arg', evt_idx
 					killvar '$evt_exec', evt_idx
 					killvar '$evt_media', evt_idx
+					killvar '$evt_desc', evt_idx
+
 					act 'Return': gt 'emp_functions', 'init'
 				end 	 
 				act 'Cancel': gt 'emp_functions', 'init'
@@ -418,6 +502,18 @@ if $ARGS[0] = 'evt_day_suffix':
 	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 = 1
+		:evt_day_chk
+			if month = evt_month and day = evt_day: evt_chk = '1'
+		if job_idx < arrsize('evt_event') : jump 'evt_day_chk'
+	end
+end
+
 !! --------------------- End Event Generator
 
 !! --------------------- Job management system
@@ -508,11 +604,4 @@ if $ARGS[0] = 'loop_configure':
 		d_end= 7
 	end	
 end
---- emp_functions ---------------------------------
-
-
-
-
-
-
-
+--- emp_functions ---------------------------------

+ 7 - 2
locations/journal_work.qsrc

@@ -5,7 +5,7 @@
 !! Game Character work section. This is the container file for all work roles in game. Used to track income, work days and other relevant data.
 !! V .01 Refactored code from Journal section into it''s own section to make legibility easier.
 !! V. 02 New job schedule system integrated
-!!
+!! V. 03 New Ad Hoc management interface integration - ongoing
 
 if $ARGS[0] = 'start':
 
@@ -14,13 +14,18 @@ if $ARGS[0] = 'start':
 	act 'Return to top journal page': gt 'journal', 'records'
 	$jumploc = 'worktab'
 	gs 'journal', 'journalmenu'
+	
 	'<center><h2>Work</h2></center>'
 	if emp_job[active] < 1:
 		'You need to find a job or get training to develop your career. Check the Quests or Information section.'
 	else
 		function_sw = 2
 		gs 'emp_functions', 'gen_schedule'
-	end
+		
+	end	
+	!! Show any ad hoc events or contracts
+	
+	if arrsize('evt_event') ! 0: gs 'emp_functions', 'disp_evt', 2
 	
 	if workPTU > 2:'You work as a teacher at the Lycée and your schedule is Monday to Saturday, teaching between 14:00 and 16:00. Your salary is 300 <b>₽</b> per day.'
 	if (work = 1 or cheatWork = 1) and workKafe['job'] > 0:'You are working as a waitress at The Roadhouse cafe. You need to come to work between 11:00-12:00 while your working days are: Tuesday, Wednesday, and Thursday. At work, you can receive tips from customers and your wages are received on 25th of each month.'

+ 90 - 88
locations/shop_photography.qsrc

@@ -1,5 +1,4 @@
 # shop_photography
-
 !! Photography shop in the City Center Mall
 !! Variables used:
 !! photographyEv = Track shop progression through buying a camera
@@ -24,55 +23,25 @@ if $ARGS[0] = 'start':
 	'<center><img src="images/locations/city/citycenter/mall/photoshop/shop.jpg"></center>'
 	'The shop is dedicated to cameras and is celebrating this fact by displaying a myriad of them along every wall. A singular counter sits just off the adjacent wall with the shopkeeper standing behind it, clearly eager for some trade to enter his shop.'
 
-	if photography_job >= 1 and week >= 6:
-		act 'Ask about work':
+	if photography_start = 1 and week >= 6:
+		act 'Ask about work':		
 			*clr & cla
 			minut += 10
 			gs 'stat'
 			'<center><img src="images/locations/city/citycenter/mall/photoshop/owner.jpg"></center>'
-			if photography_job = 1:
-				dynamic $photojob[1]
+			if photography_start = 1:
+				dynamic $photojob[evt_PhotoID]
 				'You walk up to Branko. "Excuse me Branko, but you said you might have some work for me. Would you happen to have anything?"'
-				'He smiles at you. "Yes yes, I remember. Let me check." He opens a laptop sitting on the counter next to him and taps on the keys before he looks up at you. "Yes I do have a job, the Tank and <<$photojob_description>>. I will pay you two thousand rubles, with a bonus if you do very good work. It has to be done today, if you are interested."'
-				act 'Decline the assignment':
-					*clr & cla
-					gs 'stat'
-					'<center><img src="images/locations/city/citycenter/mall/photoshop/owner.jpg"></center>'
-					'You shake your head. "Sorry I can''t, I have other things already planned this weekend. Maybe next weekend?"'
-					'He nods in understanding. "I understand, but I''m afraid that won''t be happening next week. Check with me next weekend and I might have something else."'
-					'You smile at him. "Okay, thanks." With that, you leave the store.'
-					act 'Leave':
-						cla
-						minut += 3
-						gt 'torgcentr'
-					end
-				end
-				act 'Take the assignment':
-					*clr & cla
-					gs 'stat'
-					'<center><img src="images/locations/city/citycenter/mall/photoshop/owner.jpg"></center>'
-					'You can''t help but smile and feel excited. Your first paying gig as a photographer! "Yes, I would love to! Just tell me where I have to go."'
-					'He smiles. "Excellent!" He prints out a page and hands it to you. "Okay, here''s where it is and a list of the photos I need. When you finish, come back here to give the representative the SD card. I''ll then transfer your pay to your account."'
-					'You smile at him. "Thank you, I will go there now." With that, you leave the store.'
-					act 'Go to work': gt 'shop_photography' , 'photojob'
-				end
-			else
-				'You walk up to Branko. "Excuse me Branko, do you have more work for me?"'
-				if photography_job < ARRSIZE('$photojob'):
-					'He smiles at you. "Let me check." He opens a laptop sitting on the counter next to him and taps on the keys before he looks up at you. "Yes I do have a job, the pay will be the same as before. It has to be done today, if you are interested."'
-					act 'What''s the assignment': gt 'shop_photography' , 'work'
-				else
-					'He smiles at you. "Let me check." He opens a laptop sitting on the counter next to him and taps on the keys before he looks up at you with a frown. "Sorry, I don''t have any work for you right now. Try again next weekend."'
-					act 'Leave':
-						cla
-						minut += 3
-						gt 'torgcentr'
-					end
-				end
+				'He smiles at you. "Yes yes, I remember. You''re <<$pcs_nickname>>,  Let me check." He opens a laptop sitting on the counter next to him and taps on the keys before he looks up at you.'
+				
+				!! Init Job Array
+				gs 'shop_photography', 'job_init'
+				gs 'emp_functions', 'disp_evt', 1
+				
 			end
 		end
 	end
-	if photographyEv = 2 and photography_job = 0:
+	if photographyEv = 2 and photography_start = 0:
 		act 'Show portfolio': gt 'shop_photography' , 'showportfolio'
 	end
 	act 'Talk to the shop owner':
@@ -182,19 +151,19 @@ if $ARGS[0] = 'showportfolio':
 		'"Yes yes, when you get more experience I might have a fantastic business opportunity for you! You see, in addition to the shop you see before you, I also have a side business in commissioned photography and from what I''ve seen, you might just be the person I''m looking for; you''ll be paid of course! But first practice, practice practice!"'
 		'You frown a little. At least he likes your work. "Okay, I will. I''ll keep practicing and when I feel I''ve improved, I''ll return."'
 	elseif pcs_photoskl <= 50:
-		photography_job = 1
+		photography_start = 1
 		'"Ah, your portfolio, by all means I would love to peruse through it!"'
 		'"Mmmm.... these photographs are good. You have a real eye! With a little more practice, you will become a very skilled photographer."'
 		'"You can call me Branko. I have a fantastic business opportunity for you! You see, in addition to the shop you see before you, I also have a side business in commissioned photography and from what I''ve seen, you''re the perfect person to help me with some additional work. There will be no pressure, just visit my beautiful shop at the weekend and I''ll let you know if there''s any photography jobs you can do for me; you''ll be paid of course!"'
 		'"Wow, that sounds interesting. I''ll visit when I can."'
 	elseif pcs_photoskl <= 75:
-		photography_job = 1
+		photography_start = 1
 		'"Ah, your portfolio, by all means I would love to peruse through it!"'
 		'"Mmmm.... these photographs are terrific. Sensational, absolutely sensational."'
 		'"You can call me Branko. I have a fantastic business opportunity for you! You see, in addition to the shop you see before you, I also have a side business in commissioned photography and from what I''ve seen, you''re the perfect person to help me with some additional work. There will be no pressure, just visit my beautiful shop and I''ll let you know if there''s any photography jobs you can do for me; cash in hand of course!"'
 		'"Wow, that sounds interesting. I''ll visit when I can."'
 	else
-		photography_job = 1
+		photography_start = 1
 		'"Ah, your portfolio, by all means I would love to peruse through it!"'
 		'"Mmmm.... My god... These are simply breathtaking my dear, just breathtaking! I don''t think I''ve ever meet anyone with as much potential as you in my life! With a little more seasoning, you could become one of the greatest photographers of our time!"'
 		'"You can call me Branko. I have a fantastic business opportunity for you! You see, in addition to the shop you see before you, I also have a side business in commissioned photography and from what I''ve seen, you''re the perfect person to help me with some additional work. There will be no pressure, just visit my beautiful shop and I''ll let you know if there''s any photography jobs you can do for me; you''ll be paid of course!"'
@@ -208,91 +177,125 @@ if $ARGS[0] = 'work':
 	minut += 10
 	gs 'stat'
 	'<center><img src="images/locations/city/citycenter/mall/photoshop/owner.jpg"></center>'
-	dynamic $photojob[photography_job]
 	'You can''t help but smile and feel excited. Yet another paying job as a photographer! "Yes I would love to, just tell me what you have."'
-	'He smiles. "Excellent! I need photos of <<$photojob_description>>" He prints out a page and hands it to you. "Okay, here''s where it is and a list of the photos I need. When you finish, come back here to give me the photos and get paid."'
+	'He smiles. "Excellent! I need photos of <<$transient_desc>>" He prints out a page and hands it to you. "Okay, here''s where it is and a list of the photos I need. When you finish, come back here to give me the photos and get paid."'
 	'You smile at him. "Thank you, I''ll go there now." With that, you leave the store.'
 	act 'Go to work': gt 'shop_photography' , 'photojob'
 end
 
 if $ARGS[0] = 'photojob':
 	*clr & cla
+	gs 'exp_gain', 'photoskl', rand(1,50)
+	gs 'stat'
 	photography_job += 1
 	photojob_daystart = daystart
 	! Prevent taking a new job on the sunday following today
 	if week = 6: photojob_daystart += 1
 	minut += rand(1,2)
 	gs 'stat'
-	$loc = $photojob_loc
+	$loc =$transient_mc_locat
 	$loc_arg = $photojob_loc_arg
-	gt 'shop_photography', $photojob_ev
-end
-
-! Call at the end of each photo job event to tidy up
-if $ARGS[0] = 'photojob_cleanup':
-	KILLVAR '$photojob_shortname'
-	KILLVAR '$photojob_description'
-	KILLVAR '$photojob_loc'
-	KILLVAR '$photojob_loc_arg'
-	KILLVAR '$photojob_ev'
+	gt 'shop_photography', $transient_trigger
 end
 
 if $ARGS[0] = 'photojob_pay':
-	gs 'exp_gain', 'photoskl', rand(1,50)
-	gs 'stat'
-	photopay = 2000
 	if pcs_photoskl > 125:
-		photopay += 4000
+		gs 'emp_functions', 'wage_evt', 4
 	elseif pcs_photoskl > 100:
-		photopay += 2500
+		gs 'emp_functions', 'wage_evt', 3
 	elseif pcs_photoskl > 75:
-		photopay += 1500
+		gs 'emp_functions', 'wage_evt', 2
 	elseif pcs_photoskl > 50:
-		photopay += 1000
+		gs 'emp_functions', 'wage_evt', 1
+	else
+		gs 'emp_functions', 'wage_evt', 5, 50
 	end
-	money += photopay
-	gs 'stat'
 end
 
+!! Photography jobs functions
+
+if $ARGS[0] = 'job_init':
+	!! Set up arrays if not initialised
+	if $evt_job[1] = '' :  gs 'emp_functions', 'job_evt'
+	array_len = ARRSIZE('$photojob')
+	array_len = array_len -1	
+	evt_PhotoID = rand(1, array_len)
+	dynamic $photojob[evt_PhotoID]
+	!! set Day of Week for job to appear on	
+	transient_evt_dow = 6
+	!! evt_silent - hide event from player  in journal (or other locations) - 1 to enable.
+	transient_evt_silent = 0 
+    !! Now set up the event date
+    gs 'shop_photography' , 'photojob_pay'
+    gs 'emp_functions', 'gen_evt'
+end
+
+
 ! Array of photography jobs - additional events should be easy to wire up
 $photojob[1] = {
+	!!Ensure the event is visible in journal:
+	transient_evt_silent = 1
+	!! Set the job type as per list
+	transient_evt_type = 1
+	transient_evt_sub_type = 1
 	$photojob_shortname = 'Tank'
-	$photojob_description = 'Tank and Bazooka Experience Day in Levingrad Oblast'
-	$photojob_loc = 'city_industrial'
-	$photojob_loc_arg = ''
-	$photojob_ev = 'phototank'
+	$transient_desc = 'Tank and Bazooka Experience Day in Levingrad Oblast'
+	!! Field for trigger location
+	$transient_loc = 'city_industrial'
+	$transient_arg = ''
+	!! Journal loc description
+	$transient_mc_locat = 'St Petersburg Industrial Area'
+	!! Event content location
+	$transient_evt_exec=  'shop_photography'
+	$transient_trigger = 'phototank'
 }
 
 $photojob[2] = {
+	transient_evt_silent = 1
+	transient_evt_type = 1
+	transient_evt_sub_type = 2
 	$photojob_shortname = 'Model'
-	$photojob_description = 'Newspaper Commission at Petrovskaya Akvatoria'
-	$photojob_loc = 'shop_photography'
-	$photojob_loc_arg = 'start'
-	$photojob_ev = 'photomodel'
+	$transient_desc = 'Newspaper Commission at Petrovskaya Akvatoria'
+	$transient_loc = 'shop_photography'
+	$transient_arg = 'start'
+	$transient_mc_locat = 'Meet Branko at the Photography Shop'
+	$transient_trigger = 'photomodel'
 }
 
 $photojob[3] = {
+	transient_evt_silent = 1
+	transient_evt_type = 1
+	transient_evt_sub_type = 3
 	$photojob_shortname = 'Wedding'
-	$photojob_description = 'Wedding at Yelagin Palace'
-	$photojob_loc = 'city_residential'
-	$photojob_loc_arg = ''
-	$photojob_ev = 'photowedding'
+	$transient_desc = 'Wedding at Yelagin Palace'
+	$transient_loc = 'city_residential'
+	$transient_arg = ''
+	$transient_mc_locat = 'St Petersburg Residential Area'
+	$transient_trigger = 'photowedding'
 }
 
 $photojob[4] = {
+	transient_evt_silent = 1
+	transient_evt_type = 1
+	transient_evt_sub_type = 4
 	$photojob_shortname = 'Motorsport'
-	$photojob_description = 'Russian Touring Car Championship Event at St. Petersburg Autodrome'
-	$photojob_loc = 'city_industrial'
-	$photojob_loc_arg = ''
-	$photojob_ev = 'photomotorsport'
+	$transient_desc = 'Russian Touring Car Championship Event at St. Petersburg Autodrome'
+	$transient_loc = 'city_industrial'
+	$transient_arg = ''
+	$transient_mc_locat = 'St Petersburg Industrial Area'
+	$transient_trigger = 'photomotorsport'
 }
 
 $photojob[5] = {
+	transient_evt_silent = 1
+	transient_evt_type = 1
+	transient_evt_sub_type = 5
 	$photojob_shortname = 'Court'
-	$photojob_description = 'Press Event at City Courthouse'
-	$photojob_loc = 'shop_photography'
-	$photojob_loc_arg = 'start'
-	$photojob_ev = 'photocourt'
+	$transient_desc = 'Press Event at City Courthouse'
+	$transient_loc = 'shop_photography'
+	$transient_arg = 'start'
+	$transient_mc_locat = 'Meet Branko at the Photography Shop'
+	$transient_trigger = 'photocourt'
 }
 
 if $ARGS[0] = 'phototank':
@@ -395,6 +398,5 @@ if $ARGS[0] = 'photocourt':
 	act 'Return' : gt $loc, $loc_arg
 end
 
-
 --- shop_photography ---------------------------------