Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not fs.exists("kapi") then
- shell.run("label set KlazController")
- shell.run("pastebin get Wa30xjVY kapi")
- os.loadAPI("kapi")
- else
- os.loadAPI("kapi")
- end
- -- Fine
- if not fs.exists("side") then
- file = fs.open("side", "w")
- directions = {"Front","Back", "Left", "Right", "Top", "Bottom"}
- l = #directions
- n = 1
- while true do
- kapi.menu("Please select a direction to send the pulse:")
- for i = 1, l, 1 do
- if n == i then
- print(">" .. directions[i] .. "<")
- else
- print(" " .. directions[i])
- end
- end
- keypress = kapi.keyread()
- if keypress == keys.up then --Up Arrow
- if n == 1 then
- n = l
- else
- n = n - 1
- end
- elseif keypress == keys.down then --Down Arrow
- if n == l then
- n = 1
- else
- n = n + 1
- end
- elseif keypress == keys enter then --Enter key
- kapi.clear()
- if n == 1 then
- file.write("front")
- elseif n == 2 then
- file.write("back")
- elseif n == 3 then
- file.write("left")
- elseif n == 4 then
- file.write("right")
- elseif n == 5 then
- file.write("top")
- elseif n == 6 then
- file.write("bottom")
- end
- os.reboot()
- end
- end
- end
- if not fs.exists("time") then
- file = fs.open("time", "w")
- times = {1,2,5,10,30,60}
- l = #times
- n = 1
- while true do
- kapi.menu("Please select the interval between pulses (in seconds):")
- for i = 1, l, 1 do
- if n == i then
- print(">" .. times[i] .. "<")
- else
- print(" " .. times[i])
- end
- end
- keypress = kapi.keyread()
- if keypress == keys.up then --Up Arrow
- if n == 1 then
- n = l
- else
- n = n - 1
- end
- elseif keypress == keys.down then --Down Arrow
- if n == l then
- n = 1
- else
- n = n + 1
- end
- elseif keypress == keys.enter then --Enter key
- kapi.clear()
- if n == 1 then
- file.write("1")
- elseif n == 2 then
- file.write("2")
- elseif n == 3 then
- file.write("5")
- elseif n == 4 then
- file.write("10")
- elseif n == 5 then
- file.write("30")
- elseif n == 6 then
- file.write("60")
- end
- os.reboot()
- end
- end
- end
- sideSave = fs.open("side","r")
- timeSave = fs.open("time","r")
- side = sideSave.readLine()
- time = tonumber(timeSave.readLine())
- kapi.menu("Klaz's Redstone Pulse Controller. \n\nYou are currently set to pulse in this direction: "..side.."\nThe length between pulses in seconds is: "..time.."\nPress enter to activate")
- x = kapi.keyread()
- if x == 28 then
- kapi.clear()
- kapi.menu("Klaz's Redstone Pulse Controller. \n\nYou are currently set to pulse in this direction: "..side.."\nThe length between pulses in seconds is: "..time.."\n\n This is active. please press and hold Ctrl+R to deactivate")
- else
- kapi.clear()
- kapi.menu("Klaz's Redstone Pulse Controller. \n\nYou are currently set to pulse in this direction: "..side.."\nThe length between pulses in seconds is: "..time.."\n\n This is active. please press and hold Ctrl+R to deactivate")
- end
- while true do
- redstone.setOutput(side, true)
- sleep(1)
- redstone.setOutput(side, false)
- sleep(time)
- end
Add Comment
Please, Sign In to add comment