Theshadow989

Inventory Manager (Sender)

Jul 16th, 2022 (edited)
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. --[[
  2. Inventory Manager (Sender)
  3. Written by TheShadow989
  4. ]]--
  5.  
  6. --[[
  7. Modem Channels (Inverse of Receiver)
  8.  
  9. senderChannel = Unique channel number used for modem communication.
  10. replyChannel = Unique channel for this computer to reply back.
  11.  
  12. ]]--
  13.  
  14. local senderChannel = 2
  15. local replyChannel = 1
  16.  
  17. --[[
  18. Menu Options Array
  19. ]]--
  20.  
  21. local menuOptions =
  22. {
  23.     [1] = {menuName="Mob", display="enabled", status="OFF"},
  24.     [2] = {menuName="Mining", display="enabled", status="OFF"},
  25.     [3] = {menuName="Option3", display="disabled", status="OFF"},
  26.     [4] = {menuName="Option4", display="disabled", status="OFF"},
  27.     [5] = {menuName="Option5", display="disabled", status="OFF"},
  28. }
  29.  
  30. local modem =  peripheral.wrap("back")
  31.  
  32. -- Sender Channel
  33. modem.open(senderChannel)
  34.  
  35. --------------------------------------------------------------------------
  36. --  PROGRAM LOOP
  37. --------------------------------------------------------------------------
  38. while true do
  39.     local e = {os.pullEvent()}
  40.    
  41.     if e[1] == "modem_message" and e[3] == senderChannel then
  42.         local message
  43.         local index = 1
  44.        
  45.         for str in string.gmatch(e[5], "[^;]+") do
  46.             message[index] = str
  47.             index = index + 1
  48.         end
  49.     end
  50. end
Add Comment
Please, Sign In to add comment