Change:
temp.thing = ("DoctorStaffBar_Control" @ temp.code);
To:
temp.thing = makevar("DoctorStaffBar_Control" @ temp.code);
KeyPress can be shortened, unless you plan to changing it from the number keys:
PHP Code:
function onKeyPressed(keycode, keyname) {
temp.code = keycode - 49;
if (temp.code < getTools().size()) {
selectToolName(temp.code);
}
else if (keycode == 87) {
//Activate selected staff tool with w
triggerServer("gui", this.name, "staffbar", this.staffCode);
}
}