Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Level Directory or Folderconfig via script? (https://forums.graalonline.com/forums/showthread.php?t=134269470)

scriptless 08-13-2014 02:15 AM

Level Directory or Folderconfig via script?
 
Hello all, I was recently using the Pix level editor on my server when I discovered a problem. The script only works with levels in the "levels/" folder. The problem was, I was using "levels/overworld/". So this brings me to a question. Is there a way to return the directory path of the level file? I would like to add this support, if possible, to the editor but for now I just hard coded it to "levels/overworld/".

If not, then what I will have to do is loop thru a list of possible directory configurations. So this brings me to the second part, is it possible to read the folder config, via script?

Torankusu 08-13-2014 05:48 AM

Can you define what you mean by "it only works with..."

What part or feature does not work?

On Delteria we are using his editor (surprise), and every group of levels is stored in a specific folder location within the levels/ folder.

example: levels/deltlite , levels/events , levels/kaljun , levels/dungeons etc.

Make sure you and your NPC servers rights match the folder config (or if you are trustworthy enough, you can give it the rights rw levels/*/*/*, or another form of it....rw levels/*/*)

It's important to note that rights are odd like this, typing out rw WEAPONS/* will not let you edit any weapons that take this format of their name, example: Staff/Tools or Staff/Editors, you need rw WEAPONS/*/* , or subsequently, rw WEAPONS/Staff/*

Hope this helps.

scriptless 08-13-2014 07:39 AM

I was having the exact same problem as Johnny Chimpo.. I did just now notice my rw rights on npc server were messed up saying

rw levels/levels/*

It seems the external rc has been extremely buggy for me lately.

http://forums.graalonline.com/forums...+editor&page=2

Torankusu 08-13-2014 10:21 AM

Johnny and I share a personal dev server (testbed for us both so to speak..), so his workaround would have been my next suggestion.

scriptless 08-13-2014 02:48 PM

Thats why I was wondering if it's possible to read the folder config automatically so you dont have to hardcode the directories. anything with a "level" type in the folder config should show a level that u can warp to. So in theory if you can read it, you can get a list of all directories to test.

Alternatively if I could get the full file path of the file via script that would be even better.

Restraint 08-21-2014 02:41 AM

Quote:

Originally Posted by scriptless (Post 1729991)
Thats why I was wondering if it's possible to read the folder config automatically so you dont have to hardcode the directories. anything with a "level" type in the folder config should show a level that u can warp to. So in theory if you can read it, you can get a list of all directories to test.

Alternatively if I could get the full file path of the file via script that would be even better.

There is a way to do this:

PHP Code:

extractFilePath(filename

For the other thing you wanted: a list of all directories to test, there's a way to do that as well!

You use loadFolder(folder, bool) to load the contents of a folder (starting with levels/) and follow up via fileisfolder(file) to recursively check for and build a directory until you find it.

That'd be disgustingly inefficient compared to extractFilePath(), but you did ask.


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

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