Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this program deals with all the Personal Data of the facility
- local Target = nil
- local Action = nil
- local Contacted_ID = nil
- local Current_Protocol = nil
- local Location = nil
- start()
- function start()
- Standby()
- end
- function Standby()
- rednet.open("top")
- repeat
- local id, message, protocol = rednet.receive()
- until message == "Test Update" or message == "Schedule" or message == "Personal File Update" or message == "Add Player"
- Contacted_ID = id
- Current_Protocol = protocol
- if message == "Test Update" then
- PersonalTaskEditor()
- elseif message == "Schedule" then
- PersonalScheduleEditor()
- elseif message == "Personal File Update" then
- PersonalProfileEditor()
- elseif message == "Add Player" then
- PersonalFileEditor()
- end
- end
- function PersonalTaskManager()
- rednet.open("top")
- repeat
- local id, message = rednet.receive()
- until id == Contacted_ID
- Target = message
- rednet.send(Contacted_ID,"Found",Current_Protocol)
- repeat
- local id, message = rednet.receive()
- until id == Contacted_ID
- location = message
- rednet.send(Contacted_ID,"y",Current_Protocol)
- repeat
- local id, message = rednet.receive()
- until id == Contacted_ID
- Action = message
- local file = fs.open("PersonalTasks","a")
- local i = 1
- while true do
- if file.readLine(i) == Target then
- break
- else
- i = i + 1
- end
- end
- file.setCursorPos(1,i+1)
- file.clearLine(i+1)
- file.write(Action)
- file.close()
- rednet.send(Contacted_ID,"Updated",Current_Protocol)
- Target = nil
- Action = nil
- Contacted_ID = nil
- Current_Protocol = nil
- Location = nil
- Standby()
- end
- function PersonalScheduleEditor()
- rednet.open("top")
- repeat
- local id, message = rednet.receive()
- until id == Contacted_ID
- Target = message
- rednet.send(Contacted_ID,"Method",Current_Protocol)
- repeat
- local id, message = rednet.receive()
- until id == Contacted_ID
- if message == "view" then
- rednet.send(Contacted_ID,"sending file",Current_Protocol)
- local file = fs.open(Target.."_Schedule","r")
- local fileContents = file.readAll()
- file.close()
- rednet.send(Contacted_ID,fileContents,Current_Protocol)
- elseif message == "Set" then
- rednet.send(Contacted_ID,"ready",Current_Protocol)
- repeat
- local id, message = rednet.receive()
- until id == Contacted_ID
- local file = fs.open(Target.."_Schedule","w")
- file.clear()
- file.write(message)
- file.close()
- rednet.send(Contacted_ID,"Saved",Current_Protocol)
- end
- end
Add Comment
Please, Sign In to add comment