Advertisement
Spode

Web Program

Aug 6th, 2015
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function clr()
  2.  term.clear()
  3.  term.setCursorPos(1,1)
  4. end
  5.  
  6. -- Location of the "Computer Interface" block
  7. local scr = peripheral.wrap("bottom")
  8.  
  9. -- Quick Statistics
  10. print("Is the monitor connected?")
  11. test = scr.isLinked()
  12. if test == true then
  13.  print("Ready")
  14. end
  15. print()
  16. print("What is the screen's position?")
  17. x, y, z = scr.getScreenPos()
  18. print("X: " .. x .. ", Y: " .. y .. ", Z: " .. z)
  19. sleep(1)
  20. clr()
  21.  
  22. -- Main Body
  23. print[[Welcome to my ComputerCraft web browser, of sorts.
  24.  
  25. 1 - Get Current URL
  26. 2 - Get New URL
  27. 3 - Enter New Text
  28. ]]
  29.  
  30. write("What would you like to do? ")
  31. ans = read()
  32.  
  33. if ans == "1" then
  34.  currentUrl = scr.getUrl()
  35.  print()
  36.  print("Current url is " .. currentUrl)
  37.  sleep(5)
  38.  clr()
  39. elseif ans == "2" then
  40.  print()
  41.  write("Enter new url ")
  42.  newUrl = read()
  43.  scr.setUrl(newUrl)
  44.  clr()
  45. elseif ans == "3" then
  46.  print()
  47.  webTxt = read()
  48.  print(scr.type(webTxt))
  49. else
  50.  scr.setUrl("about:blank")
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement