Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------
- -- Variablen
- ----------------------------------
- local s = 0
- local inp = false
- local z = 0
- local stack = 0
- local stueck = 0
- local count = 0
- ----------------------------------
- -- Variablen end
- ----------------------------------
- --
- ----------------------------------
- -- file read
- ----------------------------------
- if fs.exists('count') then
- local oFile=io.open('count','r')
- count=tonumber(oFile:read())
- oFile:close()
- else
- local count=0
- end
- ----------------------------------
- -- File read end
- ----------------------------------
- --
- ----------------------------------
- -- Variablen Input
- ----------------------------------
- local tSides={input='left';reset='right';output='back'}
- local bInput=rs.getInput(tSides['input'])
- ----------------------------------
- -- Variablen Input end
- ----------------------------------
- --
- ----------------------------------
- -- Counter Section / File write
- ----------------------------------
- while true do
- os.pullEvent('redstone')
- if rs.getInput(tSides['input']) and rs.getInput(tSides['input'])~=bInput then
- bInput=rs.getInput(tSides['input'])
- count=count+1
- local oFile=io.open('count','w')
- oFile:write(count)
- oFile:close()
- elseif rs.getInput(tSides['reset']) then
- fs.delete('count')
- count=0
- local oFile=io.open('count','w')
- oFile:write(count)
- oFile:close()
- elseif rs.getInput(tSides['output']) then
- count=count-1
- local oFile=io.open('count','w')
- oFile:write(count)
- oFile:close()
- end
- ---------------------------------------
- -- Counter Section / File Write end
- ---------------------------------------
- --
- ---------------------------------------
- -- Stack / Stueck Calc
- ---------------------------------------
- function _str(z)
- sta = math.floor(z / 64)
- stu = math.fmod(z, 64)
- return sta, stu
- end
- -----------------------------------------
- -- Stack / Stueck Calc end
- --------------------------------------------
- function _ascii()
- out = string.char(98,121,32,82,101,100,108,101,100,55,50)
- return out
- end
- -----------------------------------------
- -- Monitor Loop
- -----------------------------------------
- while s == 0 do
- z = count
- stack, stueck = _str(z)
- term.redirect(peripheral.wrap('top'))
- shell.run("clear")
- print(" Item = XXX")
- print(" Stueckzahl: "..z.." ")
- print(" Anzahl in Stack")
- print(" " ..stack.." Stack & " ..stueck.. " Stück")
- sleep(0.1)
- end
- -----------------------------------------
- -- Monitor Loop end
- -----------------------------------------
- end
- print(newline)
- print("\"CC-ItemCounter\" " .._ascii().. "")
Advertisement
Add Comment
Please, Sign In to add comment