User Tools

Site Tools


prpl:accessornotation

<- PRPL reference <- 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, GetParticlesInRange and 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



prpl/accessornotation.txt · Last modified: 2017/10/27 18:24 by GameGibu