Graal Forums

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

oo_jazz_oo 06-05-2007 05:43 AM

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? ><

godofwarares 06-05-2007 05:49 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1315232)
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.

oo_jazz_oo 06-05-2007 05:51 AM

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

killerogue 06-05-2007 05:55 AM

Should end up in your scriptfiles folder.

DustyPorViva 06-05-2007 05:55 AM

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.

killerogue 06-05-2007 05:58 AM

Quote:

Originally Posted by DustyPorViva (Post 1315238)
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. >_<

godofwarares 06-05-2007 05:59 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1315236)
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.

oo_jazz_oo 06-05-2007 06:05 AM

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.

killerogue 06-05-2007 06:11 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1315241)
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.

oo_jazz_oo 06-05-2007 06:28 AM

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.

killerogue 06-05-2007 06:42 AM

I've mentioned it a few times now and you just looked over me. :(

Inverness 06-05-2007 06:48 AM

Quote:

Originally Posted by killerogue (Post 1315246)
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.

godofwarares 06-05-2007 07:06 AM

Simple example.

PHP Code:

copylevel("levels/onlinestartlocal.nw""levels/onlinestartlocal2.nw"); 

If this doesn't work, Then sue me.

killerogue 06-05-2007 07:45 AM

Quote:

Originally Posted by Inverness (Post 1315248)
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.

Luda 06-05-2007 08:34 AM

SCRIPT FIGHTS!! BLAHHhhh! First on to make me a gf out of scriptswins

zokemon 06-05-2007 10:02 AM

Quote:

Originally Posted by Inverness (Post 1315248)
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/.

Inverness 06-05-2007 10:13 AM

Quote:

Originally Posted by zokemon (Post 1315278)
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.

zokemon 06-05-2007 10:53 AM

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.

Admins 06-05-2007 11:00 AM

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.

xXziroXx 06-05-2007 11:30 AM

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.

cbk1994 06-06-2007 02:56 PM

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" );
  }



zokemon 06-06-2007 03:23 PM

Quote:

Originally Posted by cbkbud (Post 1315568)
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.


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.