<- CRPL reference <- Terrain and Wall Commands

GetWall

ArgumentsResultNotation
X, Y0 to 1 x1 y1 – i1

Description

Pushes to the stack the value of the wall at the cell coordinates. 0 represents no wall and 1 represents a wall of full health. Values in between represent varying degrees of health for the wall.

Examples

This script will check if there is any single wall piece under the CRPL core this script is attached to. If there is, it will trace 1 (TRUE), if not, it will trace 0 (FALSE).

CurrentX ->x
CurrentY ->y

Self CONST_CELLWIDTH GetUnitAttribute ->cellWidth
Self CONST_CELLHEIGHT GetUnitAttribute ->cellHeight

<-cellWidth 2 div ->cellWidthRadius
<-cellHeight 2 div ->cellHeightRadius

FALSE ->isAnyWallUnderMe

#iterate over all cells occupied by me
<-y <-cellHeightRadius add 1 add <-y <-cellHeightRadius sub do
	<-x <-cellWidthRadius add 1 add <-x <-cellWidthRadius sub do
		I J GetWall ->wall
		<-wall 0 gt if
			TRUE ->isAnyWallUnderMe
		endif
	loop
loop

ShowTraceLog
<-isAnyWallUnderMe Trace