Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Bug Report (https://forums.graalonline.com/forums/forumdisplay.php?f=193)
-   -   clientr multidimensional arrays not syncing (https://forums.graalonline.com/forums/showthread.php?t=134264733)

0PiX0 10-07-2011 07:27 PM

clientr multidimensional arrays not syncing
 
Multidimensional array values in clientr are not synced to the clientside when manipulated directly.

In the following example, after the code has run, the client still reads player.clientr.something as {{1, 1}}
PHP Code:

player.clientr.something = {{11}};
player.clientr.something[0][1] = 2// this line's changes are not synced to clientside 


cbk1994 10-07-2011 10:58 PM

I've replicated this. Looks like it's not being saved in the player's attributes (not shown in "/open account", even after reconnecting).

Testing code:

PHP Code:

function onCreated() {
  
temp.pl findPlayer("YOUR_ACCOUNT");
  
  
temp.pl.clientr.test = {{"one""two"}};
  
temp.pl.clientr.test[0][1] = "three";
  
  echo(
"server: " temp.pl.clientr.test);
  
  
temp.pl.addWeapon(this.name);
  
temp.pl.triggerClient("gui"this.name"check");
}

function 
onActionServerSide(temp.cmdtemp.data) {
  if (
temp.cmd == "returnCheck") {
    echo(
"client: " temp.data);
  }
}

//#CLIENTSIDE
function onActionClientSide(temp.cmd) {
  if (
temp.cmd == "check") {
    
triggerServer("gui"this.name"returnCheck"player.clientr.test);
  }


Output on Ol' West:
PHP Code:

Weapon/GUI-script wtf added/updated by cbk1994
server
"one,three",
client"one,two"


Admins 10-08-2011 01:27 PM

Yes, not sure if it should be supported. When you have complex data then just assign it one time to the client./clientr. variable so that it's not sent ten times to the client.

ffcmike 10-08-2011 02:29 PM

Quote:

Originally Posted by Stefan (Post 1670297)
Yes, not sure if it should be supported. When you have complex data then just assign it one time to the client./clientr. variable so that it's not sent ten times to the client.

Does this mean that data is being sent to the client (or multiple clients when it comes to attr[] values) upon every single assignment?
I'd have imagined it would be happening just the one time at the end of the script process to avoid this.

Admins 10-08-2011 06:33 PM

Each time you change it yes, to be in sync with triggers and such stuff.

0PiX0 10-09-2011 12:03 AM

I was thinking the same as Thor. That's good to know. It would be very helpful if there was an event for when clientr variables get updated.

ffcmike 10-25-2011 07:18 PM

Quote:

Originally Posted by Stefan (Post 1670320)
Each time you change it yes, to be in sync with triggers and such stuff.

Is this also the case with modifying serverr. variables?

Skyld 10-25-2011 07:51 PM

Quote:

Originally Posted by ffcmike (Post 1671761)
Is this also the case with modifying serverr. variables?

Yes.


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

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