<- CRPL reference <- Creeper Commands
| Arguments | Result | Notation |
|---|---|---|
| int x, int y, int range, int threshold, bool lessThan, bool square, bool AC | ansber | x y r t lt s ac – b4 |
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.
$powerLineUnitX:84
$powerLineUnitY:81
$beamUnitX:84
$beamUnitY:63
$initialDelay:0
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