PDA

View Full Version : Finding a file


Yen
01-31-2006, 04:18 AM
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. :/

for (a: folders) {
temp.zomg.loadfolder(a @ level, 0);
if (temp.zomg.index(level) != -1) player.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
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.


Couldn't you use 'if (level in temp.zomg)' ?
Probably! :O