This is the medical emergencies file for the human player in the sandbox. I have added my comments in dark red. These comments are based on my own analysis of the code and my experience in working with it. I do not have any special inside information from MuckyFoot about these files, and I may in some instances be wrong.
;EMERGENCIES********************************************************** ;This tells the scripts to generates the emergency and broadcast it :EmergencyMain if turn > EmergencyTrigger then set EmergencyAccept 3 set EmergencyTaken 0 set EmergencyGenerated 0 set EmergencyType ((rnd%12) + 1) set EmergencyTrigger ((turn + (rnd%10000)) + 10000) end :Emergency01 if EmergencyGenerated = 0 EmergencyType = 1 then multitrigger :EmergencyMessage01 set EmergencyGenerated 1 end :Emergency02 if EmergencyGenerated = 0 EmergencyType = 2 then multitrigger :EmergencyMessage02 set EmergencyGenerated 1 end :Emergency03 if EmergencyGenerated = 0 EmergencyType = 3 then multitrigger :EmergencyMessage03 set EmergencyGenerated 1 end :Emergency04 if EmergencyGenerated = 0 EmergencyType = 4 then multitrigger :EmergencyMessage04 set EmergencyGenerated 1 end :Emergency05 if EmergencyGenerated = 0 EmergencyType = 5 then multitrigger :EmergencyMessage05 set EmergencyGenerated 1 end :Emergency06 if EmergencyGenerated = 0 EmergencyType = 6 then multitrigger :EmergencyMessage06 set EmergencyGenerated 1 end :Emergency07 if EmergencyGenerated = 0 EmergencyType = 7 then multitrigger :EmergencyMessage07 set EmergencyGenerated 1 end :Emergency08 if EmergencyGenerated = 0 EmergencyType = 8 then multitrigger :EmergencyMessage08 set EmergencyGenerated 1 end :Emergency09 if EmergencyGenerated = 0 EmergencyType = 9 then multitrigger :EmergencyMessage09 set EmergencyGenerated 1 end :Emergency10 if EmergencyGenerated = 0 EmergencyType = 10 then multitrigger :EmergencyMessage10 set EmergencyGenerated 1 end :Emergency11 if EmergencyGenerated = 0 EmergencyType = 11 then multitrigger :EmergencyMessage11 set EmergencyGenerated 1 end :Emergency12 if EmergencyGenerated = 0 EmergencyType = 12 then multitrigger :EmergencyMessage12 set EmergencyGenerated 1 end :EmergencyMessage01 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency01" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage02 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency02" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage03 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency03" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage04 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency04" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage05 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency05" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage06 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency06" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage07 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency07" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage08 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency08" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage09 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency09" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage10 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency10" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage11 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency11" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyMessage12 if 0 then incoming ship_comms respond EmergencyAccept within 1440 skill ((rnd%10000) + 100) "events_emergency12" ; status_message "DEBUG ** Medical emergency has been created ** DEBUG" disable end :EmergencyAccept00 if EmergencyAccept = 2 EmergencyTaken = 0 then multitrigger :EmergencyTaken00 set PatientMax ((((rnd%segmentdecks) + 1) / 4) + 3) set AllPatients ((array curedsofar 1) + PatientMax) set EmergencyAccept 3 set BonusPaid 0 end :EmergencyAccceptLate00 if EmergencyAccept = 2 EmergencyTaken = 1 then incoming local_comms within 720 icon 4 "events_edocking01" set EmergencyAccept 3 end :EmergencyIgnoreDecline00 if EmergencyAccept < 2 then set EmergencyAccept 3 end :EmergencyTaken00 if 0 then set EmergencyTaken 1 set EmergencyAccept 3 disable end :PeepGeneratorInitialise00 if PatientArrive = PatientMax PatientArrive > 0 PatientMax > 0 then set PatientArrive 0 set PatientMax 0 end :PeepGenerator01 if EmergencyType = 1 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 1 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator02 if EmergencyType = 2 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 2 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator03 if EmergencyType = 3 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 3 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator04 if EmergencyType = 4 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 4000) infected 4 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator05 if EmergencyType = 5 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 5 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator06 if EmergencyType = 6 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 6 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator07 if EmergencyType = 7 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 7 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator08 if EmergencyType = 8 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 8 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator09 if EmergencyType = 9 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 9 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator10 if EmergencyType = 10 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 10 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator11 if EmergencyType = 11 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 11 1 set PatientArrive (PatientArrive + 1) end :PeepGenerator12 if EmergencyType = 12 PatientArrive < PatientMax then place_peep ((rnd%9) + 5) mood body ((rnd%2000) + 2000) infected 12 1 set PatientArrive (PatientArrive + 1) end :EmergencyFees00 if array curedsofar 1 > PaidCures then addenergy 1000 set PaidCures (array curedsofar 1) status_message "events_cure01" end :EmergencyBonus00 if BonusPaid = 0 array curedsofar 1 = AllPatients then incoming local_comms icon 4 "events_treatment01" addenergy 10000 set BonusPaid 1 end