- [[.:prplreference| PRPL reference]] <- [[.:upgradenotes#accessor_notation|Upgrade Notes]]
===== Accessor Notation (AcNot) =====
==== Description ====
Accessor Notation is a new feature in PRPL. It provides a simpler way to access the properties of units than in CRPL. Whereas in CRPL one would get/set unit attributes with:
# Set Unit Attribute
<-UID CONST_UNITATTRIBUTE <-Value SetUnitAttribute
# Get Unit Attribute
<-UID CONST_UNITATTRIBUTE GetUnitAttribute
PRPL allows a much faster notation styled after object property accessors in object-oriented programming languages:
# Set Unit Attribute
<-Value ->UID.Attribute
# Get Unit Attribute
<-UID.Attribute
This has the advantage of being easier to read and identify, as well as the fact that all valid property tokens are not case-sensitive:
# These are treated the same
<-UID.Attribute
<-UID.ATTRIBUTE
Note that Ships, Particles and Units are considered distinct; their IDs are generally referred to as SID, PID and UID respectively, and are each obtained with different commands. See [[.:getallshipsinrange|GetAllShipsInRange]], [[.:getparticlesinrange|GetParticlesInRange]] and [[.:getallunitsinrange|GetAllUnitsInRange]].
==== Attributes ====
^ Ships ^^^^
^ Attribute ^ Description ^ Get ^ Set ^
| ShipHasAmp | Whether the ship has an amp gem mounted. | <-UID.ShipHasAmp
| Cannot Be Set |
| ShipIsEnemy | Whether the ship is an enemy. Warning: using this on player ships can cause strange behaviour. | <-UID.ShipIsEnemy
| <-Value ->UID.ShipIsEnemy
|
^ Particles ^^^^
^ Attribute ^ Description ^ Get ^ Set ^
| - | desc | #code
| #code
|
Tables for Particle, Unit and Ship here. Keep Separate!
=== Examples ===