Quote:
Originally Posted by sssssssssss
Ok cool that was it. Can you give me a brief explanation of making variables objects and why?
|
The
this. prefix always refers to the current object scope. When you're in a GUI "new" block (or similar, such as "with"), you're outside of the script scope. The
thiso. prefix can always be used to get back to the script scope.
PHP Code:
// script of NPC Test
function onCreated() {
this.foo = "bar";
echo(this.foo); // echoes "bar"
echo(Test.foo); // echoes "bar"
with (findPlayer("cbk1994")) {
echo(this.foo); // probably echoes 0 since this won't exist
echo(thiso.foo); // echoes "bar"
}
}
Looks like the
addControl is being used correctly to me but depending on what you're trying to do it may or may not be correct. In general I would move the
addControl line up to inside the control definition and just do
Dialog_Control.addControl(this);