Table of Contents

<-CW3 Home<- CRPL Home

CRPL Cheat Sheet

For those who want to use CRPL heavily, this ultra condensed reference puts everything you need to know in a single page. For learning the language, refer to the other CRPL pages.

For enhanced rapid access, every command and constant is organized into a story, with stuff that is needed in multiple stories going into basics and stuff that fits no story going into leftovers. Commands will be in the first appropriate story.

*special* indicates that this command works differently than a normal one. Pay close attention to usage and examples.

*special* may also indicate a constant that does not start with CONST_ and does not work with GetUnitAttribute or SetUnitAttribute. The full name will be listed.

*bugs* indicates known bugs may affect the functioning of this command.

Argument types: i=integer, f=float, n=integer or float, s=string, u=unit ID, x=integer x coordinate, y=integer y coordinate, z=integer z coordinate, b=TRUE or FALSE (1 or 0), *=any, l=list, {u}=bunch of unit IDs, CONST_= one of the normal constants.

Default values or legal values in ().

Basics

Commands
*special* # *special* $VARNAME:DEF_VAL
*special* <-VARNAME *(0) *special* * ->VARNAME
??? @FUNC_NAME ??? *special* :FUNC_NAME
n n gt b n n gte b n n lt b n n lte b
n n eq b n n neq b n eq0 b n neq0 b
b b and b b b or b b not b
* * swap * * * dup * * * * dup2 * * * *
n n add n n n sub n n n mul n *special* n n div n
n max n n min n n n mod n
* asfloat f * asint i n neg n n sqrt f
*special* once endonce *special* b if else endif
*special* n n do loop *special* while b repeat endwhile
*special* break *special* return *special* delay
*special* u CONST_ GetUnitAttribute ??? *special* u CONST_ ??? SetUnitAttribute
CurrentCoords x y RandFloat f[0,1) i i RandInt i
x y CellToPixel x y x y PixelToCell x y
b OperateWhilePaused *bugs*
* * Concat s s SetPopupText
Builtin Functions
:destroyed :awake :GameLoaded
CONSTANTS
*special* Self u *special* TRUE b *special* FALSE b
*special* I i *special* J i *special* K i
*special* MapHeight y(84) *special* MapWidth x(128)
IsDestroyed b(FALSE) Health f(1) MaxHealth f(1)
CoordX i CoordY i DestroyMode i(-1)

Stationary Enemy

Commands
u s AddScriptToUnit u s s GetScriptVar * u s s * SetScriptVar
s * GetCoresWithVar {u} i
x y GetDigitalis f x y f SetDigitalis
x y GetDigitalisRaw i x y i SetDigitalisRaw
x y n GetUnitCountInRange i
x y n GetUnitsInRange {u} i x y n b GetAllUnitsInRange {u} i
x y f RandCoordsInRange x y RandUnitCoords x y RandCoords x y
s x y CreateUnit u u f Damage u i(none,flash,BOOM,quiet) Destroy
x y GetUnitAt u GetUnitType
x y z i i i CreateMist i x y z f f f CreateEffect i x y z f f f i CreateEffectClipped
f i i f b EnableTowerField *bugs* DisableTowerField
AscendToOrbit x y DropFromOrbit
u s s SetImage u s x y z SetImagePosition u s f f SetImageScale
u s f SetImageRotation u s i i i i SetImageColor u RemoveImages
s PlaySound
x y i AddCreeper x y i f i i b DamageCreeper
x y i SetCreeperNoLower x y i SetCreeper x y GetCreeper i
i f MakeRain x y x y f(1) f(20) CreateSpore x y f(2) f(10) f(5) CreateRunner
GetRunnerCount i GetGlobalRunnerCount i
Constants
CellHeight i(3) CellWidth i(3) ThorTarget b(FALSE)
NullifierDamageAmt f(0) HealRate f(0.001) DestroyOnDamage b(TRUE)
ShowAmmoACBar b(?) ShowAmmoBar b(?) ShowHealthBar b(?)

Unit type names: (not case sensitive) CommandNode, Collector, Relay, Reactor, OreMine, Siphon, Terp, Guppy, PulseCannon, Mortar, Strafer, Bomber, Sprayer, Nullifier, Shield, Beam, Sniper, Forge, Bertha, PowerZone, OreDeposit, ResourcePack, ShieldKey, TechArtifact, MessageArtifact, AOO, Thor, CRPLCore, ResourcePack, Totem, Emitter, SporeTower, RunnerNest, AETower, Inhibitor.

Extended unit type names: (Cannot be directly created) GuppyAir, StraferAir, BomberAir, Runner.

Effects: 0=ShotExplosion, 1=MortarShellExplosion, 2=BerthaShellExplosion, 3=RunnerExplosion, 4=SporeExplosion, 5=TotemExplosion, 6=CreeperAAShellExplosion, 7=UnitExplosion, 8=MoveTrail, 9=ShortTrail, 10=SporeTrail, 11=SmokeRingEffect, 12=ParticleBeamDamage, 13=PulseCannonShellEffect, 14=StunnedEffect, 15=TerraModCell, 16=TotemFiring.

