Quote:
|
Originally Posted by Skyld
PHP Code:
this.test = "foo","bar","baz";
... is incorrect. You should use this for arrays:
PHP Code:
this.test = {"foo", "bar", "baz"};
|
What's wrong with me using
PHP Code:
this.StringArray = {"foo","bar","baz"};
Quote:
Also, you need to put if checks as a block. This is incorrect:
PHP Code:
if (this.foo);
bar();
|
Don't quite understand why this is necessary? I'm not trying to make an event or call a function or whatever it is. I simply wanted to change the players chat. These were two different scripts. :[
Quote:
This is correct:
PHP Code:
if (this.foo)
{
bar();
}
|
How does is this relevant to what I was trying to do? You'd have to show me Skyld as from reading it it doesn't seem it applies to anything I was aimnig for.
Quote:
Also, you forgot to close your brackets on a function.
PHP Code:
function onFoo()
{
//
}
|
Err, I thought I did. That's my mistake then. Very careless of me I agree with you.
Quote:
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
{
//
}
}
|
I haven't quite gotten to learning these more advanced ways of putting things. Hence me putting "
Learning GS2".
Quote:
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.
|
Alas another careless mistake on my part. But I'm learning new things and basically using caveman style GS2. The basic of basic commands here. :/