PDA

View Full Version : Appending to a clientr. array


DustyPorViva
01-17-2008, 05:34 AM
So I'm setting an array on the serverside, it works fine. BUT it won't let me append to it... I mean, it will, but it's acting really strange.
First off, if I append to it(add(), or manually changing the arrays) it will show fine on the serverside. BUT, those same changes won't show on the clientside.

This is my echo of the array on the serverside:
"124,woodensword,""Wooden Sword""","arca_sword_wooden,door.png","weapon,sword,balanced","1,1,2,0,2","0,0,0,0,0","""shortsword,""""2,2,2,0,2"""""",""longsword,""""2,2,2,0,2"""""",""dagger,""""2,2,2,0,2"""""""

This is the echo clientside:
"124,woodensword,""Wooden Sword""","arca_sword_wooden,door.png","weapon,sword,balanced","1,1,2,0,2","0,0,0,0,0","0,0,0"

What's with that? Oh, and here's the script(partial/edited out):
clientr.("wpn_" @ (@itemname) @ "-" @ (@itemid))={
{itemid,item.(@itemname).arcname,item.(@itemname). itemname},
{item.(@itemname).iconimage,item.(@itemname).weapo nimage},
{item.(@itemname).type,item.(@itemname).weapontype ,item.(@itemname).swordtype},
item.(@itemname).basestats,
{0,0,0,0,0},
new[item.(@itemname).nextsteps],
};
for (i=0;i<item.(@itemname).nextsteps;i++) {
clientr.("wpn_" @ (@itemname) @ "-" @ (@itemid))[5][i]=(item.(@itemname).(@"progress_" @ i));
}

Novo
01-17-2008, 06:02 AM
... Asking help on appending problems; supplying a code with no appending functions. Daddy must be proud.

On topic: I know that appending to a subarray might not update the parent array's value... So it doesn't know it changed and thus doesn't update on clientside. ( This may or may not have been fixed, but it was something I had problems with in the long-past ).

DustyPorViva
01-17-2008, 06:04 AM
Well, I had it appending, but while trying to fix the problem, I ended up with the code that's displayed... which is essentially making blank subarrays and filling them. Same result in the end.

Admins
01-17-2008, 09:35 PM
... Asking help on appending problems; supplying a code with no appending functions. Daddy must be proud.

On topic: I know that appending to a subarray might not update the parent array's value... So it doesn't know it changed and thus doesn't update on clientside. ( This may or may not have been fixed, but it was something I had problems with in the long-past ).

The array problem has been fixed a long time ago, but client/clientr strings are differently (same with attr[]) and are only sent when they are updated. So it eventually doesn't detect the update when you modify a sub-array member of a client/clientr variable. It should be quite easy to fix that but requires some testing (to not send too many updates of the client/clientr variables, people already abuse them as temporary variables or similar).

DustyPorViva
01-17-2008, 10:12 PM
Does that mean that this will be fixed soonish, or I'm screwed?

Novo
01-18-2008, 01:03 AM
Does that mean that this will be fixed soonish, or I'm screwed?


temp.var = clientr.var;
clientr.var = "";
clientr.var = temp.var;


A way to 'trick' an update.