Quote:
Originally Posted by blackbeltben
Please forgive me if this sounds like a dumb question.. But what is the point of putting temp? Couldn't you just put this.dy, this.dist... etc
Keep in mind I don't know much about "temp" stuff
|
Well it's for temporary values/variables. When you use this. or no prefix at all those variables stay in memory with the npc / globally.
Using temp also guarantees the variable will be empty/0 and won't conflict with other parts of your script.
Quick example:
PHP Code:
// output:
// 0
// 245
// 123
function onCreated() {
temp.a = 123;
test();
echo(temp.a);
}
function test() {
echo(temp.a + 0);
temp.a = 245;
echo(temp.a);
}