Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Swith Armor V.1.0
- -- Config:
- rsArmor_1 = "left"
- rsArmor_2 = "right"
- bundSide = "back"
- extColor = colors.white
- insColor = colors.orange
- colorArmor_1 = colors.magenta
- colorArmor_2 = colors.lightBlue
- modemSide = "bottom"
- remoteID = 69
- -- Prog:
- rednet.open(modemSide)
- while true do
- rs.setBundledOutput(bundSide,0)
- event,senderID,message,dist = os.pullEvent("rednet_message")
- if senderID == remoteID then
- if message == "change armor" then
- print(message)
- equipArmor = true
- --else
- --equipArmor = false
- end
- end
- if equipArmor then
- print(tostring(equipArmor))
- if rs.getAnalogInput(rsArmor_1) > 0 then
- print(tostring(rs.getAnalogInput(rsArmor_1)))
- extArmor = true
- while extArmor do
- sleep(1)
- term.setCursorPos(1,8)
- term.clearLine()
- print("extract player armor 2")
- if rs.getAnalogInput(rsArmor_2) < 4 then
- rs.setBundledOutput(bundSide, extColor)
- else
- rs.setAnalogOutput(bundSide,0)
- extArmor = false
- insArmor = true
- sleep(1)
- end
- end
- while insArmor do
- sleep(1)
- if rs.getAnalogInput(rsArmor_1) > 0 then
- term.setCursorPos(1,8)
- term.clearLine()
- print("insert armor 1 on player")
- color = insColor + colorArmor_1
- rs.setBundledOutput(bundSide,color)
- sleep(4)
- else
- rs.setBundledOutput(bundSide,0)
- insArmor = false
- sleep(1)
- end
- end
- equipArmor = false
- sleep(1)
- end
- end
- if equipArmor then
- if rs.getAnalogInput(rsArmor_2) > 0 then
- print(tostring(rs.getAnalogInput(rsArmor_2)))
- extArmor = true
- while extArmor do
- sleep(1)
- term.setCursorPos(1,8)
- term.clearLine()
- print("extract player armor 1")
- if rs.getAnalogInput(rsArmor_1) < 4 then
- rs.setBundledOutput(bundSide, extColor)
- else
- rs.setAnalogOutput(bundSide,0)
- extArmor = false
- insArmor = true
- sleep(1)
- end
- end
- while insArmor do
- sleep(1)
- if rs.getAnalogInput(rsArmor_2) > 0 then
- term.setCursorPos(1,8)
- term.clearLine()
- print("insert armor 2 on player")
- color = insColor + colorArmor_2
- rs.setBundledOutput(bundSide,color)
- sleep(4)
- else
- rs.setBundledOutput(bundSide,0)
- insArmor = false
- sleep(1)
- end
- end
- equipArmor = false
- sleep(1)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement