Quote:
Originally Posted by Twinny
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.)