Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ItemCounter by redled72 5/2012
- cdel = ("right") -- Reset Counter (Button, Switch...)
- cin = ("left") -- Input Counter (RP-Signal, Redstonepipe...)
- cout = ("back") -- Input Counter (RP-Signal, Redstonepipe...)
- local s = 0
- local inp = false
- local z = 0
- local stack = 0
- local stueck = 0
- local count = 0
- function _latch(inp) -- Counter
- if inp == true then
- count = count + 1
- while rs.getInput(cin) == inp do
- sleep(0.05)
- end
- end
- if rs.getInput(cdel) == true then
- count = 0
- end
- sleep(0.05)
- return count
- end
- function _str(z) -- Stack/Stueckrechnung
- sta = math.floor(z / 64)
- stu = math.fmod(z, 64)
- return sta, stu
- end
- function _ascii()
- out = string.char(98,121,32,82,101,100,108,101,100,55,50)
- return out
- end
- while s == 0 do -- Loop Hauptschleife
- inp = rs.getInput(cin)
- z = _latch(inp)
- stack, stueck = _str(z)
- shell.run("clear")
- print(" Item = Samen")
- print(" Stueckzahl: " ..z.. " ")
- print(" Anzahl in Stack")
- print(" " ..stack.." Stack & " ..stueck.. " Stück")
- end
- print(newline)
- print("\"CC-ItemCounter\" " .._ascii().. "")
Add Comment
Please, Sign In to add comment