Thread: Learning GS2 :D
View Single Post
  #3  
Old 09-01-2006, 12:05 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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.
Reply With Quote