GRAP

GRAP is a CAOS function that returns the room ID at a given point on the map.

Usage
Syntax: GRAP x(integer) y(integer)

Returns the room id at the given x,y point in the map. If there is no room at this point, -1 is returned instead.

Example
Used by the Man-o-War to float in water, sink if the top is poking out of the water, or die if the whole creature is out of the water: setv va51 post doif ov05 <> 0 addv va51 20 endi doif carr = null doif rtyp grap posx va51 <> 8 and rtyp grap posx va51 <> 9 accg 0.3 else accg 0 endi doif rtyp grap posl post <> 8 and rtyp grap posr post <> 8 and rtyp grap posl posb <> 8 and rtyp grap posr posb <> 8 doif rtyp grap posl post <> 9 and rtyp grap posr post <> 9 and rtyp grap posl posb <> 9 and rtyp grap posr posb <> 9 gsub die_ endi endi endi