SHOW:
|
|
- or go back to the newest paste.
1 | local shield = peripheral.find("warpdriveForceFieldProjector") | |
2 | local state = true | |
3 | ||
4 | -- initial message | |
5 | - | if os.pullEvent("redstone") then |
5 | + | print("Redstone Control Online, Press C to Configure") |
6 | ||
7 | while true do | |
8 | os.sleep(0.5) | |
9 | local event = os.pullEvent() | |
10 | if event == "redstone" then | |
11 | if state == true then | |
12 | shield.enable(true) | |
13 | state = false | |
14 | - | end |
14 | + | |
15 | shield.enable(false) | |
16 | state = true | |
17 | end | |
18 | elseif event == "key" then | |
19 | local _, key = os.pullEvent("key") | |
20 | -- keys are represented by numbers, the number for 'C' is 46 | |
21 | if key == 46 then | |
22 | print("C key pressed, running 'conf' script...") | |
23 | shell.run("conf") | |
24 | end | |
25 | end | |
26 | end | |
27 |