User Tools

Site Tools


crpl:docs:getwall

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
crpl:docs:getwall [2014/01/08 23:17] – [GetWall] Flabortcrpl:docs:getwall [2018/05/10 22:18] (current) – removed mistakenly added SetWall example, added a GetWall example Grabz
Line 1: Line 1:
-~~DISCUSSION~~ 
 <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#terrain_and_wall_commands|Terrain and Wall Commands]] <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#terrain_and_wall_commands|Terrain and Wall Commands]]
 =====  GetWall  ===== =====  GetWall  =====
Line 12: Line 11:
 Values in between represent varying degrees of health for the wall. Values in between represent varying degrees of health for the wall.
 === Examples === === Examples ===
-<code>example goes here</code+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). 
 +<code> 
 +CurrentX ->x 
 +CurrentY ->y
  
-=== Possible Issues === +Self CONST_CELLWIDTH GetUnitAttribute ->cellWidth 
-In one coder's experience, this removes the wall. <del>This can be fixed by adding "dup SetWall" after using GetWall.</delNo. Don't do this. Ignore this user.+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 
 +</code>
crpl/docs/getwall.1389241078.txt.gz · Last modified: 2014/10/01 15:02 (external edit)