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/14 14:11] – external edit 127.0.0.1crpl:docs:self [2021/02/05 11:43] (current) – Rmoved discussion tag Karsten75
Line 1: Line 1:
  
 +<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]]
 =====  Self  ===== =====  Self  =====
  
 ^Arguments^Result^Notation^ ^Arguments^Result^Notation^
-| |Unit UID for current unit ||| FIXME |||+| |Unit UID for current unit | '' -- i1'' |
  
  
Line 9: 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>example goes here</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.1358190675.txt.gz · Last modified: 2014/10/01 15:02 (external edit)