Advertisement
ArcticPhenom

Untitled

Oct 31st, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. -- Torje's user (user1)
  2. function resetScreen()
  3. term.clear ()
  4. term.setCursorPos ( 1,1 )
  5. end
  6. function keyBoard()
  7. print ( "RUN> ")
  8.  
  9. local input = read()
  10. end
  11. resetScreen()
  12. keyBoard()
  13. -- Commands
  14.  
  15. -- New commands variable thanks to Direwolf20! <3
  16.  
  17. local cmds = { "battleship", "chillis", "changeInventory", "help"}
  18.  
  19. -- Command functions
  20. function checkCMD()
  21. -- Command 1: Battleship host/join
  22. if input == (cmds[1]) then
  23.   input2 = read ()
  24.   if input2 == "host" then
  25.     shell.run ( "fg battleship host" )
  26.   end
  27.   if input2 == "join" then
  28.     shell.run ( "fg battleship join" )
  29.   end
  30.   if ( input2 ~= "host" ) and ( input2 ~= "join" ) then
  31.     term.setTextColor ( colors.red )
  32.     print ( "Invalid parameters" )
  33.     sleep(1.5)
  34.     shell.run ( "test" )
  35.   end
  36. end
  37.  
  38. -- Command 2: Chilli shower
  39. if input == (cmds[2]) then
  40.   textutils.slowPrint ( "Chilli shower activated!", 30)
  41.   rs.setOutput ( "back", true )
  42.   sleep(1.5)
  43.   rs.setOutput ( "back", false )
  44.   shell.run ( "test" )
  45. end
  46.  
  47. -- Change inventory between places!
  48. if input == (cmds[3]) then
  49.   rednet.open ( "left" )
  50.  
  51.   while true do
  52.     term.clear ()
  53.     term.setCursorPos ( 1, 1 )
  54.     term.write ( "Inventory: " )
  55.     command = read ()
  56.     rednet.broadcast ( command )
  57.     while true do
  58.       textutils.slowPrint ( "Press E when done loading/unloading...", 30 )
  59.     local event, key = os.pullEvent ( "key" )
  60.         if key == keys.e then
  61.           rednet.broadcast ( "stop" )
  62.        
  63.           break
  64.         end
  65.       end
  66.     end
  67.   end
  68.  
  69. -- Help program
  70. if input == (cmds[4]) then
  71.   textutils.slowPrint ( "Command list: " )
  72.   for i = 1, 4 do
  73.     textutils.slowPrint ( cmds[i] )
  74.   end
  75. if (input ~= (cmds[1])) and (input ~= (cmds[2])) and (input ~= (cmds[3])) and (input ~= (cmds[4])) then
  76. textutils.slowPrint ( "Unrecognized command...", 35 )
  77. end
  78. if input = read() then
  79. keyBoard()
  80. end
  81. end
  82. end -- Function ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement