Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-07-2006, 11:26 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Arrays, images, and loops -_-

Okay, so I finally have some time to start working on a little game. My problem so far: The ship doesn't show, the comet fragments all show up in the corner of the screen (and as far as I can tell, there's only one of them). I've been staring at this for a while, I can't figure out why it won't work. Help?
PHP Code:
//#CLIENTSIDE
function onKeypressed()
{
if(
strequals(#p(1),D) && strequals(#w,Comet))
{
  if(
this.inuse_comet==0)
  {
    
this.inuse_comet=1;
    
this.screenx_comet=client.compscrnx+2;
    
this.screeny_comet=client.compscrny+2;
    
this.maxscreenx_comet=client.compscrnx+588;
    
this.maxscreeny_comet=client.compscrny+350;
    
this.comet_shipx=this.screenx_comet+294;
    
this.comet_shipy=this.screeny_comet+350;
    
this.level_comet=1;
    
this.levelup_comet=1;
    
settimer(.05);
  }
  else if(
this.inuse_comet==1)
  {
    
this.inuse_comet=0;
    
settimer(0);
    for(
this.i=500this.i<600this.i++)
    {
      
hideimg(this.i);
    }
  }
}
}
function 
onTimeout()
{
  
showimg 500,dr-comet_ship.png,this.comet_shipx,this.comet_shipy;
  
changeimgvis 500,20;
  
freezeplayer .05;
  if(
this.levelup_comet==1)
  {
    for(
this.i=0this.i<this.level_comet*10+3this.i++)
    {
      
this.cometx[this.i]=random(this.screenx_comet,this.maxscreenx_comet-5);
      
this.comety[this.i]=this.screeny_comet+2;
      
this.cometd[this.i]=random(0,3);
    if(
this.cometd[this.i]<1.5)
      {
         
showimg 501+this.i,dr-comet_smallrock.png,this.cometx[this.i],this.comety[this.i];
         
changeimgvis 501+this.i,21;
         
this.comet_img[this.i]="dr-comet_smallrock.png";
         
this.comet_width=20;
      }
    else
      {
        
showimg 501+this.i,dr-comet_bigrock.png,this.cometx[this.i],this.comety[this.i];  
        
changeimgvis 501+this.i,21;
        
this.comet_img[this.i]="dr-comet_bigrock.png";
        
this.comet_width=35;
      }
    }
    
this.levelup_comet=0;
  }
  
//rock movement
  
for(this.i=0this.i<this.level_comet*10+3this.i++)
  {
    
this.comety[this.i]-=.3;
    
showimg 500+this.i,this.comet_img[this.i],this.cometx[this.i],this.comety[this.i];
  }
  
//playermovement
  
if(keydown(1))
  {
    
this.comet_shipx-=.55;
  }
  if(
keydown(3))
  {
    
this.comet_shipx+=.55;
  }
  
  
settimer(.05);

Reply With Quote
  #2  
Old 06-07-2006, 11:41 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Arrays need to be defined.
Stop mixing GS2 with GS1.

array = new[size]; in GS2
setarray variable,size; in GS1
Reply With Quote
  #3  
Old 06-07-2006, 11:53 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Well, that does solve the array problem, it's making more imgs now. But they still all form in the corner of the screen, and the ship img doesn't even appear
Reply With Quote
  #4  
Old 06-08-2006, 12:04 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Make sure it's not a problem with the variables. (client. ones)
Reply With Quote
  #5  
Old 06-08-2006, 12:28 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
the client. variables are fine, I use them for multiple scripts
Reply With Quote
  #6  
Old 06-08-2006, 12:32 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
I'm probably overlooking something, but try lowering your image layers.
Reply With Quote
  #7  
Old 06-08-2006, 12:37 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I've ran images above that, 25 before. It's so high to allow lots of layering, but I could lower them. I doubt this would change much though
Reply With Quote
  #8  
Old 06-08-2006, 02:55 AM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
stop using strequals??

if (params[1]=="d")
Reply With Quote
  #9  
Old 06-08-2006, 04:27 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Warcaptain
stop using strequals??

if (params[1]=="d")
You can mix the two engines, and it will work, however thanks, I screded it up the first time I tried that in GS2 I guess
I don't think that's the only problem
Reply With Quote
  #10  
Old 06-08-2006, 11:31 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
Quote:
Originally Posted by excaliber7388
You can mix the two engines, and it will work, however thanks, I screded it up the first time I tried that in GS2 I guess
I don't think that's the only problem
Just because it works does not make it good practice. In fact, mixing the two engines is very bad practice; it makes code very untidy and it is not as efficient.
__________________
Skyld
Reply With Quote
  #11  
Old 06-08-2006, 04:23 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Skyld
Just because it works does not make it good practice. In fact, mixing the two engines is very bad practice; it makes code very untidy and it is not as efficient.
I only mix it when I'm not sure how to gs2 it, the script would still work, so that can't be the reason it doesn't work. But yeah, I hate mixing them XD
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:01 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.