View Single Post
  #9  
Old 06-25-2007, 10:40 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Twinny View Post
Another handy idea!

PHP Code:
public function destroy()
  echo(
"Nice try, nubcakes"); 
Overrides the default destroy() command where it's added so anti-graals fool can't delete/destroy your NPC from other NPCs. Just add it to anything serverside.

Now, if Stefan added my protected variables idea, all NPCs variables could be set to private by default. This would save objects from accessing/writing to remote objects variables.
Yeah I was thinking about that...
You could just do like:

NPC1:
NPC Code:
function onCreated() {
public this.myvar = "Hello!";
NPC2.getMyVar();
private this.myvar;
NPC2.getMyVar();
}



NPC2:
NPC Code:
function getMyVar() {
echo("Test Results: " @ NPC1.myvar);
}



Echoed text:
NPC Code:
Test Results: Hello!
Test Results:



Color coded to show you the format of the code too ;P
(You would use public and private much like you use new, if, else, while, do, etc.)
__________________
Do it with a DON!
Reply With Quote