Rolcam

Computercraft Tutorial - Section 2 - Basic Commands

Jun 14th, 2021 (edited)
464
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --This is part of a Computercraft Programming Teaching Program
  2.  
  3. tSides = {"left","right","bottom","top","front","back"}
  4.  
  5. for i = 1, #tSides do
  6.   monitor = peripheral.wrap(tSides[i])
  7.   if monitor then
  8.         side = tSides[i]
  9.         break
  10.   end
  11. end
  12. --Prevents program termination
  13. os.pullEvent = os.pullEventRaw
  14. term.redirect(peripheral.wrap(side))
  15.  
  16. -- Resets Screen
  17. function reset()
  18. term.setTextColor(colors.white)
  19. term.setBackgroundColor(colors.black)
  20. term.clear()
  21. term.setCursorPos(1,1)
  22. end
  23.  
  24. reset()
  25. print("Section 2: Basic Commands \n ")
  26. print("term.clear() - Clears the entire screen")
  27. print("This will also fill the screen with the background color selected")
  28. print("sleep(#) - Pauses the program for \"#\" number of seconds")
  29. print("shell.run(<command>) - Runs the command put in the () as if you typed it into the terminal")
  30. print("read(\"*\") - makes what you type into * - great for covering passwords")
  31. print("os.reboot() - reboots the computer")
  32. print("os.shutdown() - shuts down the computer")
  33. print("os.setComputerLabel(\"<name>\" - Sets the computer's label")
  34. print("A labeled computer won't lose its programs when broken")
  35. term.restore()
RAW Paste Data