Quote:
Originally Posted by oralgnome
How so, it does the same thing - right?
|
It uses a single event to detect change in text rather than a hack to detect it which simplifies the code significantly and is much easier to read and understand.
Quote:
Originally Posted by gaben
Regardless, this.bool = !this.bool is a unique way of performing toggling and I can see how one would perceive it as somewhat 'better'. Though, in the end, the one that ends up playing second fiddle is the one that attempts to distinguish oneself' in the face of others.
|
That is irrelevant in my reasoning as to why I think it's 'better'. I would have considered writing the "toggle" like this since it's easier for new scripters to understand:
PHP Code:
//#CLIENTSIDE
function onWeaponFired() {
if (this.on) {
this.on = false;
player.chat = "Typewriter off!";
} else {
this.on = true;
player.chat = "Typewriter on!";
}
}