Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-05-2009, 05:16 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
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"); 
Reply With Quote
  #2  
Old 08-05-2009, 05:20 PM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
Nice
rep++
Reply With Quote
  #3  
Old 08-05-2009, 06:14 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Hm... the points you stated are all quite obvious.. oO

Not trying to troll, lol
Reply With Quote
  #4  
Old 08-05-2009, 06:38 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #5  
Old 08-05-2009, 06:45 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Pelikano View Post
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 View Post
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.
Reply With Quote
  #6  
Old 08-06-2009, 12:05 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by fowlplay4 View Post
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.
__________________
Reply With Quote
  #7  
Old 08-06-2009, 03:05 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by fowlplay4 View Post
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?
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #8  
Old 08-06-2009, 05:12 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
  #9  
Old 08-06-2009, 03:59 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Gambet View Post
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.
Reply With Quote
  #10  
Old 08-06-2009, 04:27 PM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Crow View Post
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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #11  
Old 08-26-2009, 04:54 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
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.
Reply With Quote
  #12  
Old 08-26-2009, 07:19 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Gambet View Post
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #13  
Old 08-26-2009, 07:42 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by LoneAngelIbesu View Post
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
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 12:33 AM.


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