Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.78 KB | None | 0 0
  1. -- Torje's user (user1)
  2. local input = read()
  3. function resetScreen()
  4. term.clear ()
  5. term.setCursorPos ( 1,1 )
  6. end
  7. function keyBoard()
  8. print ( "RUN> ")
  9. end
  10. resetScreen()
  11. keyBoard()
  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]) or "?" 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[i]) then
  76. textutils.slowPrint ( "Unrecognized command...", 35 )
  77. end
  78. keyBoard()
  79. end -- Function ends here
  80. checkCMD()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement