Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   How-To: copylevel() (https://forums.graalonline.com/forums/showthread.php?t=87262)

Gambet 08-05-2009 05:16 PM

How-To: copylevel()
 
I ran into some problems using copylevel() yesterday and had to look at resources from different threads to figure out my problem entirely so I decided to put all my findings into one thread in hopes that it makes it easier for others to understand how to use this command.


Important Notes

. copylevel() is used to create an exact duplicate of a level that will be saved into a different directory from that of the level being copied (the copied level does NOT have to have the same name as the original level)
. The NPC-Server must have read rights to the directory where the level to be copied can be found.
. The NPC-Server must have read/write rights to the directory where the copied level is going to be saved.
. There must be a placeholder file in the directory that you're going to save the copied level to that is bigger than 0 kb in order for the level to be saved correctly (assuming the directory didn't exist before and doesn't have any files in it).
. Avoid using "levels/" when defining your directories in both parameters.
. copylevel() can only be performed on the serverside.


Example

You wish to copy testLevel.nw from the levels/test/ directory into the levels/backup/test/ directory (assuming all the notes above are met):

PHP Code:

copylevel("test/testLevel.nw""backup/test/testLevel.nw"); 


Soala 08-05-2009 05:20 PM

Nice :)
rep++

Pelikano 08-05-2009 06:14 PM

Hm... the points you stated are all quite obvious.. oO

Not trying to troll, lol

fowlplay4 08-05-2009 06:38 PM

Don't forget the part, if you try to copy too many levels in a small duration the npc server stops and disables the command for a bit.

Gambet 08-05-2009 06:45 PM

Quote:

Originally Posted by Pelikano (Post 1513175)
Hm... the points you stated are all quite obvious.. oO


Just because something is obvious to you doesn't mean it's obvious to everyone else. Regardless, some of those points are not as obvious as you put them out to be, such as the placeholder file point.


Quote:

Originally Posted by fowlplay4 (Post 1513182)
Don't forget the part, if you try to copy too many levels in a small duration the npc server stops and disables the command for a bit.


Positive about this? I've never tried copying a massive load of levels before so I wouldn't know anything about it.

cbk1994 08-06-2009 12:05 AM

Quote:

Originally Posted by fowlplay4 (Post 1513182)
Don't forget the part, if you try to copy too many levels in a small duration the npc server stops and disables the command for a bit.

How many? I've done it with at least 50 at once.

Programmer 08-06-2009 03:05 AM

Quote:

Originally Posted by fowlplay4 (Post 1513182)
Don't forget the part, if you try to copy too many levels in a small duration the npc server stops and disables the command for a bit.

I copied a pretty big GMap with no problems whatsoever. What, are you doing it with 9000+ files?

fowlplay4 08-06-2009 05:12 AM

Maybe it's different for each server, but I was attempting to mirror all the levels on Zodiac to a different folder, failed with the file i/o spam prevention. Then I kept trying and I was getting the flood warning after 200 levels, it sucked.

Crow 08-06-2009 03:59 PM

Quote:

Originally Posted by Gambet (Post 1513186)
Just because something is obvious to you doesn't mean it's obvious to everyone else. Regardless, some of those points are not as obvious as you put them out to be, such as the placeholder file point.

Well, I think it's obvious as well. The folder doesn't exist if you just give yourself read and write rights to it. Putting a file into the folder which has at least the size of a byte will basically create the folder on the machine, and my theory is that you can remove that file again and copylevel() will then work without a placeholder.

LoneAngelIbesu 08-06-2009 04:27 PM

Quote:

Originally Posted by Crow (Post 1513335)
Well, I think it's obvious as well. The folder doesn't exist if you just give yourself read and write rights to it. Putting a file into the folder which has at least the size of a byte will basically create the folder on the machine, and my theory is that you can remove that file again and copylevel() will then work without a placeholder.

It's not obvious, as I just learned that you need to do it. ^^ Stop bickering. This is the kind of documentation you guys have been begging the GST to make.

Gambet 08-26-2009 04:54 AM

Would be good if there was some type of tutorial section dedicated solely to threads of this nature to make it easier to find the proper ways of using different commands.

napo_p2p 08-26-2009 07:19 AM

Quote:

Originally Posted by Gambet (Post 1518564)
Would be good if there was some type of tutorial section dedicated solely to threads of this nature to make it easier to find the proper ways of using different commands.

It might be better suited as a wiki article, with a link off the main GScript page.

Pelikano 08-26-2009 07:42 PM

Quote:

Originally Posted by LoneAngelIbesu (Post 1513342)
It's not obvious, as I just learned that you need to do it. ^^ Stop bickering. This is the kind of documentation you guys have been begging the GST to make.

Please talk about yourself o_O


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

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