Can't make private variables by default as it would mess a lot of servers up. Maybe like a server option: privatevariablebydefault=true or something
I also posted this in another thread:
Quote:
Originally Posted by zokemon
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.)
|