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 07-20-2007, 07:52 PM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
Array Problems

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
this.meowarray = { };
  for( 
temp.ay 0temp.ay 64temp.ay++ ){
    for( 
temp.ax 0temp.ax 64temp.ax++ ){
      
this.meowarraytemp.ax ][ temp.ay ] = 1;
      if( 
temp.ax == && temp.ay == ) echo( this.meowarraytemp.ax ][ temp.ay ] );      
    }
  } 

it echoes 0 x.x
why that?
Reply With Quote
  #2  
Old 07-20-2007, 10:32 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
At a guess i'd say the problem is that mewoarray is only defined as an array and you're using it as a 2d array.
Try this:

PHP Code:
function onCreated(){
  
this.meowarray = { };
  for( 
temp.ay 0temp.ay 64temp.ay++ ){
    
this.meowarray[temp.ay] = {};
    for( 
temp.ax 0temp.ax 64temp.ax++ ){
      
this.meowarraytemp.ay ][ temp.ax ] = 1;
      if( 
temp.ax == && temp.ay == ) echo( this.meowarraytemp.ay ][ temp.ax ] );      
    }
  } 
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #3  
Old 07-21-2007, 12:09 AM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
yeah, but i used this.meowarray = new[64][64] now
thanks anyway
Reply With Quote
  #4  
Old 07-21-2007, 02:20 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
You shouldn't need to do that. o.0
I've never had to define an array. =o
Actually I ussually just set the variable to NULL, and then add the array members in the for loop, so far it hasn't caused me problems. o.0
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
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 10:35 AM.


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