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 06-05-2007, 05:43 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
copylevel?

Ok, I am trying to use copylevel(), cause I needed a way to make a new level through script, and some body told me to use it.
Now, I tried doing it, but it just wont work....at all.
Heres my example:
PHP Code:
function onPlayerChats(){
if (
player.chat == "/level"){
copylevel("test.nw","test-"@player.account@".nw");
}

It just doesnt work....I tried putting levels/ in front of it, but nothing happened...
Whats wrong?
Or whats another way to make a new blank level through script? ><
Reply With Quote
  #2  
Old 06-05-2007, 05:49 AM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by oo_jazz_oo View Post
Ok, I am trying to use copylevel(), cause I needed a way to make a new level through script, and some body told me to use it.
Now, I tried doing it, but it just wont work....at all.
Heres my example:
PHP Code:
function onPlayerChats(){
if (
player.chat == "/level"){
copylevel("test.nw","test-"@player.account@".nw");
}

It just doesnt work....I tried putting levels/ in front of it, but nothing happened...
Whats wrong?
Or whats another way to make a new blank level through script? ><
Has to be serversided.
__________________
What signature? I see no signature?
Reply With Quote
  #3  
Old 06-05-2007, 05:51 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
I know that. lol
Do you see a //#CLIENTSIDE on my script? no. =/
And even if I dont have player.account in there, it still doenst work.
I tried copylevel("test.nw","test2.nw");
copylevel("test.nw","levels/test2.nw");
but nothing works. x.x
Reply With Quote
  #4  
Old 06-05-2007, 05:55 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Should end up in your scriptfiles folder.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #5  
Old 06-05-2007, 05:55 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
He assumed it was clientside because you're mixing clientside stuff in there.
You have to detect the players chat on the clientside, then trigger the serverside to copy the level.
Reply With Quote
  #6  
Old 06-05-2007, 05:58 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by DustyPorViva View Post
He assumed it was clientside because you're mixing clientside stuff in there.
You have to detect the players chat on the clientside, then trigger the serverside to copy the level.
Doesn't player chat work serverside as well? Several people have told me this.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #7  
Old 06-05-2007, 05:59 AM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by oo_jazz_oo View Post
I know that. lol
Do you see a //#CLIENTSIDE on my script? no. =/
And even if I dont have player.account in there, it still doenst work.
I tried copylevel("test.nw","test2.nw");
copylevel("test.nw","levels/test2.nw");
but nothing works. x.x
Learn to script, My friend. If you have player chat detections, Then you need to have that on clientside. For the copylevel, You need that to be on serverside.
__________________
What signature? I see no signature?
Reply With Quote
  #8  
Old 06-05-2007, 06:05 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
The problem isnt detecting the players chat. -.-
That works serverside too. Cause, when I have
function onPlayerChats(){
if (player.chat == "/test"){
player.chat = "Sucess!";
}
}
it works.
Reply With Quote
  #9  
Old 06-05-2007, 06:11 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by oo_jazz_oo View Post
The problem isnt detecting the players chat. -.-
That works serverside too. Cause, when I have
function onPlayerChats(){
if (player.chat == "/test"){
player.chat = "Sucess!";
}
}
it works.
It gets copied into your scriptfiles folder, for the second time now.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #10  
Old 06-05-2007, 06:28 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Ok, now I have edited it...so, heres what I have now:

in the level:
PHP Code:
//#CLIENTSIDE
function onPlayerChats(){
if (
player.chat == "/buy level"){
triggeraction(0,0,"serverside","npc","room",player.account);
player.chat "Baught A Room!";
}

in the npc:
PHP Code:
function onActionServerside(){
if (
params[0] == "room"){
player.rupees -=5000;
clientr.hasroom "true";
copylevel("gle_pr-test.nw","levels/gle_pr-"@params[1]@".nw");
clientr.gle "gle_pr-"@params[1]@".nw";
}

Now, the money is subtracted, the clientr.flags are set...but no level is being made.
Reply With Quote
  #11  
Old 06-05-2007, 06:42 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
I've mentioned it a few times now and you just looked over me.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.

Last edited by killerogue; 06-05-2007 at 08:22 AM.. Reason: Unnecessary Hostility
Reply With Quote
  #12  
Old 06-05-2007, 06:48 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by killerogue View Post
Are You Just No Paying Attention To Me? They Levels Are Copied In The Damn Scriptfiles Folder Idiot.
You're the idiot, scriptfiles folder is clientside and copylevel does not work clientside. The level is copied where you specify on the serverside.

To the one with the question, make sure your npcserver has rights to that folder. I can't think of any problems other than that if you're actually reaching the copylevel() function in your script.
__________________
Reply With Quote
  #13  
Old 06-05-2007, 07:06 AM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Simple example.

PHP Code:
copylevel("levels/onlinestartlocal.nw""levels/onlinestartlocal2.nw"); 
If this doesn't work, Then sue me.
__________________
What signature? I see no signature?
Reply With Quote
  #14  
Old 06-05-2007, 07:45 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Inverness View Post
You're the idiot, scriptfiles folder is clientside and copylevel does not work clientside. The level is copied where you specify on the serverside.

To the one with the question, make sure your npcserver has rights to that folder. I can't think of any problems other than that if you're actually reaching the copylevel() function in your script.
You positive? >_> I CLEARLY remember Tig using copylevel on my server when I was trying to use it. I went back and checked scriptfiles and there were files there plain as day.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #15  
Old 06-05-2007, 08:34 AM
Luda Luda is offline
Registered User
Join Date: Aug 2005
Location: Canada
Posts: 2,071
Luda has much to be proud ofLuda has much to be proud ofLuda has much to be proud ofLuda has much to be proud ofLuda has much to be proud ofLuda has much to be proud of
Send a message via AIM to Luda
SCRIPT FIGHTS!! BLAHHhhh! First on to make me a gf out of scriptswins
Reply With Quote
  #16  
Old 06-05-2007, 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
Quote:
Originally Posted by Inverness View Post
You're the idiot, scriptfiles folder is clientside and copylevel does not work clientside. The level is copied where you specify on the serverside.

To the one with the question, make sure your npcserver has rights to that folder. I can't think of any problems other than that if you're actually reaching the copylevel() function in your script.
Script files is a folder that is created in the file browser (serverside) when the npc server does not have rights to the file you are trying to write to. Stan is right, the files should be placed in scriptfiles/.
__________________
Do it with a DON!
Reply With Quote
  #17  
Old 06-05-2007, 10:13 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by zokemon View Post
Script files is a folder that is created in the file browser (serverside) when the npc server does not have rights to the file you are trying to write to. Stan is right, the files should be placed in scriptfiles/.
I already went onto the server and made sure the rights were set correctly for the folder and restarted the npcserver, unless for some reason "rw levels/*.*" would not work. I blame Stefan for lack of documentation anyhow. If the files were to appear in scriptfiles/ then there is some kind of engine-related error.
__________________
Reply With Quote
  #18  
Old 06-05-2007, 10:53 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
In truth, I don't know about copylevel since I haven't used it since before the NPC Server security patch. I'm only going off what other file related functions do when the npc server has no rights to a file.
__________________
Do it with a DON!
Reply With Quote
  #19  
Old 06-05-2007, 11:00 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
The "copylevel" command doesn't have special restrictions right now, although we should probably add some so that it cannot be abused.
copylevel("mylevel.nw","overworld/newlevel.nw"); will copy mylevel.nw to levels/overworld/newlevel.nw. "mylevel.nw" must be visible via /find, it doesn't need to be in some special folder. The destination path (levels/overworld) must exist, it is not creating the path.
Reply With Quote
  #20  
Old 06-05-2007, 11:30 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
The way it used to work, was that it could NOT copy level from a folder and to the same one. Had to be copied TOO another folder.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #21  
Old 06-06-2007, 02:56 PM
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
In the NPC-Server's rights, add
rw levels/*.nw

Here is an example of how to copy levels (GUI/Weapon-Script):
PHP Code:
function onActionServerSidecmd )
{
  switch ( 
cmd )
  {
    case 
"createHouse":
    {
       
temp.levelCopy "levels/housetemplate.nw"// Copys from levels/housetemplate.nw
       
temp.newCopy format"levels/house_%s.nw"player.account ); // New level in levels/ and named house_ACCOUNT.nw
       
temp.templateLevel.loadLinestemp.levelCopy );
       
       
saveLinestemp.newCopytemp.templateLevelfalse );
       break;
    }
  }
}
//#CLIENTSIDE
function onPlayerChats()
{
  if ( 
player.chat == "/create house" )
  {
    
triggerServer"gui"name"createHouse" );
  }

__________________
Reply With Quote
  #22  
Old 06-06-2007, 03:23 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 cbkbud View Post
In the NPC-Server's rights, add
rw levels/*.nw

Here is an example of how to copy levels (GUI/Weapon-Script):
PHP Code:
Blargarble 
Yes, but everyone should keep in mind that this way is much more insecure as it allows scripts to now directly edit any .nw file in the levels folder and do harmful things (such as changing npc scripts and other stuff). I recommend just figuring out how to make copylevel() work instead.
__________________
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 09:19 PM.


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