I'm sorry for wasting your remaining posts for today.
I guess the vertical bars you typed are wrong.
Correct bar character is yielded by the key to A's immediate left on the keyboard.
Could you see grp5 with smile tool?
If you find U and V coordinates of the BG tile on grp5, you will get the tile-number with the following formula.
N=(V DIV 16)*32+(U DIV 16)
For example, (U,V) of closed door tile are (64,432), and 868 is given by the formula.
You should correct at least two things as follows.
#1:Write variables of your sprite coordinates for second and third arguments of BGGET.
#2:Return value of BGGET is certain character number of BG tile. Every BG tile has its own character number. You can confirm it with smile tool.
I guess you should write line 128 as follows.
IF BGGET(0,X,Y,1)==(the character number) THEN...