Script 0 vars: Emitter(STARTTIME, FINISHTIME, PRODUCTIONINTERVAL, PRODUCTIONAMT), SporeTower(STARTTIME, WAVEINTERVAL, WAVECOUNT, SPOREPAYLOAD), AETower(RANGE), RunnerNest(SPAWNINTERVAL, MAXPOPULATION, MOVESPEED, RUNNERMAXHEALTH, CREEPERPAYLOAD), Inhibitor(STARTTIME, PRODUCTIONINTERVAL, PRODUCTIONAMT, RANGE), ResourcePack(AMT, MAXAMT, RESOURCETYPE{ENERGY, ORE, AETHER}), Guppy(MODE{PACKET,ORE,AC}), AOO(TYPE{FREEZE, MASS, CONVERT}), TechArtifact(COUNT).

Flying Enemy

CONSTANTS
*special* PI f
BeamTarget b(FALSE) SniperTarget b(FALSE) SniperIgnoreLOS b(FALSE)
NullifierDamages b(TRUE) IsLanded b(TRUE) TakeMapSpace b(TRUE)
PixelCoordX i PixelCoordY i

Ally

Commands
GetMousePosition x y GetMouseCell x y
i GetMouseButton b i GetMouseButtonDown b i GetMouseButtonUp b
u GetUnitTargetOffsetX x u GetUnitTargetOffsetY y
x y n GetEnemyUnitsInRange {u} i x y x y IsTerrainLOS b *bugs*
x y i i b b i FloodFillTerrain l x y n b b b b GetNearestGroundEnemy x y
x y f i b b b IsCreeperInRange b
s GetTechLimit i s i SetTechLimit s i SetBuildLimit (use unit names)
s(Freeze,Mass,Convert) x y FireAoo u s SetTechArtifactType
GetDeepestCreeperCell x y
Constants
Ammo f(0) MaxAmmo f(0) PacketRequestDelay i(15)
AmmoAC f(0) MaxAmmoAC f(0) ACPacketRequestDelay i(15)
CanRequestAmmo b(FALSE) RequestPackets b(FALSE)
BuildCost f(0) IsBuilding b(FALSE)
Connectable b(FALSE)
CountsForVictory b(TRUE) CreatePZ b(TRUE) SupportsDigitalis b(TRUE)

Tech limit names: (not case sensitive) EnergyStorage, ACStorage, PacketSpeed, EnergyEfficiency, OreEfficiency, BuildSpeed, MoveSpeed, FireRate, FireRange.

User Interface

key codes: http://docs.unity3d.com/Documentation/ScriptReference/KeyCode.html

Builtin Functions
:UserCancelAction

Build tabs: STRUCTURE, WEAPONS, TITANS, ORBITAL.

Text Anchors: 0=UpperLeft, 1=UpperCenter, 2=UpperRight, 3=MiddleLeft, 4=MiddleCenter, 5=MiddleRight, 6=LowerLeft, 7=LowerCenter, 8=LowerRight.

Plot and Script

Builtin Functions
:ShowMessageDialogCallback

Speakers: 0=Skarsgard Abraxis, 1=Lia, 2=Loki Hive, 3=Abrax… Imper…???, 4=Loki Imperator, 5=Aliana, 6=(nameless man with red background), 7=(nameless man with green background).

Modify Map

Testing and Debugging

Leftovers

Commands
ClearLocals
*special* --VARNAME *special* -?VARNAME b
*special* s <-! * *special* * s ->! *special* s -?! b *special* s --?
* pop
n n xor b f f approximately b
f tan f f acos f f asin f f atan f
f i round f n ceil n n floor n
n ln f n n log f n log10 f
f Deg2Rad f f Rad2Deg f
n abs n n n pow n
GetTimer0 n GetTimer1 n GetTimer2 n GetTimer3 n
n SetTimer0 n SetTimer1 n SetTimer2 n SetTimer3
s i i Substring s s s StartsWith b s s EndsWith b s StringLength i
s s Split l s StringToList l
s ToUpper s s ToLower s s s s StringReplace s
*special* ??? l AppendStackToList *special* ??? l PrependStackToList
l CopyList l l DeepCopyList l
GetTargetOffsetX x GetTargetOffsetY y
u x SetUnitTargetOffsetX u y SetUnitTargetOffsetY
x y x y i i b b PathFindTerrain l
x y IsDigitalisConnected b
CurrentX x CurrentY y
x y SetCurrentCoords x SetCurrentX y SetCurrentY
GetCommandNodeCount
GetUnitTransformPosition x y z
u GetTechArtifactType s
u s x SetImagePositionX u s z SetImagePositionZ
u s f SetImageScaleX u s f SetImageScaleY
u s GetImagePosition x y z u s GetImagePositionX x
u s GetImagePositionY y u s GetImagePositionZ z
u s GetImageScale f f
u s GetImageScaleX f u s GetImageScaleY f
u s GetImageRotation f u s GetImageColor i i i i
i i i i i i SetCreeperColors GetCreeperColors i i i i i i
DestroyConversation *bugs* ConversationShowing b
ShowOpeningConversation CloseOpeningConversation
RandXCoord x RandYCoord y
b SetSystemInhibited
SetScreenCoordX x SetScreenCoordY y
SetScreenPixelCoordX x SetScreenPixelCoordY y
b SetPopupTextAlwaysVisible
x SetPopupTextX y SetPopupTextY
CONSTANTS
*special* E f