I am making a food dispencer and for some reason it will have one of each only dispense as long as the order has at least one..
I changed some things to it now.

Here is the code now.


inside = "back"
outside = "bottom"
p = 0
pstat = 0
b = 0
bstat = 0
c = 0
cstat = 0
term.clear()
term.setCursorPos(1,1)
print("Order Calculations")
print("Porkchops: "..p)
print("Beef: "..B)/>
print("Chicken: "..c)
while true do
	 
	  os.pullEvent("redstone")
	  if rs.testBundledInput(inside, colours.white) then
	  p = p + 1
	  pstat = pstat + 1
	  elseif rs.testBundledInput(inside, colours.orange) then
	  b = b + 1
	  bstat = bstat + 1
	  elseif rs.testBundledInput(inside, colours.magenta) then
	  c = c + 1
	  cstat = cstat + 1
	  elseif rs.testBundledInput(inside, colours.yellow) then
	  p = 0
	  b = 0
	  c = 0
	  elseif rs.testBundledInput(inside, colours.lightBlue) then
	  repeat
	  if pstat > 0 then
	  p = 0
	  for i=1,pstat do
	  rs.setBundledOutput(outside, 1)
	  sleep(1)
	  rs.setBundledOutput(outside, 0)
	  end
	  pstat = 0
	  elseif bstat > 0 then
	  b = 0
	  for i=1,bstat do
	  rs.setBundledOutput(outside, 2)
	  sleep(1)
	  rs.setBundledOutput(outside, 0)
	  end
	  bstat = 0
	  elseif cstat > 0 then
	  c = 0
	  for i=1,cstat  do
	  rs.setBundledOutput(outside, 4)
	  sleep(1)
	  rs.setBundledOutput(outside, 0)
	  end
	  cstat = 0
	  elseif cstat == 0 and bstat == 0 and pstat == 0 then
	  print("Finished Order. New Order may be made.")
	  sleep(1)
	  end
	  until pstat == 0 and bstat == 0 and cstat == 0
	  else
	  term.clear()
	  term.setCursorPos(1,1)
	  print("Order Calculations")
	  print("Porkchops: "..p)
	  print("Beef: "..B)/>
	  print("Chicken: "..c)
	  end
end