Ah, I surprise myself sometimes. I figured out the error, as the original code was using a now-reserved variable name 'char'. I simply changed its name and now it works.
So now I will ask for something I cannot do myself. Is it possible to add arrows at the points where alerts would normally be generated?