use BGGET to get the BG number at a specific x and y position(make sure the 4th argument is TRUE so it finds the BG in pixel units and not BG units)