~~NOTOC~~
<-[[cw3:creeper_world_3|CW3 Home]]<- [[crpl:start|CRPL Home]]\\
====== CRPL Reference ======
There is a slow and ongoing process to convert entries in this wiki to the more user-friendly format of the 4RPL wiki. Contributors are welcome. Note that the process may never complete.
See [[crpl:new_format|here]] for the old/new format.
This reference is divided into two major sections with many subsections in each of those. The purpose of this reference is to provide an index to all commands in the language, and define the input required and the output produced by each command. In many instances a short example of the use of the command is provided.
The Language API (Application Programming Interface) is related and common in many languages - these are used to control program execution and are part of the core language.
The rest of CRPL is contained in the Platform API and is CW3-specific. These govern the behavior of objects in the CW3 game.
To get started, review the [[crpl:overview|CRPL overview]] and the [[crpl:crpltutorial|programming tutorial]]. If you seek to write neater code, read the [[crpl:styleguide|style guide]].
There is also an [[alphabetic list of commands]] in the language. In addition, you can [[examine map resources]] from other maps and missions from the game.
If you are looking for the in-game images (and some that was never used), then look no further than the [[cw3:Units]] page!.
==== Table of Contents ====
=== Language API ===
[[crpl:crplreference#comparators|Comparators]]\\
[[crpl:crplreference#debugging|Debugging]]\\
[[crpl:crplreference#lists|Lists]]\\
[[crpl:crplreference#logical_operators|Logical Operators]]\\
[[crpl:crplreference#math_commands|Math Commands]]\\
[[crpl:crplreference#flow_control|Program Flow Control]]\\
[[crpl:crplreference#script_commands|Script Commands]]\\
[[crpl:crplreference#stack_manipulation|Stack Manipulation]]\\
[[crpl:crplreference#timers|Timers]]\\
[[crpl:crplreference#utility_commands|Utility Commands]]\\
[[crpl:crplreference#screen_commands|Screen Commands]]\\
[[crpl:crplreference#vars_and_functions|Vars and Functions]]\\
[[crpl:crplreference#string_commands|String Commands]]\\
=== External references ===
<-[[crpl:overview|CRPL Overview]]\\
<-[[Alphabetic List of Commands]]\\
<-[[Examine Map Resources]]
=== Platform API ===
[[crpl:crplreference#conversation_commands|Conversation Commands]]\\
[[crpl:crplreference#creeper_commands|Creeper Commands]]\\
[[crpl:crplreference#digitalis_Commands|Digitalis Commands]]\\
[[crpl:crplreference#image_commands|Image Commands]]\\
[[crpl:crplreference#input_commands|Input Commands]]\\
[[crpl:crplreference#lists|List Commands]]\\
[[crpl:crplreference#sound_commands|Sound Commands]]\\
[[crpl:crplreference#movement_commands|Movement Commands]]\\
[[crpl:crplreference#runner_commands|Runner Commands]]\\
[[crpl:crplreference#score_commands|Score Commands]]\\
[[crpl:crplreference#spore_commands|Spore Commands]]\\
[[crpl:crplreference#terrain_and_wall_commands|Terrain and Wall Commands]]\\
[[crpl:crplreference#unit_commands|Unit Commands]]\\
[[crpl:crplreference#text_commands|Text Commands]]\\
=== Unit Values ===
[[crpl:docs:getunitattribute#unit_constants|Unit Attribute Constants]]\\
[[crpl:docs:getunittype#unit_types|Unit Types]]\\
[[crpl:docs:settechlimit#tech_names|Tech Limit Types]]\\
[[crpl:docs:setscriptvar#list_of_vars|Default Unit Script Vars]]
==== Language API ====
=== Vars and Functions ===
|< 100% >|
^ Vars and Functions ^^^
| [[crpl:docs:define|$VARNAME:DEF_VAL]] | [[crpl:docs:ClearLocals]] | [[crpl:docs:delete|--VARNAME]] |
| [[crpl:docs:read|<-VARNAME]] | [[crpl:docs:write|->VARNAME]] | [[crpl:docs:exists|-?VARNAME]] |
| [[crpl:docs:refread|<-!]] | [[crpl:docs:refwrite|->!]] | [[crpl:docs:refexists|-?!]] |
| [[crpl:docs:refdelete|--!]] | | |
| [[crpl:docs:call|@FUNC_NAME]] | [[crpl:docs:func|:FUNC_NAME]] | |
^Built-in Functions^^^
| [[crpl:docs:func_destroyed|:destroyed]] | [[crpl:docs:func_awake|:awake]] | [[crpl:docs:func_GameLoaded|:GameLoaded]] |
| [[crpl:docs:func_ShowMessageDialogCallback|:ShowMessageDialogCallback]] | | |
| [[crpl:docs:func_UserCancelAction|:UserCancelAction]] | | |
=== Comparators ===
|< 100% >|
^ Comparators ^^^^
| [[crpl:docs:gt]] | [[crpl:docs:gte]] | [[crpl:docs:lt]] | [[crpl:docs:lte]] |
| [[crpl:docs:eq]] | [[crpl:docs:neq]] | [[crpl:docs:eq0]] | [[crpl:docs:neq0]] |
| [[crpl:docs:TRUE]] | [[crpl:docs:FALSE]] | | |
=== Special ===
|< 100% >|
^ Special ^^^^
| [[crpl:docs:comment|#]] |
=== Logical Operators ===
|< 100% >|
^ Logical Operators ^^^^
| [[crpl:docs:and]] | [[crpl:docs:or]] | [[crpl:docs:xor]] | [[crpl:docs:not]] |
=== Stack Manipulation ===
|< 100% >|
^ Stack Manipulation ^^^
| [[crpl:docs:swap]] | [[crpl:docs:dup]] | [[crpl:docs:dup2]] |
| [[crpl:docs:pop]] | [[crpl:docs:ClearStack]] | [[crpl:docs:StackSize]] |
=== Math Commands ===
|< 100% >|
^ Math Commands ^^^^
| [[ crpl:docs:abs]] | [[ crpl:docs:acos]] | [[ crpl:docs:add]] | [[ crpl:docs:approximately]] |
| [[ crpl:docs:asfloat]] | [[ crpl:docs:asin]] | [[ crpl:docs:asint]] | [[ crpl:docs:atan]] |
| [[ crpl:docs:atan2]] | [[ crpl:docs:ceil]] | [[ crpl:docs:cos]] | [[ crpl:docs:div]] |
| [[ crpl:docs:E]] | [[ crpl:docs:floor]] | [[ crpl:docs:ln]] | [[ crpl:docs:log]] |
| [[ crpl:docs:log10]] | [[ crpl:docs:max]] | [[ crpl:docs:min]] | [[ crpl:docs:mod]] |
| [[ crpl:docs:mul]] | [[ crpl:docs:neg]] | [[ crpl:docs:PI]] | [[ crpl:docs:pow]] |
| [[ crpl:docs:round]] | [[ crpl:docs:ShortestAngle]] | [[ crpl:docs:sin]] | [[ crpl:docs:sqrt]] |
| [[ crpl:docs:sub]] | [[ crpl:docs:tan]] | | |
=== Flow Control ===
|< 100% >|
^ Program Flow Control ^^^
| [[crpl:docs:once]] | [[crpl:docs:endonce]] | |
| [[crpl:docs:if]] | [[crpl:docs:else]] | [[crpl:docs:endif]] |
| [[crpl:docs:do]] | [[crpl:docs:loop]] | |
| [[crpl:docs:I]] | [[crpl:docs:J]] | [[crpl:docs:K]] |
| [[crpl:docs:while]]| [[crpl:docs:repeat]] | [[crpl:docs:endwhile]] |
| [[crpl:docs:break]]| [[crpl:docs:return]] | [[crpl:docs:delay]] |
=== Timers ===
|< 100% >|
^ Timers ^^^^
| [[crpl:docs:GetTimer0]] | [[crpl:docs:GetTimer1]] | [[crpl:docs:GetTimer2]] | [[crpl:docs:GetTimer3]] |
| [[crpl:docs:SetTimer0]] | [[crpl:docs:SetTimer1]] | [[crpl:docs:SetTimer2]] | [[crpl:docs:SetTimer3]] |
=== String Commands ===
|< 100% >|
^ String Commands ^^^
| [[crpl:docs:Concat]] | [[crpl:docs:Substring]] | [[crpl:docs:StartsWith]] |
| [[crpl:docs:EndsWith]] | [[crpl:docs:Split]] | [[crpl:docs:StringToList]] |
| [[crpl:docs:ToUpper]] | [[crpl:docs:ToLower]] | [[crpl:docs:StringLength]] |
|[[crpl:docs:StringReplace]] | |
=== Input Commands ===
|< 100% >|
^ Input Commands ^^
| [[crpl:docs:GetKey]] | |
| [[crpl:docs:GetKeyDown]] | [[crpl:docs:GetKeyUp]] |
| [[crpl:docs:GetMouseButton]] | |
| [[crpl:docs:GetMouseButtonDown]] | [[crpl:docs:GetMouseButtonUp]] |
| [[crpl:docs:GetMousePosition]] | [[crpl:docs:GetMouseCell]] |
| [[crpl:docs:GetMouseScreenPosition]] | [[crpl:docs:GetMouseScreenPixelPosition]] |
| [[crpl:docs:EnableAlternateControlMode]] | |
| [[crpl:docs:EnableNormalMouse]] | [[crpl:docs:EnableNormalKeyInput]] |
=== Lists ===
|< 100% >|
^ Lists ^^
| [[crpl:docs:CreateList]] | [[crpl:docs:CreateListStartingSize]] |
| | [[crpl:docs:GetListCount]] |
| [[crpl:docs:GetListElement]] | [[crpl:docs:SetListElement]] |
| [[crpl:docs:InsertListElement]] | [[crpl:docs:RemoveListElement]] |
| [[crpl:docs:AppendToList]] | [[crpl:docs:PrependToList]] |
| [[crpl:docs:AppendStackToList]] | [[crpl:docs:PrependStackToList]] |
| [[crpl:docs:CopyList]] | [[crpl:docs:DeepCopyList]] |
==== Platform API ====
=== Movement Commands ===
|< 100% >|
^ Movement Commands ^^^
| [[crpl:docs:QueueMove]] | [[crpl:docs:GetQueuedMoveCount]] | |
| [[crpl:docs:AbortMove]] | [[crpl:docs:SuspendMove]] | [[crpl:docs:ClearQueuedMoves]] |
| [[crpl:docs:GetTargetOffsetX]] | [[crpl:docs:GetTargetOffsetY]] | |
| [[crpl:docs:SetTargetOffsetX]] | [[crpl:docs:SetTargetOffsetY]] | |
| [[crpl:docs:GetUnitTargetOffsetX]] | [[crpl:docs:GetUnitTargetOffsetY]] | |
| [[crpl:docs:SetUnitTargetOffsetX]] | [[crpl:docs:SetUnitTargetOffsetY]] | |
=== Terrain and Wall Commands ===
|< 100% >|
^ Terrain and Wall Commands^^
| [[crpl:docs:GetTerrain]] | [[crpl:docs:SetTerrain]] |
| [[crpl:docs:GetTerrainOverride]] | [[crpl:docs:SetTerrainOverride]] |
| [[crpl:docs:GetWall]] | [[crpl:docs:SetWall]] |
| [[crpl:docs:GetVoid]] | [[crpl:docs:SetVoid]] |
| [[crpl:docs:IsTerrainLOS]]| [[crpl:docs:FloodFillTerrain]] |
| [[crpl:docs:PathFindTerrain]] | |
=== Score Commands ===
|< 100% >|
^ Score Commands^^
| [[crpl:docs:GetScore]] | [[crpl:docs:SetAdditionalScore]] |
| [[crpl:docs:GetAdditionalScore]] | |
| [[crpl:docs:AddAdditionalScore]] | |
=== Script Commands ===
|< 100% >|
^ Script Commands ^^^
| [[crpl:docs:AddScriptToUnit]] | [[crpl:docs:GetScriptVar]] | [[crpl:docs:SetScriptVar]] |
=== Digitalis Commands ===
|< 100% >|
^ Digitalis Commands^^^
| [[crpl:docs:GetDigitalis]] | [[crpl:docs:SetDigitalis]] | |
| [[crpl:docs:GetDigitalisGrowth]] | [[crpl:docs:SetDigitalisGrowth]] |
| [[crpl:docs:GetDigitalisRaw]] | [[crpl:docs:SetDigitalisRaw]] | [[crpl:docs:IsDigitalisConnected]] |
=== Unit Commands ===
|< 100% >|
^ Unit Commands ^^^
| [[crpl:docs:Self]] | [[crpl:docs:GetUnitAttribute]] | [[crpl:docs:SetUnitAttribute]]|
| [[crpl:docs:CurrentCoords]] | [[crpl:docs:CurrentX]] | [[crpl:docs:CurrentY]] |
| [[crpl:docs:SetCurrentCoords]] | [[crpl:docs:SetCurrentX]] | [[crpl:docs:SetCurrentY]] |
| [[crpl:docs:CurrentPixelCoords]] | | |
| [[crpl:docs:GetUnitCountInRange]] | [[crpl:docs:GetCommandNodeCount]] | [[crpl:docs:GetInhibitorCount]] |
| [[crpl:docs:RandUnitCoords]] |
| [[crpl:docs:GetUnitsInRange]] | [[crpl:docs:GetEnemyUnitsInRange]]| [[crpl:docs:GetAllUnitsInRange]] |
| [[crpl:docs:GetNearestGroundEnemy]] | [[crpl:docs:GetCoresWithVar]] | |
| [[crpl:docs:CreateUnit]] | [[crpl:docs:Damage]] | [[crpl:docs:Destroy]] |
| [[crpl:docs:GetUnitType]] | [[crpl:docs:GetUnitAt]] | |
| [[crpl:docs:GetTechLimit]] | [[crpl:docs:SetTechLimit]] | [[crpl:docs:SetBuildLimit]] |
| [[crpl:docs:CreateEffect]] | [[crpl:docs:CreateEffectClipped]] | [[crpl:docs:FireAoo]] |
| [[crpl:docs:GetUnitTransformPosition]] | |
| [[crpl:docs:GetTechArtifactType]] | [[crpl:docs:SetTechArtifactType]] | [[crpl:docs:ArtifactCollected]] |
| [[crpl:docs:EnableTowerField]] | [[crpl:docs:DisableTowerField]] |
| [[crpl:docs:DropFromOrbit]] | [[crpl:docs:AscendToOrbit]] | |
| [[crpl:docs:GetCellOccupiedCount]] | [[crpl:docs:SetCellOccupiedCount]] | |
| [[crpl:docs:SetUnitSelectableOverride]] | [[crpl:docs:PersistCore]] | |
=== Image Commands ===
|< 100% >|
^ Image Commands ^^^
| [[crpl:docs:SetImage]] | [[crpl:docs:SetImagePosition]] | |
| [[crpl:docs:SetImagePositionX]] | [[crpl:docs:SetImagePositionY]] | [[crpl:docs:SetImagePositionZ]] |
| [[crpl:docs:SetImageScale]] | [[crpl:docs:SetImageScaleX]] | [[crpl:docs:SetImageScaleY]] |
| [[crpl:docs:SetImageRotation]] | [[crpl:docs:SetImageColor]] | |
| [[crpl:docs:GetImagePosition]] | | |
| [[crpl:docs:GetImagePositionX]] | [[crpl:docs:GetImagePositionY]] | [[crpl:docs:GetImagePositionZ]] |
| [[crpl:docs:GetImageScale]] | [[crpl:docs:GetImageScaleX]] | [[crpl:docs:GetImageScaleY]] |
| [[crpl:docs:GetImageRotation]] | [[crpl:docs:GetImageColor]] | |
| [[crpl:docs:RemoveImages]] | | |
=== Sound Commands ===
|< 100% >|
^ Sound Commands ^
| [[crpl:docs:PlaySound]] |
=== Creeper Commands ===
|< 100% >|
^ Creeper Commands^^
| [[crpl:docs:AddCreeper]] | [[crpl:docs:DamageCreeper]] |
| [[crpl:docs:SetCreeperNoLower]] | [[crpl:docs:IsCreeperInRange]] |
| [[crpl:docs:SetCreeper]] | [[crpl:docs:GetCreeper]] |
| [[crpl:docs:MakeRain]] | |
| [[crpl:docs:SetCreeperFlowRate]] | |
|[[crpl:docs:SetCreeperFlowRateOnDigitalis]] | |
| [[crpl:docs:SetCreeperFlowRateRL]] | [[crpl:docs:SetCreeperFlowRateOnDigitalisRL]] |
| [[crpl:docs:SetCreeperFlowRateUD]] | [[crpl:docs:SetCreeperFlowRateOnDigitalisUD]] |
| [[crpl:docs:SetWind]] | |
| [[crpl:docs:SetCreeperEvaporationLimit]] | |
| [[crpl:docs:SetCreeperMax]] | [[crpl:docs:SetAntiCreeperMax]] |
| [[crpl:docs:GetDeepestCreeperCell]] | |
| [[crpl:docs:GetPinFieldCell]] | [[crpl:docs:SetPinFieldCell]] |
| [[crpl:docs:SetFieldCell]] | [[crpl:docs:GetFieldCell]] |
| [[crpl:docs:SetCreeperColors]] | [[crpl:docs:GetCreeperColors]] |
=== Conversation Commands ===
|< 100% >|
^ Conversation Commands^^
|[[crpl:docs:AddConversationMessage]] | [[crpl:docs:ShowConversation]] |
|[[crpl:docs:ClearConversation]] | [[crpl:docs:DestroyConversation]] |
|[[crpl:docs:ConversationShowing]] | [[crpl:docs:ShowOpeningConversation]] |
|[[crpl:docs:CloseOpeningConversation]] | |
=== Spore Commands ===
|< 100% >|
^ Spore Commands^
|[[crpl:docs:CreateSpore]] |
=== Runner Commands ===
|< 100% >|
^ Runner Commands^^^
| [[crpl:docs:CreateRunner]] | [[crpl:docs:GetRunnerCount]] | [[crpl:docs:GetGlobalRunnerCount]] |
=== Debugging ===
|< 100% >|
^ Debugging ^^^
| [[crpl:docs:Trace]] | [[crpl:docs:Trace2]] | [[crpl:docs:Trace3]] |
| [[crpl:docs:Trace4]] | [[crpl:docs:Trace5]] | [[crpl:docs:TraceStack]] |
| [[crpl:docs:ShowTraceLog]] | [[crpl:docs:ClearTraceLog]] | [[crpl:docs:HideTraceLog]]|
=== Utility Commands ===
^ Utility Commands ^^^
| [[crpl:docs:MapHeight]] | [[crpl:docs:MapWidth]] | |
| [[crpl:docs:RandFloat]] | [[crpl:docs:RandInt]] | |
| [[crpl:docs:RandCoords]] | [[crpl:docs:RandXCoord]] | [[crpl:docs:RandYCoord]] |
| [[crpl:docs:RandCoordsInRange]] | | |
| [[crpl:docs:Distance]] | [[crpl:docs:GetUpdateCount]] | [[crpl:docs:IsEditMode]] |
| [[crpl:docs:ElapsedTime]] | [[crpl:docs:ResetGameTime]] | [[crpl:docs:InvocationCount]] |
| [[crpl:docs:SetGameTime]] | [[crpl:docs:GetGameTimeFrames]] | [[crpl:docs:SetGameTimeFrames]] |
| [[crpl:docs:FailMission]] | [[crpl:docs:DestroyAllEnemyUnits]] | [[crpl:docs:GetMissionMode]] |
| [[crpl:docs:PauseGame]] | [[crpl:docs:UnpauseGame]] | [[crpl:docs:NotPersist]] |
| [[crpl:docs:SetSystemInhibited]] | [[crpl:docs:GetCurrentBuildTab]] | |
| [[crpl:docs:IsPaused]] | [[crpl:docs:OperateWhilePaused]] | [[crpl:docs:UserCancel]] |
| [[crpl:docs:CreateIndicatorArrow]] | [[crpl:docs:DestroyIndicatorArrow]] | [[crpl:docs:ShowGameEventTag]] |
=== Screen Commands ===
|< 100% >|
^ Screen Commands ^^
| [[crpl:docs:ShowMessage]] | |
| [[crpl:docs:ShowMessageDismissible]] | [[crpl:docs:WasMessageDismissed]] |
| [[crpl:docs:ShowMessageDialog]] | [[crpl:docs:IsMessageDialogShowing]] |
| [[crpl:docs:CreateMist]] | |
| [[crpl:docs:ScreenHeight]] | [[crpl:docs:ScreenWidth]] |
| [[crpl:docs:CellToPixel]] | [[crpl:docs:PixelToCell]] |
| [[crpl:docs:SetScreenMode]] | [[crpl:docs:SetScreenCoords]] |
| [[crpl:docs:SetScreenCoordX]] | [[crpl:docs:SetScreenCoordY]] |
| [[crpl:docs:SetScreenPixelCoords]] | |
| [[crpl:docs:SetScreenPixelCoordX]] | [[crpl:docs:SetScreenPixelCoordY]] |
| [[crpl:docs:GetCameraPosition]] | [[crpl:docs:SetCameraPosition]] |
| [[crpl:docs:GetCameraZoom]] | [[crpl:docs:SetCameraZoom]] |
| [[crpl:docs:EnableNormalZoomControl]] | |
=== Text Commands ===
|< 100% >|
^ Text Commands ^^
| [[crpl:docs:SetPopupText]] | [[crpl:docs:SetPopupTextAlwaysVisible]] |
| [[crpl:docs:SetPopupTextX]] | [[crpl:docs:SetPopupTextY]] |
| [[crpl:docs:SetText]] | [[crpl:docs:SetTextAlignment]] |
| [[crpl:docs:SetTextAnchor]] | [[crpl:docs:SetTextColor]] |
| [[crpl:docs:SetTextRotation]] | [[crpl:docs:SetTextSize]] |
| [[crpl:docs:SetTextX]] | [[crpl:docs:SetTextY]] |
| [[crpl:docs:SetTextZ]] | |