Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Not sending the full array (https://forums.graalonline.com/forums/showthread.php?t=134265767)

Tricxta 02-17-2012 08:59 AM

Not sending the full array
 
I have this code
PHP Code:

function onPlayertouchsme(){
  
temp.heads 0;
  for (
temp.i:level.(player.BowlingGroup "_BowlingGroup")){
    
temp.head findplayer(temp.i).head;
    
temp.heads.add(temp.head);
  }
  
triggeraction(this.x+1,this.y+1,"Show",(temp.heads));
}

//#CLIENTSIDE
funciton onCreated(){
  
setshape(1,32,32);
}

function 
onActionShow(){
  
temp.heads params[0];
  
this.chat this.attr[1];
  
//this.chat = temp.heads;
  
with(findimg(300)){
    
image "tricxta_group-bowling-gui.png";
    
100;
    
100;
    
layer 4;
  }
  for (
temp.i=0;temp.i<4;temp.i++){
    
with(findimg(301+temp.i)){
      
image temp.heads[temp.i];
      
partX 0;
      
partY 64;
      
partW 32;
      
partH 32;
      
100;
      
132 temp.i*32;
      
layer 5;
    }
  }


The problem is it constructs the head array fine but once sent by the triggeraction to the client, it only receives the first element. Does anyone know a way around this or how to send the whole array?

Gunderak 02-17-2012 12:56 PM

Is this in a class or level npc?

Crow 02-17-2012 01:03 PM

Why the extra parentheses around temp.heads here?

PHP Code:

triggeraction(this.x+1,this.y+1,"Show",(temp.heads)); 


ffcmike 02-17-2012 08:30 PM

Quote:

Originally Posted by Crow (Post 1684793)
Why the extra parentheses around temp.heads here?

PHP Code:

triggeraction(this.x+1,this.y+1,"Show",(temp.heads)); 


Yeah, wouldn't this be coercing the array into a string?

Also:

PHP Code:

//typo
funciton onCreated(){
  
setshape(1,32,32);



Tricxta 02-17-2012 09:54 PM

No, I've tried it without parenthesis, same result. I've tried a heap of stuff. I talked to eye and he said it might be that you have to convert it into a string before sending. I've tried this, although I've had no luck but I didn't spend too long on it as well.

ffcmike 02-17-2012 09:59 PM

Quote:

Originally Posted by Tricxta (Post 1684833)
No, I've tried it without parenthesis, same result. I've tried a heap of stuff. I talked to eye and he said it might be that you have to convert it into a string before sending. I've tried this, although I've had no luck but I didn't spend too long on it as well.

Have you tested to make sure the entire array is being sent from the server?

Also this could well be a limitation with triggeraction, triggerclient would be more conventional and definitely achieves this, it would require moving the code into a weapon however.
If you absolutely had to keep it as triggeraction, you could try coercing it into a string, and then using tokenize() clientside.

fowlplay4 02-17-2012 10:41 PM

Use a weapon script instead of a level script. Then you can use triggerserver and triggerclient directly to the server and player.

0PiX0 02-17-2012 11:55 PM

triggeraction does not support sending arrays or the use of commas as a separator for data in one variable.

Tricxta 02-18-2012 04:58 AM

Thanks for the info guys. It really helped :)


All times are GMT +2. The time now is 02:48 AM.

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