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
Last revisionBoth sides next revision
crpl:docs:self [2013/11/30 13:13] – updated example Clean0nioncrpl:docs:self [2018/05/01 19:52] – more code examples Grabz
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 in the "myCreator" variable+<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.crpl" AddScriptToUnit <-unit "doThings.crpl" AddScriptToUnit
-<-unit "doThings.crpl" "myCreator" Self SetScriptVar</code>+<-unit "doThings.crpl" "myCreator" Self SetScriptVar 
 +</code> 
crpl/docs/self.txt · Last modified: 2021/02/05 11:43 by Karsten75