User Tools

Site Tools


crpl:docs:self

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:self [2013/01/18 12:52] grauniadcrpl:docs:self [2021/02/05 11:43] (current) – Rmoved discussion tag Karsten75
Line 1: Line 1:
-~~DISCUSSION~~+
 <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]] <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]]
 =====  Self  ===== =====  Self  =====
Line 10: Line 10:
 Pushes the unique unit ID (an int) for the current unit to the stack. Pushes the unique unit ID (an int) for the current unit to the stack.
 === Examples === === Examples ===
-<code>Self trace</code> +Trace current unit's ID 
 +<code>Self Trace</code> 
 +If the unit's ammo is full, destroy it 
 +<code> 
 +Self CONST_AMMO GetUnitAttribute ->ammo 
 +Self CONST_MAXAMMO GetUnitAttribute ->maxAmmo 
 + 
 +<-ammo <-maxAmmo gte if 
 +    Self CONST_DESTROYMODE GetUnitAttribute ->destroyMode 
 +     
 +    Self <-destroyMode Destroy 
 +endif 
 +</code> 
 +Creates a unit then tells it its creator's UID in the "myCreator" variable 
 +<code> 
 +"CRPLCORE" CurrentCoords CreateUnit ->unit 
 +<-unit "doThings.crpl" AddScriptToUnit 
 +<-unit "doThings.crpl" "myCreator" Self SetScriptVar 
 +</code> 
crpl/docs/self.1358531555.txt.gz · Last modified: 2014/10/01 15:02 (external edit)