Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Information --
- -- de = Direction North determined by cable color --
- -- de = Direction East determined by cable color --
- -- ds = Direction South determined by cable color --
- -- dw = Direction West determined by cable color --
- -- dm = Default block movement --
- dn = colors.lime
- de = colors.purple
- ds = colors.orange
- dw = colors.lightBlue
- rs = redstone
- dm = 75
- function moveNorth(nTimes)
- for i = 1, nTimes , 0.7 do
- rs.setBundledOutput("left", dn)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- sleep(0.7)
- rs.setBundledOutput("left", dn)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- Print("Moved " i " out of " dm " blocks.")
- end
- end
- function moveEast(nTimes)
- for i = 1, nTimes , 0.7 do
- rs.setBundledOutput("left", de)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- sleep(0.7)
- rs.setBundledOutput("left", de)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- Print("Moved " i " out of " dm " blocks.")
- end
- end
- function moveSouth(nTimes)
- for i = 1, nTimes , 0.7 do
- rs.setBundledOutput("left", ds)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- sleep(0.7)
- rs.setBundledOutput("left", ds)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- Print("Moved " i " out of " dm " blocks.")
- end
- end
- function moveWest(nTimes)
- for i = 1, nTimes , 0.7 do
- rs.setBundledOutput("left", dw)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- sleep(0.7)
- rs.setBundledOutput("left", dw)
- sleep(0.7)
- rs.setBundledOutput("left", 0)
- Print("Moved " i " out of " dm " blocks.")
- end
- end
- function movement()
- term.clear()
- while true do
- print("What direction do you want to move?")
- print("The platform will move" dm " blocks in that direction.")
- print("Use (n) for North")
- print("Use (e) for East")
- print("Use (s) for South")
- print("Use (w) for West")
- print("Use (q) to Exit")
- direction = io.read()
- if direction == "n" then
- moveNorth(dm)
- else
- if direction == "e" then
- moveEast(dm)
- else
- if direction == "s" then
- moveSouth(dm)
- else
- if direction == "w" then
- moveWest(dm)
- else
- if direction == "q" then
- break
- else
- print("Wrong choice")
- end
- end
- end
- end
- end
- end
- end
- movement()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement