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 01-17-2008, 05:34 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Appending to a clientr. array

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,swor d,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,swor d,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):
PHP Code:
      clientr.("wpn_" @ (@itemname) @ "-" @ (@itemid))={
        {
itemid,item.(@itemname).arcname,item.(@itemname).itemname},
        {
item.(@itemname).iconimage,item.(@itemname).weaponimage},
        {
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));
      } 
Reply With Quote
  #2  
Old 01-17-2008, 06:02 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
... 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 ).
Reply With Quote
  #3  
Old 01-17-2008, 06:04 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #4  
Old 01-17-2008, 09:35 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Quote:
Originally Posted by Novo View Post
... 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).
Reply With Quote
  #5  
Old 01-17-2008, 10:12 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Does that mean that this will be fixed soonish, or I'm screwed?
Reply With Quote
  #6  
Old 01-18-2008, 01:03 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by DustyPorViva View Post
Does that mean that this will be fixed soonish, or I'm screwed?
PHP Code:
temp.var = clientr.var;
clientr.var = "";
clientr.var = temp.var; 
A way to 'trick' an update.
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 08:26 AM.


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