Bump (sorta)
This is what I am working with, and everything works Except calling the function from the SwitchDB to the door.
This is the Switch Database
PHP Code:
function onCreated() {
SwitchDB = this;
this.switches = new TStaticVar();
this.doors = new TStaticVar();
this.connections = new TStaticVar();
this.connections.switch_a = "door_a";
}
public function addSwitch(temp.sname, temp.sobj) {
this.switches.(@temp.sname) = temp.sobj;
echo("added touch "@temp.sname);
}
public function addDoor(temp.dname, temp.obj) {
this.doors.(@temp.dname) = temp.obj;
echo("added door " @temp.dname);
}
public function switchHit(temp.switchName) {
echo(@ temp.switchName);
temp.doorName = this.connections.(@temp.switchName);
temp.door = this.doors.(@temp.doorName);
echo(@temp.doorName);
temp.door.doorOpen();
}
The Switch
PHP Code:
function onCreated() {
SwitchDB = findnpc("SwitchDB");
SwitchDB.addSwitch("switch_a", this);
setshape(1,32,32);
}
function onPlayerTouchsMe() {
SwitchDB.switchHit("switch_a");
this.chat = "touched!";
sleep(1);
this.chat = "";
}
And the door
PHP Code:
function onCreated() {
SwitchDB = findnpc("SwitchDB");
SwitchDB.addDoor("door_a", this);
}
public function doorOpen() {
this.hide();
sleep(3);
this.show();
}
I've placed the public function in both the door and switchDB but doesn't work any which way i place it. Any help would be appreciated.