Advertisement
Guest User

sendBillboard

a guest
Feb 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. print("Billboard sharing...")     -- Displays the name at the start
  2. tostring(read()) -- This makes the output the user writes be a string
  3. filePath = "billboard.txt" -- This assigns whatever the user writes to become the variable: filePath.
  4. computerNumber = 1
  5. print("Preparing text file...") -- Tells the user the data is being processed and it is making the file sendable.
  6. local fileToSend = fs.open(filePath, "r")
  7. fileContents = fileToSend.readAll()
  8. strFile = textutils.serialize(fileContents)
  9. term.clear() -- clears screen
  10. term.setCursorPos(1,1) -- sets cursor position to top left of screen
  11. print("Please run the receive program on the receiving computer, then press 's' to send")
  12. local event, param1 = os.pullEvent("char") -- this waits for a key to be pressed
  13. if param1 == "s" then -- if you press the s key then
  14.   print("Sending...") -- prints sending
  15.   rednet.send(computerID, strFile) -- Sends file
  16.   sleep(0.5) -- waits half a second
  17.   p1rint("Sent!") -- tells user it has sent
  18. else -- if it is another key then
  19.   print("wrong key") -- prints wrong key
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement