Quote:
Originally Posted by Skyld
PHP Code:
function onCreated() { temp.obj = new TStaticVar("SomeObject"); temp.one = new SomeObject(); temp.two = new SomeObject(); temp.one.asdf = "hi"; temp.two.asdf = "foo"; echo(format("Object one is '%s'", temp.one)); echo(format("Object two is '%s'", temp.two)); echo(format("Object keys: '%s', '%s'", temp.one.asdf, temp.two.asdf)); // Compare the objects as objects if (temp.one == temp.two) echo("Objects are the same"); else echo("Objects are different"); // Compare the objects after being coerced to strings if (@temp.one == @temp.two) echo("Object names are equal"); else echo("Object names are different"); }
Output:
NPC Code:
Object one is 'SomeObject'
Object two is 'SomeObject'
Object keys: 'hi', 'foo'
Objects are different
Object names are equal
When the objects are coerced into strings, you get the object names only typically. In this example, it results in two objects appearing to be the same (because their object names are the same) even though we have just proven them to be different.
This is something you MUST be aware of when coercing objects into strings in GScript. It doesn't always work how you expect.
|
Sorry, I know you are trying to help, but I'm confused as to what any of that means..
Can you do it in layman's terms and possibly actually use levels?
Also, why are levels objects and not only strings?
I thought levels were only names of a textfiles converted to .nw..