Graal Forums

Graal Forums (
-   Feature request (
-   -   hasscriptaccess() (

zokemon 04-29-2008 09:59 AM

hasscriptaccess(filepath, readonly) - returns true if the file at the given filepath can be accessed with the various load/save functions such as loadlines(). readonly is a bool that is true if you only want to check if the file can be read regardless of if you can write to it.

Graal Script Code:

function onCreated() {
  if (
"I have script access to Graal.exe");
"I do not have script access to Graal.exe");

Would echo "I do not have script access to Graal.exe".

Graal Script Code:

function onCreated() {
  if (
hasscriptaccess("scriptfiles/" servername "/newfile.nw"1))
"I have script access to newfile.nw");
"I do not have script access to newfile.nw");

Would echo "I have script access to newfile.nw".

Of course on the clientside the second parameter would only check if the file was read-only or not.

The function should also be supported serverside which would basically return the (npcserver)'s hasfolderright() to the file with respect to r and rw depending on the second parameter.

What do you think, could you implement this function Stefan? Really would like it for my global client/server file browser I'm making (which is required for my scripted level editor) as well as a few other things.

cbk1994 04-30-2008 02:15 AM

This would be nice, though I can't think of many uses besides a file browser type thing.

zokemon 04-30-2008 07:37 AM

I can't imagine it taking very much time to implement into the new client :).

zokemon 07-01-2008 12:56 AM

Will this be added?

Admins 07-02-2008 07:37 PM

Ok added something, although it's not exactly identical:
getScriptAccessFile(filename, dowrite) returns the file that will be modified when using the specified filename: when the file extension is not allowed then it will return an empty string, otherwise either the filename (if it was including a path name and it's allowed to access) or a filename starting with scriptfiles or scriptfiles/servername.

This will work with the next update of the npcserver and the next client version.

zokemon 07-14-2008 08:22 AM

Perfect, just what I needed! Thank you! ^^

zokemon 07-17-2008 08:19 AM

Umm, is the npcserver gonna be updated anywhere? Almost everywhere I've tried the function doesn't exist.

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

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.