Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Finding a file (https://forums.graalonline.com/forums/showthread.php?t=63826)

Yen 01-31-2006 04:18 AM

Finding a file
 
Is there any command that finds the path of a file?
i.e. if I had 'zomg.png' in 'levels/images/,' it would return 'images/zomg.png'

Ajira 01-31-2006 04:48 AM

No. Scan through every folder =D

Yen 01-31-2006 05:17 AM

D: Yeah, I did that.
However, when it finds the file, it's not returning the index. :/

PHP Code:

for (afolders) {
  
temp.zomg.loadfolder(level0);
  if (
temp.zomg.index(level) != -1player.chat "FOUND";


If I do 'player.chat @= temp.zomg' it will add my level to my chat, so it's definately finding it.

Yen 01-31-2006 05:20 AM

Nevermind, I did 'if (temp.zomg[0] == level)' and it worked.
Is the index thing a bug? Or does it just not work serverside?

Rick 01-31-2006 07:44 AM

Don't you mean .indexof()?

Inverness 01-31-2006 02:49 PM

Couldn't you use 'if (level in temp.zomg)' ?

Yen 01-31-2006 05:40 PM

Quote:

Originally Posted by Rick
Don't you mean .indexof()?

.index() has worked for me since v3 O-o
It's what's listed in the docu_graalscript.txt, as well.


Quote:

Originally Posted by Inverness
Couldn't you use 'if (level in temp.zomg)' ?

Probably! :O


All times are GMT +2. The time now is 12:23 AM.

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