Advertisement
Guest User

Untitled

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