?
This is a very useful little... thing. Kaimetsu taught me how to use it, and it comes in handy for things like switches, or turning on NPCs by firing it. Here is an example of how to use it.
NPC Code:
if (weaponfired) this.on = this.on==0?1:0;
You may be thinking "Wtf?", but here's how it works.
NPC Code:
if (weaponfired) this.on = this.on==0?1:0;
This section is basically like a flag checker. If this is true, it will do what's in front of the colon. If it's false, it will do what's behind it. The main purpose of this tool thingie is to shorten script.
You could do this without the ?, although it would be a bit longer
NPC Code:
if (weaponfired){
if (this.on==0){
this.on=1;
}else this.on=0;
}
Or... something. o.O!
Now back to the ? part.
Lets say you fire the weapon, and this.on equals 1. The flag checker thingie part will read this.on==0 as false, and do what's behind the colon, which is a 0. This.on will be set to 0. Got it? You'd better, cause i'm tired of typing.
-Wind Seablaze