Advertisement
GDragonArcher

chat items

Apr 21st, 2023 (edited)
691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --code that will always run and allows for the following functions be be accessed remotely via typing commands in chat
  2. -- "$totem" Toggles the totem of undying machine (right)
  3. -- "$swap" Swaps between chestplates (bottom)
  4.  
  5. local box = peripheral.find("chatBox")                      -- check for the chatbox
  6. local integrator = peripheral.find("redstoneIntegrator")    -- check for the redstoneintegrator
  7.  
  8. --error messages
  9. if box == nil then error("chatBox not found") end
  10. if integrator == nil then error("redstoneIntegrator not found") end
  11.  
  12. local totem = integrator.getOutput("right") -- variable for it the undying machine is activated
  13.  
  14.  
  15. while true do
  16.  
  17. local event, param1, param2 = os.pullEvent("chat") -- the chunk of the chat box needs to be loaded
  18.     if(param1 == "GDragonArcher") then
  19.        
  20.         if(param2 == "totem") then -- param2 is the message and param1 is the player's name
  21.            
  22.             if(totem == false) then
  23.                 integrator.setOutput("right", true) -- Sets the redstone level to 15 for the right side
  24.                 box.sendMessageToPlayer("Activated", "GDragonArcher", "ChatCommands")
  25.                 totem = true
  26.             else
  27.                 integrator.setOutput("right", false) -- Sets the redstone level to 0 for the right side
  28.                 box.sendMessageToPlayer("Deactivated","GDragonArcher", "ChatCommands")
  29.                 totem = false
  30.              end
  31.            
  32.            
  33.         elseif(param2 == "swap") then
  34.             integrator.setOutput("bottom", true) -- Sets the redstone level to 15 for the bottom
  35.             integrator.setOutput("bottom", false) -- Sets the redstone level to 0 for the bottom
  36.            
  37.         end
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement