|
@@ -1,12 +1,13 @@
|
|
|
# emp_functions
|
|
|
|
|
|
!! Employmnent and Event Systems
|
|
|
-!! 2022-09-30
|
|
|
+!! 2023-02-12
|
|
|
!! Author: Hooded Silence
|
|
|
!!
|
|
|
!! v.01 - Initial code base
|
|
|
!! v.02 - Event generator partially integrated
|
|
|
!! v.03 - Job management system integrated
|
|
|
+!! v. 04 - Start of event generation code integration
|
|
|
!!
|
|
|
|
|
|
!! --------------------- UI Interface for Journal
|
|
@@ -168,8 +169,6 @@ if $ARGS[0] = 'job_info':
|
|
|
msg '<<$msg_body>>'
|
|
|
end
|
|
|
|
|
|
-!! Removed event generation for initial code review and to make job integration easier.
|
|
|
-
|
|
|
!! --------------------- Event Generator
|
|
|
|
|
|
!! Author - Hooded Silence
|
|
@@ -178,7 +177,248 @@ end
|
|
|
!!
|
|
|
!! v. 01 - Initial code base
|
|
|
!! v. 02 - UI improvements and feature feedback
|
|
|
+!! V. 03 - Initial integration into mainline code
|
|
|
+
|
|
|
+if $ARGS[0] = 'evt_init'
|
|
|
+
|
|
|
+!! Placeholder, pending integration
|
|
|
+
|
|
|
+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?'
|
|
|
+ *nl
|
|
|
+ '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
|
|
|
+
|
|
|
+ act 'Accept the job' : gs 'emp_functions', 'cat_evt'
|
|
|
+ act 'Decline the job':
|
|
|
+ gs 'emp_functions', 'del_evt', 1
|
|
|
+ gt 'emp_functions', 'init'
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ ! create table for all jobs:
|
|
|
+ if ARGS[1] = 2:
|
|
|
+
|
|
|
+ if evt_event[0] ! '':
|
|
|
+
|
|
|
+ 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.'
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+if $ARGS[0] = 'gen_evt':
|
|
|
+
|
|
|
+ !! find a suitable date
|
|
|
+
|
|
|
+ srch_day_u = rnd_day + 7
|
|
|
+ if srch_day_u >= monthsend[transient_evt_month]:
|
|
|
+ srch_day_u = monthsend[transient_evt_month]
|
|
|
+ srch_day_l = monthsend[transient_evt_month] - rand(7,14)
|
|
|
+ else
|
|
|
+ srch_day_l = rnd_day
|
|
|
+ end
|
|
|
+
|
|
|
+ :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 ------
|
|
|
+
|
|
|
+if $ARGS[0] = 'job_evt':
|
|
|
+ !! Jobs ID list
|
|
|
+
|
|
|
+ $evt_job[1] = 'Photography'
|
|
|
+ $evt_job[2] = 'Modelling'
|
|
|
+ $evt_job[3] = 'Music Gig'
|
|
|
+ $evt_job[4] = 'Dance Show'
|
|
|
+ $evt_job[5] = 'Ballet Performance'
|
|
|
+ $evt_job[6] = 'Acting'
|
|
|
+ $evt_job[50] = 'Sport'
|
|
|
+
|
|
|
+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)
|
|
|
+
|
|
|
+ if ARGS[1] = 0:
|
|
|
+ transient_evt_wages = 0
|
|
|
+ elseif ARGS[1] = 1:
|
|
|
+ transient_evt_wages = func('shortgs','round_tool',rand(100,500), 50)
|
|
|
+ elseif ARGS[1] = 2:
|
|
|
+ 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]
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+if $ARGS[0] = 'cat_evt':
|
|
|
+
|
|
|
+!! Construct Array Table and clear transients when an event is created and accepted.
|
|
|
+
|
|
|
+!! Create global variables for the current live event.
|
|
|
+ evt_silent[] = transient_evt_silent
|
|
|
+ evt_event[] = transient_evt_type
|
|
|
+ evt_dow[] = transient_evt_dow
|
|
|
+ evt_day[] = transient_evt_day
|
|
|
+ evt_month[] = transient_evt_month
|
|
|
+ evt_year[] = transient_evt_year
|
|
|
+ evt_hour[] = transient_evt_hour
|
|
|
+ evt_minutes[] = transient_evt_minutes
|
|
|
+ evt_duration[] = transient_evt_duration
|
|
|
+ evt_wages[] = transient_evt_wages
|
|
|
+ $evt_mc_locat[] = $transient_mc_locat
|
|
|
+ $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'
|
|
|
+end
|
|
|
+
|
|
|
+!! delete event after firing or cancelled
|
|
|
+
|
|
|
+if $ARGS[0] = 'del_evt':
|
|
|
+! Delete transients
|
|
|
+ if ARGS[1] = 1:
|
|
|
+ killvar 'transient_evt_silent'
|
|
|
+ killvar 'transient_event_type'
|
|
|
+ killvar 'transient_evt_year'
|
|
|
+ killvar 'transient_evt_month'
|
|
|
+ killvar 'transient_evt_hour'
|
|
|
+ killvar 'transient_evt_minutes'
|
|
|
+ killvar 'transient_evt_duration'
|
|
|
+ killvar 'transient_evt_wages'
|
|
|
+ killvar '$transient_loc '
|
|
|
+ killvar '$transient_arg'
|
|
|
+ killvar '$transient_trigger'
|
|
|
+ killvar '$transient_img'
|
|
|
+ killvar 'rnd_min'
|
|
|
+ killvar 'mseed'
|
|
|
+ killvar 'dseed'
|
|
|
+ end
|
|
|
+
|
|
|
+ ! Delete array entry
|
|
|
+
|
|
|
+ if ARGS[1] = 2:
|
|
|
+ !! delete event after firing or cancelled.
|
|
|
+ !! killvar 'arr_name', index
|
|
|
+ if ARGS[2] >= 0:
|
|
|
+ evt_idx = ARGS[2]
|
|
|
+ cla
|
|
|
+ 'You''re about to delete this job: '
|
|
|
+ 'Delete: ' + evt_event
|
|
|
+ 'Index: ' + evt_idx
|
|
|
+ Act 'Confirm?':
|
|
|
+ cla
|
|
|
+ 'Are you sure?'
|
|
|
+ act 'Deleting':
|
|
|
+ cla
|
|
|
+ killvar 'evt_silent', evt_idx
|
|
|
+ killvar 'evt_event', evt_idx
|
|
|
+ killvar 'evt_dow', evt_idx
|
|
|
+ killvar 'evt_day', evt_idx
|
|
|
+ killvar 'evt_month', evt_idx
|
|
|
+ killvar 'evt_year', evt_idx
|
|
|
+ killvar 'evt_hour', evt_idx
|
|
|
+ killvar 'evt_minutes', evt_idx
|
|
|
+ killvar 'evt_duration', evt_idx
|
|
|
+ killvar 'evt_wages', evt_idx
|
|
|
+ killvar '$evt_mc_locat', evt_idx
|
|
|
+ killvar '$evt_loc', evt_idx
|
|
|
+ killvar '$evt_loc_arg', evt_idx
|
|
|
+ killvar '$evt_exec', evt_idx
|
|
|
+ killvar '$evt_media', evt_idx
|
|
|
+ act 'Return': gt 'emp_functions', 'init'
|
|
|
+ end
|
|
|
+ act 'Cancel': gt 'emp_functions', 'init'
|
|
|
+ end
|
|
|
+ else
|
|
|
+ '<<evt_idx>> - Invalid record - please check your index'
|
|
|
+ end
|
|
|
+ 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
|
|
|
|
|
|
+!! --------------------- End Event Generator
|
|
|
|
|
|
!! --------------------- Job management system
|
|
|
|