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/11/30 13:11] – added example Clean0nioncrpl: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>#Creates a unit then tells it its creator's UID+<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 "CRPLCORE" CurrentCoords CreateUnit ->unit
-<-unit "doThings" AddScriptToUnit +<-unit "doThings.crpl" AddScriptToUnit 
-<-unit "doThings" "myCreator" Self SetScriptVar</code>+<-unit "doThings.crpl" "myCreator" Self SetScriptVar 
 +</code> 
crpl/docs/self.txt · Last modified: 2021/02/05 11:43 by Karsten75