Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mekModem = peripheral.wrap("bottom")
- teleName = "null"
- gateDuration = 5
- function setAddress(teleValue)
- teleValue = string.lower(teleValue)
- if teleValue == "haxley" then setTele(1, 0, 0, 0)
- elseif teleValue == "shantara" then setTele(1, 0, 0, 1)
- elseif teleValue == "barge" then setTele(1, 0, 0, 2)
- end
- end
- function gateFinder()
- t = mekModem.getNamesRemote()
- for i=1, #t do
- if string.find(t[i], "Teleporter") then teleName = t[i] end
- end
- end
- function setTele(num0, num1, num2, num3)
- mekModem.callRemote(teleName, "set", 0, num0)
- mekModem.callRemote(teleName, "set", 1, num1)
- mekModem.callRemote(teleName, "set", 2, num2)
- mekModem.callRemote(teleName, "set", 3, num3)
- end
- function main()
- gateFinder()
- shell.run("clear")
- print("Welcome to Dormagic Dialling! Please choose:")
- print("Barge Haxley Shantara")
- print("\nEnter Destination (Q to quit):")
- -- Get the choice from the user.
- local userDest = io.read()
- -- Set the teleporter value for going out.
- shell.run("clear")
- print("Connecting to ", userDest, "! Portal will remain for 60 seconds!")
- setAddress(userDest)
- -- Timer that displays how long the gate will remain open.
- for i=0,gateDuration do
- shell.run("clear")
- print("Gate to ", userDest, " closes in ", gateDuration-i, " seconds.")
- os.sleep(1)
- end
- print("Resetting to default value")
- setAddress(os.getComputerLabel())
- os.sleep(2)
- shell.run("clear")
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement