
04-04-2007, 09:04 PM
|
|
Registered User
|
Join Date: Oct 2003
Posts: 2,712
|
|
Quote:
Originally Posted by Skyld
Sure.
temp.var = !temp.var;
If you are working with just true and false, then this is basically a switch. Because temp.var uninitialized is 0 (false), then !0 is 1 (true), therefore !temp.var == true. Now, if temp.var is 1 (true), then !1 is 0 (false), therefore !temp.var == false.
echo(temp.foo ? "bar" : "baz");
This basically just checks if temp.foo (or any expression, even player.chat == "foo" or so) is true, and returns "bar" if it's true, and "baz" if it isn't.
|
Ah, thanks. Will try to keep that in mind from now on.
Quote:
Originally Posted by Skyld
Well, your loop appears to be scanning every NPC in the level for every player in the level.
Say me, you and Stefan are in the level. It'll first pick me up, and scan every NPC. It'll then move on to you, and scan every NPC. It'll finally move onto Stefan and scan every NPC.
I don't think you need to scan the NPCs as many times as there are players in the level.
|
How would you recommend doing it then? Separating the loops? |
|
|
|