Thread: Learning GS2 :D
View Single Post
  #5  
Old 09-01-2006, 01:36 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
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. :/
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote