View Single Post
  #1  
Old 07-10-2010, 12:25 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Retrieving a subarray?

Assuming I even know what I'm talking about, I've run into a problem where I cant seem to get the npcserver to check arrays within an array.

for example:
PHP Code:
function onCreated(){
  
this.somearray = {temp.otherarray1,temp.otherarray2,};
  
temp.otherarray1 = {"a","b","c",};
  
temp.otherarray2 = {"1","2","3",};
}

function 
doCheckStuff(){
  if(
"b" in this.somearray){
    
player.chat "It's there!";
  }
  else{
    
player.chat "Couldn't find it...";
  }

So when I call doCheckStuff(), it either won't want to check the entire array. or itll list it like -if i decided to send it to rc- something like this:
PHP Code:
NPC-Server (Server): "a,b,c","1,2,3" 
(Except, of course, when i use it with strings, dozens of additional quotation marks are thrown around seemingly haphazardly in what sendtorc returns.)

I could do something like if("b" in this.somearray[0]) but then theres the obvious problem that it wont check this.somearray[1]. Any advice?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote