Graal Forums

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

Luigi203 04-30-2007 08:25 PM

fileexists
 
Whats the deal with fileexists()? Is it just not working correctly? This is starting to annoy me..

PHP Code:

function PosseExistsgetfile) {
  return 
fileExists("documents/posses/" getfile ".arc");



No matter what I try, fileExists() constantly returns false.

Chandler 04-30-2007 08:39 PM

Ask yourself it the file exists! :p

Luigi203 04-30-2007 08:46 PM

I know the file exists.. but the script doesnt :]

DustyPorViva 04-30-2007 08:56 PM

He's holding back, torture should get him to confess.

Deadly_Killer 04-30-2007 09:03 PM

You may need to give the npc-server read rights to the file.

Anyway, here is a function which uses loadlines to check if a file exists.

PHP Code:

function fileexists2(file) {
  
temp.file.loadlines(file);
  
  if (
temp.file.length() > 0) {
    return 
true;
  }

  return 
false;



zokemon 04-30-2007 10:22 PM

Quote:

Originally Posted by Deadly_Killer (Post 1304627)
You may need to give the npc-server read rights to the file.

Anyway, here is a function which uses loadlines to check if a file exists.

PHP Code:

function fileexists2(file) {
  
temp.file.loadlines(file);
  
  if (
temp.file.length() > 0) {
    return 
true;
  }

  return 
false;



Ahh that's not true though because the file can still have 0 bytes and exist but your function would return false! It is better to do:
temp.file.size() > 0

Inverness 05-01-2007 09:14 AM

I think it might have something to do with the folder configuration. Certain functions work or don't work outside of the levels/ folder.


All times are GMT +2. The time now is 10:49 AM.

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