Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-09-2006, 04:27 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
The mass deletion of client. and clientr. variables! Yay!

So I want to be able to delete mass amounts of client. and clientr. variables in the most efficient way.

First thing I tried:

NPC Code:
for (temp.d : client.blah.getdynamicvarnames()) {
("client.blah." @ temp.d) = "";
}



A for loop that checks all the getdynamicvarnames() and deletes all that data in each sub variable. Problem here is you get a "folder depth" issue where you have to have for loops inside for loops if you have variables like this:
client.blah.rar.test (while trying to clear client.blah)

This method works but is obviously very lag intensive.

Second thing I tried:

NPC Code:
client.blah.copyfrom(null);



This is a much easier way to clear all the data and sub-variables in the variable but there remains a big problem with client. and clientr. variables:
If a client. or clientr. variable is cleared using a method such as copyfrom(), The effect can be seen on the side it is done on (clientside or serverside) but the effect does not transfer over to the other side and also does not save to the account (you don't see the changes if you do "/open account" in rc).

Third thing I tried

NPC Code:
client.blah = new TStaticVar("client.blah");
client.blah.destroy();
client.blah = new TGraalVar("client.blah");



Maybe making a client. or clientr. variable an object and then destroying it will work? Not quiet. It deletes all the data and sub-variables like we want but it has the same problem as above: The data does transfer to the other side.

So...

Anyone have another way to do this? Thoughts on the process? Ideas? Questions? Comments?

Thanks,
- Zero
__________________
Do it with a DON!
Reply With Quote
  #2  
Old 11-09-2006, 08:09 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
PHP Code:
for (igetstringkeys("client.foo.")) {
 
client.foo.(@ i) = NULL;

im suprised 27 views before me and I still managed to get here in time. But there you go.
Reply With Quote
  #3  
Old 11-09-2006, 08:59 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Andy0687 View Post
PHP Code:
for (igetstringkeys("client.foo.")) {
 
client.foo.(@ i) = NULL;

im suprised 27 views before me and I still managed to get here in time. But there you go.
Quote:
Originally Posted by zokemon View Post
First thing I tried:

NPC Code:
for (temp.d : client.blah.getdynamicvarnames()) {
("client.blah." @ temp.d) = "";
}



A for loop that checks all the getdynamicvarnames() and deletes all that data in each sub variable. Problem here is you get a "folder depth" issue where you have to have for loops inside for loops if you have variables like this:
client.blah.rar.test (while trying to clear client.blah)

This method works but is obviously very lag intensive.
Already did that. Please read what I said and what I am asking.
__________________
Do it with a DON!
Reply With Quote
  #4  
Old 11-09-2006, 08:59 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by zokemon View Post
Already did that. Please read what I said and what I am asking.
How many sub categories can it go in from client.?
Reply With Quote
  #5  
Old 11-09-2006, 09:02 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by KuJi View Post
How many sub categories can it go in from client.?
As many loops as you are willing to add. I suppose you could do some sort of function loop but all of this is very bad and laggy.
__________________
Do it with a DON!
Reply With Quote
  #6  
Old 11-09-2006, 09:12 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by zokemon View Post
Already did that. Please read what I said and what I am asking.
Mmm, sorry about that, I skipped over the part where you said about "folder depth" issues, how many variables could you have where it becomes THAT laggy anyways for such a long period of time that it would become an incuberance to gameplay?
Reply With Quote
  #7  
Old 11-09-2006, 10:19 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
I see the bug, knda
I did this though, dunno if it's of value

HTML Code:
temp.curList = getstringkeys("client.");
this.clearList("client.", temp.curList);

function clearList(stringType, currentList)
{
  for (temp.curString: temp.currentList) 
  {
    unset( (@ temp.stringType @ temp.curString) );
  }
}
__________________

Last edited by xAndrewx; 11-09-2006 at 03:11 PM..
Reply With Quote
  #8  
Old 11-09-2006, 09:24 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Andy0687 View Post
Mmm, sorry about that, I skipped over the part where you said about "folder depth" issues, how many variables could you have where it becomes THAT laggy anyways for such a long period of time that it would become an incuberance to gameplay?
It is not so much an incuberance to game play as it is simply an issue of having more serverside cpu usage. I have many cases where I have to delete huge sections of variables because savevars() does not delete variables that aren't actually writen in the txt you are calling it from.

My 1st method is the method I am using right now...I just wanted to know if someone found a better way...

Quote:
Originally Posted by xAndrewx View Post
I see the bug, knda
I did this though, dunno if it's of value

HTML Code:
temp.curList = getstringkeys("client.");
this.clearList("client.", temp.curList);

function clearList(stringType, currentList)
{
  for (temp.curString: temp.currentList) 
  {
    unset( (@ temp.stringType @ temp.curString) );
  }
}
That is pretty much what I did in my first method except you seemed to add a little more unnecessary code.
__________________
Do it with a DON!
Reply With Quote
  #9  
Old 11-09-2006, 10:42 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Ooh, you're wanting to clear a document?
__________________
Reply With Quote
  #10  
Old 11-10-2006, 02:37 AM
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
Probably client.blah = ""; should be enough, if that is not working then it should be made working I guess.
Reply With Quote
  #11  
Old 11-10-2006, 03:24 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
No I just want to clear a large number of variables o_o
__________________
Do it with a DON!
Reply With Quote
  #12  
Old 11-10-2006, 08:50 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
PHP Code:
function onCreated()
  {
  
clearList"client" );
  }

function 
clearListstrName )
  {
  for ( 
temp.dmakevarstrName ).getvarnames() )
    
clearListstrName @"."temp.);

  
makevarstrName ) = "";
  } 
Reply With Quote
  #13  
Old 11-10-2006, 10:02 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Yes I mentioned that you can do that via functions but it doesn't show a less lag instensive way.
__________________
Do it with a DON!
Reply With Quote
Reply


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


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