Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-18-2007, 11:05 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
Level Copy // No scripts

Description:
Copys levels from one folder in to another folder, without the scripts! It's magic


How-to:
this.structure = "levels/levels/overworld/";
The current folder that the levels are in

this.newfolder = "levels/newLevels";
The new folder that the levels will be placed in

Code: [Place as a Database NPC]
PHP Code:
function onCreated() {
  
this.structure "levels/levels/overworld/";
  
temp.folder.loadfolder(this.structure "*"0);
  
this.newfolder "levels/newLevels";
  
  
this.onScan(temp.folder);
}

function 
onScan(folder) {  
  for (
temp.0temp.999temp.g++) {
    if (
temp.temp.folder.size()) {
      break;
    }
    
    
temp.data.loadlines(this.structure temp.folder[temp.g]);
    
    
temp.newfile = new[temp.data.size()];
    
temp.0;

    for (
temp.itemp.data) {     
      if (
temp.i.starts("LIN") || temp.i.starts("BOAR") || temp.i.starts("GLEVN")) {
        
temp.newfile[temp.c] = temp.i;
        
temp.c++;
      }
    }

    for (
temp.temp.ctemp.temp.newfile.size(); temp.i++) {
      
temp.newfile[temp.i] = null;
    }

    
temp.newfile.savelines(this.newfolder temp.folder[temp.g], 0);
    echo(
"Saved:" SPC temp.folder[temp.g]);
    
    
temp.folder.delete(temp.g);
  }
  
  if (
temp.folder.size() > 0) {
    
scheduleevent(1"Scan", {temp.folder});
  } else {
    echo(
"Finished copying levels!");
  }

Oh, and don't forget to give the NPC server rights to each folder!
__________________
Reply With Quote
  #2  
Old 12-18-2007, 11:09 PM
MysticalDragonP2P MysticalDragonP2P is offline
Endorian
Join Date: May 2002
Location: Lynn,Mass
Posts: 216
MysticalDragonP2P is on a distinguished road
Send a message via AIM to MysticalDragonP2P Send a message via MSN to MysticalDragonP2P
Great NPC helped out Bravo Evolved alot A++++. Thank YOU!
__________________
MysticalDragon Manager of Endora
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 03:00 AM.


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