Posted 24 May 2013 - 06:33 PM
Hello guys!!
- i'm feeling proud of this code of mine(a timer) that displays on a moniter and is being controlled by a redstone signal :D/>
Code:
Pastebin: http://pastebin.com/cwZq9aHt
If you see any mayor fails! please tell me!!
How to use:
When you Download the program it would be "best" to download it with the name "timer" since the help lines types timer, since i have no clue how to make it type the name u downloaded it with, but well!
to activate the timer simply type in: timer <the time you wish it to run at>.
The monitor is standart placed on the left!
tho you can edit the line where it says "local side = "side you wish here"
EXAMPLE:
Another example on how to run it:
"timer 0.2"
This will execute the timer to run at a speed of 0.2 seconds!
Regards Plazter
- i'm feeling proud of this code of mine(a timer) that displays on a moniter and is being controlled by a redstone signal :D/>
Code:
-- CC Timer Made by Plazter --
-- 2013 --
-- Download timer with the name "timer" --
-- Coded in Notepad ++ --
local side = "side you wish here"
local args = {...}
-- Do not edit from down here!! --
m = peripheral.wrap(side) --
function timer()
for i = 1,2 do
shell.run("redpulse back 1")
end
end
if args[1] == nil or args[1] == "help" then
print("timer <time>") -- Notice that "timer" is the program so if u call it "lol" it would be lol <time>
return
else
local delay = tonumber(args[1])
while true do
if not rs.getInput("top") then
term.clear()
term.setCursorPos(1,1)
print("Im running timer at: ".. args[1] .." !")
m.clear()
m.setCursorPos(1,1)
m.setTextColor(colors.lime)
m.write("ON")
m.setCursorPos(1,2)
m.write("Timer: ")
m.setCursorPos(1,3)
m.write(args[1])
timer()
sleep(delay) -- this is the args[1]
end
if rs.getInput("top") then
m.clear()
m.setTextScale(1)
m.setCursorPos(1,1)
m.setTextColor(colors.red)
m.write("OFF")
m.setCursorPos(1,2)
m.write("pause")
term.clear()
term.setCursorPos(1,1)
print(" I HAVE PAUSED THE PROGRAM SIR!!")
shell.run("ls")
sleep(3)
end
end
end
Pastebin: http://pastebin.com/cwZq9aHt
If you see any mayor fails! please tell me!!
How to use:
When you Download the program it would be "best" to download it with the name "timer" since the help lines types timer, since i have no clue how to make it type the name u downloaded it with, but well!
to activate the timer simply type in: timer <the time you wish it to run at>.
The monitor is standart placed on the left!
tho you can edit the line where it says "local side = "side you wish here"
EXAMPLE:
-Snip-
local side = "left"
local args = {...}
-- Do not edit from down here!! --
m = peripheral.wrap(side) --
-snip-
Another example on how to run it:
"timer 0.2"
This will execute the timer to run at a speed of 0.2 seconds!
Regards Plazter