Advertisement
Rolcam

[WIP] Computercraft Coding Tutorial Program V3

Jun 14th, 2021 (edited)
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.88 KB | None | 0 0
  1. loop = 0
  2. page = 0
  3.  
  4.  
  5. -- Disclaimer
  6. term.clear()
  7. term.setCursorPos(1,1)
  8. term.setTextColor(colors.red)
  9. print("Notice: This program is still a Work in Progress")
  10. print("because of this, some functionality is broken, missing, or incomplete")
  11. print("If something breaks, wait for the program to be completed")
  12. print("chances are I will have fixed it by then")
  13. print(" ")
  14. print("Program will begin in 10 seconds")
  15. sleep(10)
  16.  
  17. -- Main Program
  18. term.clear()
  19. term.setCursorPos(1,1)
  20. term.setTextColor(colors.cyan)
  21. print("Welcome to the CC Coding Tutorial Program")
  22. print("This program will teach you about some commands you can use in a program, what each command does, and how to use them")
  23. print("Make sure you have a monitor attached to this computer before you begin. It will be used to display each lesson")
  24. print("A 6 wide by 4 tall monitor is recommended")
  25. print("Press the Enter button to continue")
  26. read()
  27. while true do
  28.     term.clear()
  29.     term.setCursorPos(1,1)
  30.     term.setTextColor(colors.yellow)
  31.     print("Do you wish to review the lessons, or do you want to test what you know?")
  32.     print("Select \"review\" or \"test\" or \"exit\"")
  33.     input = read()
  34.     if input == "review" then
  35.         loop = 1
  36.         page = 1
  37.         while loop == 1 do
  38.             term.clear()
  39.             term.setCursorPos(1,1)
  40.             term.setTextColor(colors.lime)
  41.             print("Lesson Overview")
  42.             if page == 1 then
  43.                 term.setTextColor(colors.lime)
  44.                 print("Lesson 1 - Introduction")
  45.                 print("Lesson 2 - Basic Commands")
  46.                 print("Lesson 3 - Variables")
  47.                 print("Lesson 4 - Text")
  48.                 print("Lesson 5 - Colors")
  49.                 print("Lesson 6 - Statements")
  50.                 print("Type \"next\" for the next page")
  51.             elseif page == 2 then
  52.                 term.setTextColor(colors.lime)
  53.                 print("Lesson 7 - Loops")
  54.                 print("Lesson 7.1 - Loops Cont.")
  55.                 print("Lesson 8 - Redstone")
  56.                 print("Lesson 8.1 - Redstone Cont.")
  57.                 print("Lesson 9 - File System")
  58.                 print("Lesson 9.1 - File System Cont.")
  59.                 print("Type \"back\" for the last page")
  60.             end
  61.             term.setTextColor(colors.lime)
  62.             print("Type \"menu\" for the main menu")
  63.             print("Please select the lesson number you want: ")
  64.             input = read()
  65.             if input == "next" then
  66.                 if page == 2 then
  67.                     term.setTextColor(colors.red)
  68.                     print("No more pages")
  69.                     sleep(2)
  70.                  else
  71.                     page = 2
  72.                  end
  73.             elseif input == "back" then
  74.                 if page == 1 then
  75.                     term.setTextColor(colors.red)
  76.                     print("No more pages")
  77.                     sleep(2)
  78.                  else
  79.                     page = 1
  80.                  end
  81.             elseif input == "menu" then
  82.                 loop = 0
  83.             elseif input == "1" then
  84.                 shell.run("section1")
  85.                 print("See monitor for lesson")
  86.                 sleep(3)
  87.             elseif input == "2" then
  88.                 shell.run("section2")
  89.                 print("See monitor for lesson")
  90.                 sleep(3)
  91.             elseif input == "3" then
  92.                 shell.run("section3")
  93.                 print("See monitor for lesson")
  94.                 sleep(3)
  95.             elseif input == "4" then
  96.                 shell.run("section4")
  97.                 print("See monitor for lesson")
  98.                 sleep(3)
  99.             elseif input == "5" then
  100.                 shell.run("section5")
  101.                 print("See monitor for lesson")
  102.                 sleep(3)
  103.             elseif input == "6" then
  104.                 shell.run("section6")
  105.                 print("See monitor for lesson")
  106.                 sleep(3)
  107.             elseif input == "7" then
  108.                 shell.run("section7")
  109.                 print("See monitor for lesson")
  110.                 sleep(3)
  111.             elseif input == "7.1" then
  112.                 shell.run("section71")
  113.                 print("See monitor for lesson")
  114.                 sleep(3)
  115.             elseif input == "8" then
  116.                 shell.run("section8")
  117.                 print("See monitor for lesson")
  118.                 sleep(3)
  119.             elseif input == "8.1" then
  120.                 shell.run("section81")
  121.                 print("See monitor for lesson")
  122.                 sleep(3)
  123.             elseif input == "9" then
  124.                 shell.run("section9")
  125.                 print("See monitor for lesson")
  126.                 sleep(3)
  127.             elseif input == "9.1" then
  128.                 shell.run("section91")
  129.                 print("See monitor for lesson")
  130.                 sleep(3)
  131.             else
  132.                 term.setTextColor(colors.red)
  133.                 print("Invalid Selection")
  134.                 sleep(2)
  135.             end
  136.         end
  137.     elseif input == "test" then
  138.         loop = 1
  139.         while loop == 1 do
  140.             term.clear()
  141.             term.setCursorPos(1,1)
  142.             term.setTextColor(colors.purple)
  143.             print("Lesson Test Overview \n ")
  144.             print("Lesson 2 - Basic Commands")
  145.             print("Lesson 3 - Variables")
  146.             print("Lesson 4 - Text")
  147.             print("Lesson 5 - Colors")
  148.             print("Lesson 6 - Statements")
  149.             print("Lesson 7 - Loops")
  150.             print("Lesson 8 - Redstone")
  151.             print("Lesson 9 - File System")
  152.             print("Type \"menu\" for the main menu \n ")
  153.             print("Please select the lesson number you want: ")
  154.             input = read()
  155.             if input == "menu" then
  156.                 loop = 0
  157.             elseif input == "2" then
  158.                 print("Starting Test")
  159.                 sleep(2)
  160.                 shell.run("section2Test")
  161.             elseif input == "3" then
  162.                 print("Starting Test")
  163.                 sleep(2)
  164.                 shell.run("section3Test")
  165.                 sleep(3)
  166.             elseif input == "4" then
  167.                 print("No Test Available")
  168.                 sleep(3)
  169.             elseif input == "5" then
  170.                 print("No Test Available")
  171.                 sleep(3)
  172.             elseif input == "6" then
  173.                 print("No Test Available")
  174.                 sleep(3)
  175.             elseif input == "7" then
  176.                 print("No Test Available")
  177.                 sleep(3)
  178.             elseif input == "8" then
  179.                 print("No Test Available")
  180.                 sleep(3)
  181.             elseif input == "9" then
  182.                 print("No Test Available")
  183.                 sleep(3)
  184.             else
  185.                 term.setTextColor(colors.red)
  186.                 print("Invalid Selection")
  187.                 sleep(2)
  188.             end
  189.         end
  190.     elseif input == "exit" then
  191.         break;
  192.     else
  193.         term.setTextColor(colors.red)
  194.         print("Invalid Selection")
  195.         sleep(2)
  196.     end
  197. end
  198.    
  199.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement