View Single Post
  #10  
Old 09-29-2006, 02:20 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Tolnaftate2004 View Post
Compare:
Old GraalScript
PHP Code:
if (created) {
  
i=50;
  
test();
  
message #v(i);
}
function 
test() {
  
i=30;
  return;

The above code displays "30"

New GraalScript
PHP Code:
function onCreated() {
  
temp.i=50;
  
test();
  
message(temp.i);
}
function 
test() {
  
temp.i=30;
  return;

The above code displays "50"

And another thing, in the editor, I placed two scripts:
PHP Code:
if (createdi=234
PHP Code:
if (createdmessage #v(i); 
And the second displayed "234"

Let's not confuse people with false information now. Variables without prefixes are global, and have been global (with some exceptions).
They are global, but they they are only global to that one NPC. In the new engine, any NPC running in the same scope can access an unprefixed variable. They are removed after script execution is complete, just like the temp.prefix variables.

Try not to correct me unless you know what you're talking about, and what context the question was phrased in.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote