SHOW:
|
|
- or go back to the newest paste.
1 | - | local box = peripheral.find("chatBox") |
1 | + | --code that will always run and allows for the following functions be be accessed remotely via typing commands in chat |
2 | - | -- box is the connected Chat Box |
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 totem = rs.getInput("left") -- boolean, if the door is open |
6 | + | local integrator = peripheral.find("redstoneIntegrator") -- check for the redstoneintegrator |
7 | - | local teleport = rs.getInput("right") -- boolean, if the wall is builded |
7 | + | |
8 | --error messages | |
9 | - | redstone.setAnalogOutput("right", 15) |
9 | + | |
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 | - | -- with param1, you can check if the message is anything you like. |
13 | + | |
14 | - | -- with param2, you can check if the player's name is your name |
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(param2 == "on") then -- param2 is the message and param1 is the player's name |
18 | + | |
19 | ||
20 | - | if(totem == false) then |
20 | + | if(param2 == "totem") then -- param2 is the message and param1 is the player's name |
21 | - | redstone.setAnalogOutput("left", 15) |
21 | + | |
22 | - | box.sendMessageToPlayer("Activated", "GDragonArcher", "ChatCommands") |
22 | + | if(totem == false) then |
23 | - | totem = true |
23 | + | integrator.setOutput("right", true) -- Sets the redstone level to 15 for the right side |
24 | - | else |
24 | + | box.sendMessageToPlayer("Activated", "GDragonArcher", "ChatCommands") |
25 | - | box.sendMessageToPlayer("Already Active","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 | - | elseif(param2 == "tp") then |
29 | + | totem = false |
30 | end | |
31 | - | if(teleport == false) then |
31 | + | |
32 | - | box.sendMessageToPlayer("Teleported", "GDragonArcher", "ChatCommands") |
32 | + | |
33 | - | redstone.setAnalogOutput("right", 0) |
33 | + | elseif(param2 == "swap") then |
34 | - | teleport = true |
34 | + | integrator.setOutput("bottom", true) -- Sets the redstone level to 15 for the bottom |
35 | - | else |
35 | + | integrator.setOutput("bottom", false) -- Sets the redstone level to 0 for the bottom |
36 | - | box.sendMessageToPlayer("Teleport Failed", "GDragonArcher", "ChatCommands") |
36 | + | |
37 | end | |
38 | end | |
39 | - | elseif(param2 == "off") then --param2 is the message and param1 is the player's name |
39 | + | end |