Advertisement
Guest User

Untitled

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