View Single Post
  #4  
Old 06-17-2014, 02:00 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by blackbeltben View Post
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.123;
  
test();
  echo(
temp.a);
}

function 
test() {
  echo(
temp.0);
  
temp.245;
  echo(
temp.a);

__________________
Quote:
Reply With Quote