PHP Code:
this.test = "foo","bar","baz";
... is incorrect. You should use this for arrays:
PHP Code:
this.test = {"foo", "bar", "baz"};
Also, you need to put if checks as a block. This is incorrect:
PHP Code:
if (this.foo);
bar();
This is correct:
PHP Code:
if (this.foo)
{
bar();
}
Also, you forgot to close your brackets on a function.
PHP Code:
function onFoo()
{
//
}
Also, you can just do this.value = !this.value; to make a toggle for this.value being true or false.
PHP Code:
function onWeaponFired()
{
this.enabled = !this.enabled;
if (this.enabled)
{
//
}
else
{
//
}
}
Also, don't use = inside an if statement, since = is assignment. You are probably overwriting the value by using = inside an if. Use == instead since it doesn't do anything but compare:
PHP Code:
this.value = 3;
if (this.value == 3)
{
//
}
Also, it's onPlayerTouchsMe(), not onPlayerTouchesMe().
Sorry.