Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Read from graal Directory (https://forums.graalonline.com/forums/showthread.php?t=134262936)

MrOmega 04-22-2011 12:05 PM

Read from graal Directory
 
I'm new to savelines/loadlines so an example of such would be nice, few other forum posts Ive looked at aren't helping. But is it possible to read from the Graal Directory, eg, loading the readme.txt file?

fowlplay4 04-22-2011 07:09 PM

The root/default folder is:

graaldir/scriptfiles/yourservername/

You can also load/save files in the levels folder:

levels/path/to/file

But no you can't read things in the root of the graaldir with the functions available.

MrOmega 04-25-2011 05:58 PM

would I be able to read the files in tileobjects/

this doesn't seem to work.

loadlines( "graaldir/tileobjects/objectsHouse Inside.txt");

Crow 04-25-2011 06:02 PM

Quote:

Originally Posted by MrOmega (Post 1645495)
would I be able to read the files in tileobjects/

this doesn't seem to work.

loadlines( "graaldir/tileobjects/objectsHouse Inside.txt");

The "tileobjects" folder is in the root directory and not the levels one, so it probably won't work.

fowlplay4 04-25-2011 06:18 PM

This works just fine (in V6):

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
temp.files.loadfolder("tileobjects/*"1);
  for (
temp.filetemp.files) {
    
temp.str.loadstring("tileobjects/" temp.file);
    echo(
temp.file SPC "size: " temp.str.length());
  }


outputs...

objectscastle.txt size: 2862
objectshouse inside.txt size: 2742
objectssnow.txt size: 5679
objectsstandard.txt size: 11183
objectsvolcano.txt size: 5345

Admins 05-14-2011 05:38 PM

Access to tileobjects folder has been added in v6 to make it easier to write a scripted level editor.

Cubical 06-28-2013 10:40 PM

Does fileexist(str) read from scriptfiles/ or levels/? cant seem to get it to work for either of them as its always returning false.

edit: nevermind i realized i apparently pulled a ravej and lost any knowledge of the english language.
I was using fileexist instead of fileexists and did not realize it until i checked /scripthelp


All times are GMT +2. The time now is 09:02 AM.

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