Thread: Better ATTR's
View Single Post
  #19  
Old 07-28-2011, 12:38 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Hezzy002 View Post
It's for convenience, just like ATTR's are. A caching system for the client to have data available about other clients for whenever it's needed, instead of having to wait for the server to respond. Right now it's not being used for any kind of massive data that would extend past 223 bytes (and it never will be, I agree that some data should never be sync'd with all players and should be available upon request) but accessing something like pl.nicknameColor, pl.red/pl.green/pl.blue/pl.alpha/pl.rotation/pl.strechx/pl.stretchy, pl.sysHealth, pl.sysMagic, or pl.sysAlliance (For a server that doesn't use a standard interface) is a lot prettier than pl.attr[1], or even pl.attr[NICKNAME_COLOR]. It's a lot more self-documenting and preferable for a server that has multiple scripters.
The consequences of using the system seem to far outweigh the benefits of being able to use a variable directly.

You can easily hide the "ugly" code related to the player attr with a class, and write common accessors and mutator functions.

pl.getNicknameColor() is just as self-documenting than pl.nicknameColor.
__________________
Quote:
Reply With Quote