Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function isempty(s)
- return (s == nil or s == "")
- end
- local function help()
- print("Use:")
- print("TwilightPortal [command] (time)")
- print("")
- print("command - Can be either \"open\" or \"close\" to open or close the portal")
- print("")
- print("time - Optional. This is the amount of time (in seconds) that you want the command to run for")
- print("")
- end
- args = {...}
- command = args[1]
- time = tonumber(args[2])
- if command == "help" then
- help()
- end
- if command == "close" then
- redstone.setOutput("back", true)
- if not isempty(time) then
- print(string.format("Twilight Portal is closed for %02d seconds", time))
- sleep(time)
- redstone.setOutput("back", false)
- end
- else
- if command == "open" then
- redstone.setOutput("back", false)
- if not isempty(time) then
- print(string.format("Twilight Portal is open for %02d seconds", time))
- sleep(time)
- redstone.setOutput("back", true)
- end
- end
- end
- if command ~= "open" and command ~= "close" and command ~= "help" then
- print("ERROR: The first arg has to be either \"open\" or \"close\" ")
- print("")
- print("For help, do \"TwilightPortal help\" ")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement