User Tools

Site Tools


crpl:docs:iscreeperinrange

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
crpl:docs:iscreeperinrange [2015/02/22 05:34] – created pawel345crpl:docs:iscreeperinrange [2015/02/26 00:57] – added note about threshold BTUx9
Line 9: Line 9:
 === Description === === Description ===
 Checks if there is creeper in range of the x,y coordinates, threshold parameter defines the minimal amount of creeper to be found, while square command switches between a square and a circle area of searching. AC parameter defines if anti-creeper is searched for. Checks if there is creeper in range of the x,y coordinates, threshold parameter defines the minimal amount of creeper to be found, while square command switches between a square and a circle area of searching. AC parameter defines if anti-creeper is searched for.
 +<note>GetCreeper returns a float value, but threshold is an integer.  So, to test for a creeper level of 1.0, you'd use a threshold of 1,000,000.</note>
 === Examples === === Examples ===
-<code>example goes here</code> +<code> 
 +$powerLineUnitX:84 
 +$powerLineUnitY:81 
 + 
 +$beamUnitX:84 
 +$beamUnitY:63 
 + 
 +$initialDelay:
 + 
 +once 
 + GetUnitAt(<-powerLineUnitX <-powerLineUnitY) ->powerLineUID 
 + GetUnitAt(<-beamUnitX <-beamUnitY) ->beamUID 
 +endonce 
 + 
 + 
 +if (not(<-alreadyDelayed) and (<-initialDelay gt(0))) 
 + Delay(<-initialDelay) 
 + TRUE ->alreadyDelayed 
 +endif 
 + 
 +@ActivatePowerPlant(not(IsCreeperInRange(CurrentX CurrentY 5 1 FALSE TRUE FALSE))) 
 + 
 + 
 +:ActivatePowerPlant 
 + ->activate 
 + if (<-activate and (not(<-active))) 
 + TRUE ->active 
 + SetImageColor(Self "Main" 255 255 255 255) 
 + SetImageColor(<-powerLineUID "Main" 0 255 0 255) 
 + SetScriptVar(<-beamUID "BeamWeapon.crpl" "enabled" TRUE) 
 + PlaySound("Misc15"
 + else if (not(<-activate) and (<-active))  
 + FALSE ->active 
 + SetImageColor(Self "Main" 255 128 200 255) 
 + SetImageColor(<-powerLineUID "Main" 255 0 0 255) 
 + SetScriptVar(<-beamUID "BeamWeapon.crpl" "enabled" FALSE) 
 + PlaySound("Misc27"
 + endif endif 
 +</code> 
crpl/docs/iscreeperinrange.txt · Last modified: 2015/03/19 07:55 by warren