Jump to content

Help with a function


Recommended Posts

I'm working on a little utility to edit some .htm files from a game i play.

The numbers on the page are images with random name. I have isolated the img names. And made this function to give me the right number.

$number = finnNr("adfmd.gif")
MsgBox(0, "test", $number)
Exit

Func finnNr($search)
     $file = FileOpen("img.txt",1)
     While 1
        $line = FileReadLine($file, 1)
        If $search == $line  Then
            Return FileReadLine($file, 1)
        EndIf
        If @error Then ExitLoop
     WEnd
     Return "NA"
EndFunc

the start of img.txt is:

adfmd.gif
5
aepvl.gif
8
aidph.gif
4
amljf.gif
9
asnfd.gif
8

As i see this shuld return "5", but it only give me "NA". I cant see what i'm doing wrong.

If you see whats wrong or know a better way to do it please let me know. :)

Thanks.

-Ols

Link to comment
Share on other sites

two questions for you:

1.) What does FileOpen() when you call it with option 1?

2.) What does FileReadLine() when you call it with a second parameter?

The answer to those questions will make your script work.

EDIT: Damn... too late ... :)

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...