Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   For( problem. (https://forums.graalonline.com/forums/showthread.php?t=82777)

Ronnie 11-15-2008 05:00 AM

For( problem.
 
Inside the for( there is something wrong, and I know I'm redefining inside the for( but that's not the problem, the array d.lists is a list of player accounts and then once it converts to dband, I need it to load all those accounts files "guild/player saccount_groster.txt" then remove the d.guild which is a guildname and then reupload it using savelines.All the params are correct I echoed them all. Someone Help!

PHP Code:

    case "disband":
      
d.guild params[1];
      
d.plr params[2];
      
dingguild.loadlines("guild/local_guilds_list.txt");
      
dingguild.remove(d.guild);
      
deletefile("guild/"@d.guild@"_glist.txt");
      
d.lists loadlines("guild/"@d.guild@"_groster.txt");

//Where it fails ;/--------------------------------------
           
for (dbandd.lists){
       
dgrstr.loadlines("guild/"@dband@"_glist.txt");
       
dgrstr.remove(d.guild);
       
dgrstr.savelines("guild/"@dband@"_glist.txt"0);
       
dppl findPlayer(dband);
       
dppl.chat "The guild, "@d.guild@" has been disbanded!";
       
with(dppl)clientr.(@d.guild).rank=0;
       }

      
removeguild(@d.guild);
      
deletefile("guild/"@d.guild@"_groster.txt");
      
l.list.loadlines("guild/Leaders_list.txt");
      
l.list.remove(@d.guild@"="@d.plr@"");[CODE][/CODE]
      
l.list.savelines("guild/Leaders_list.txt"0);
      break; 

Thanks in advance
-Ronnie

cbk1994 11-15-2008 05:04 AM

try for ( temp.dband : d.lists ), and also try echoing (if you haven't for some reason) d.lists to see that it actually is an array.

EDIT: You really should declare your variables as temporary with a temp. prefix anyway, so they aren't global variables.

Tigairius 11-15-2008 05:04 AM

What does d.lists echo?

Ronnie 11-15-2008 05:13 AM

Actually guys figured it out for some odd reason

PHP Code:

d.lists loadlines("guild/"@d.guild@"_groster.txt"); 

Did not work so then I decided to use

PHP Code:

d.lists.loadlines("guild/"@d.guild@"_groster.txt"); 

And it did, thanks for everyones help though:D

-Ronnie



Will do @ Cbk, that should reduce lag also , or atleast a tiny bit?

Admins 11-15-2008 03:10 PM

Its probably not increasing the speed a lot but using proper variable names instead of "d" or "dppl" is always good :)

Crow 11-15-2008 07:55 PM

I'm pretty sure using temp. variables lowers the memory usage.

Loriel 11-15-2008 11:00 PM

Quote:

Originally Posted by Crow (Post 1442409)
I'm pretty sure using temp. variables lowers the memory usage.

It also cures cancer.

Crow 11-15-2008 11:28 PM

Quote:

Originally Posted by Loriel (Post 1442455)
It also cures cancer.

I bet it does.

cbk1994 11-15-2008 11:51 PM

Quote:

Originally Posted by Crow (Post 1442409)
I'm pretty sure using temp. variables lowers the memory usage.

Would seem like it should, since the variables will be deleted when the function (or loop, etc) is over, rather than storing them.

Though I'm not sure if it's stored on the hard drive (virtual memory) or actual memory on the systems running the servers.

Inverness 11-16-2008 12:22 AM

Quote:

Originally Posted by cbk1994 (Post 1442478)
Would seem like it should, since the variables will be deleted when the function (or loop, etc) is over, rather than storing them.

Though I'm not sure if it's stored on the hard drive (virtual memory) or actual memory on the systems running the servers.

:rolleyes: There is no way active variables are stored in anything but the RAM.

Now then, Stefan was talking about variable names, not whether they're temporary variables or not, because obviously properly descriptive variable names improve comprehension.

cbk1994 11-16-2008 12:41 AM

Quote:

Originally Posted by Inverness (Post 1442498)
Now then, Stefan was talking about variable names, not whether they're temporary variables or not, because obviously properly descriptive variable names improve comprehension.

We realize this. We were responding to "Will do @ Cbk, that should reduce lag also , or atleast a tiny bit?"


All times are GMT +2. The time now is 05:10 AM.

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