Don't like ads? PRO users don't see any ads ;-)
Guest

startup

By: a guest on Aug 8th, 2012  |  syntax: None  |  size: 1.24 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. shell.setPath( ".:/rom/programs" )
  2. help.setPath( "/rom/help" )
  3.  
  4. shell.setAlias( "ls", "list" )
  5. shell.setAlias( "dir", "list" )
  6. shell.setAlias( "cp", "copy" )
  7. shell.setAlias( "mv", "move" )
  8. shell.setAlias( "rm", "delete" )
  9.  
  10. if fs.isDir('/mem/autorun') then
  11.         local files = fs.list('/mem/autorun')
  12.         table.sort(files)
  13.         for k, file in ipairs(files) do
  14.                 local path = fs.combine('/mem/autorun', file)
  15.                 if not fs.isDir(path) then
  16.                         shell.run(path)
  17.                 end
  18.         end
  19. end
  20. local nativeTerm = term.native or term
  21.  
  22. local function invoke(sMethod, ...)
  23. nativeTerm[sMethod](...)
  24. for k,sSide in pairs(redstone.getSides()) do
  25.   if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
  26.    peripheral.call(sSide, sMethod, ...)
  27.   end
  28. end
  29. end
  30.  
  31. term.write = function(text) invoke("write", text) end
  32. term.scroll = function(n) invoke("scroll", n) end
  33. term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
  34. term.setCursorBlink = function(B) invoke("setCursorBlink", B) end
  35. term.clear = function() invoke("clear") end
  36. term.clearLine = function() invoke("clearLine") end
  37.  
  38. nativeTerm.clear()
  39. nativeTerm.setCursorPos(1, 1)
  40. print("TCMail 1 - Server")
  41. print("This is computer number " .. os.getComputerID())
  42. shell.run("mailserv")