Quote:
Originally Posted by Gambet
I'd actually appreciate it if you'd explain that to me since I never understood how that worked.
|
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.
Quote:
|
Originally Posted by Gambet
It scans all of the players in the level and all of the npcs in the level if you have the npc on and you double click. It does this to be able to compare the person that triggered its mouse position to see if it falls within the range to clone the object.
I don't seem to be understanding where you're coming from, mind elaborating a bit?
|
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.
Quote:
|
Originally Posted by Gambet
I guess
But does it make a difference? From my experience this. temp vars can be used throughout the NPC whereas temp vars can't unless you send them over through the parameters of a function.
|
this. variables are accessible in the NPC, and temp. variables are destroyed at the end of the function. If you don't need the variable after the end of the function, then just use temp.