Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-17-2012, 07:59 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
Not sending the full array

I have this code
Graal Script 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?
Reply With Quote
  #2  
Old 02-17-2012, 11:56 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Send a message via Skype™ to Gunderak
Is this in a class or level npc?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 02-17-2012, 12:03 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Why the extra parentheses around temp.heads here?

Graal Script Code:
triggeraction(this.x+1,this.y+1,"Show",(temp.heads)); 
__________________
Reply With Quote
  #4  
Old 02-17-2012, 07:30 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike Send a message via Skype™ to ffcmike
Quote:
Originally Posted by Crow View Post
Why the extra parentheses around temp.heads here?

Graal Script Code:
triggeraction(this.x+1,this.y+1,"Show",(temp.heads)); 
Yeah, wouldn't this be coercing the array into a string?

Also:

Graal Script Code:
//typo
funciton onCreated(){
  
setshape(1,32,32);

Reply With Quote
  #5  
Old 02-17-2012, 08:54 PM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
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.
Reply With Quote
  #6  
Old 02-17-2012, 08:59 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike Send a message via Skype™ to ffcmike
Quote:
Originally Posted by Tricxta View Post
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.
Reply With Quote
  #7  
Old 02-17-2012, 09:41 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Use a weapon script instead of a level script. Then you can use triggerserver and triggerclient directly to the server and player.
__________________
Quote:
Reply With Quote
  #8  
Old 02-17-2012, 10:55 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
triggeraction does not support sending arrays or the use of commas as a separator for data in one variable.
__________________
Reply With Quote
  #9  
Old 02-18-2012, 03:58 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
Thanks for the info guys. It really helped
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:00 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.