here is the code,
[color=#282828][font=helvetica, arial, sans-serif]local count = 0[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]local diamond = 0[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]local monitor[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]local pState =[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]{[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][1] = rs.testBundledInput("back", colors.red),[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][2] = rs.testBundledInput("back", colors.white),[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][3] = rs.testBundledInput("back", colors.yellow),[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][4] = rs.testBundledInput("back", colors.gray)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]}[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]function writeAt(x,y,text)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]monitor.setCursorPos(x,y)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]monitor.write(text)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]function startMonitor()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]monitor = peripheral.wrap("top")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]function drawDisplay()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]monitor.clear()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(1,1,"***************************")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(1,2,"* from this quarry *")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(1,3,"***************************")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(1,4,"* coal: 0 *")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(1,5,"* Diamonds 0 *")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]function writeCount()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(16,4," ")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(16,4,string.format("%i",count))[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]function diamond()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(16,5," ")[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeAt(16,5,string.format("%i",diamond))[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]function redstoneEvent(p1, p2)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]local cState =[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]{[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][1] = rs.testBundledInput("back", colors.red),[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][2] = rs.testBundledInput("back", colors.white),[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][3] = rs.testBundledInput("back", colors.yellow),[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][4] = rs.testBundledInput("back", colors.gray)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]}[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]if pState[2] == false and cState[2] == true then -- kull + 1[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]count = count + 1[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeCount()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]if pState[1] == false and cState[1] == true then -- i need another count!! can't use this one for both diamonds and coal :/[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]diamond = diamond + 1[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]diamond()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]pState[1] = cState[1][/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]pState[2] = cState[2][/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]pState[3] = cState[3][/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]pState[4] = cState[4][/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]startMonitor()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]drawDisplay()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]writeCount()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]repeat[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]local event, p1, p2 = os.pullEvent()[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]if event == "redstone" then[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]redstoneEvent(p1, p2)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]end[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]until event == "char" and p1 == "x" -- x for og avslutte programmet [/font][/color] :P/>/>
[color=#282828][font=helvetica, arial, sans-serif]os.shutdown()[/font][/color]
and here is the error :/
[color=#282828][font=helvetica, arial, sans-serif]startup:54: attempt to perfrom arithmetic __add on function and number[/font][/color]