Calling a function from within a function

new topic     » topic index » view thread      » older message » newer message

Hello all!

Here's another beginner questions that has me stumped!

I want to call a function from within a function and set the variable to the
returned value.  Here's what I coded and the error message I got back:

sequence DirectoryPath
object FileName
object Path
object File
atom Lines
object strings
object DataRead
object OrdersFileExist


function ReadFactionOrders(integer FactionNumber)
    
    DirectoryPath = {"c:\\warcry\\orders"}
        -- seperated the directory path out for error handling
    FileName = sprintf("faction%d.ord", {FactionNumber})
        -- seperate variable for filename, need to use this twice
    Path = chdir(DirectoryPath) 
        -- sets the working directory to c:\warcry\orders
    File = open(FileName, "r")  
        -- opens the text file, ex. opens faction1.ord orders file
    Lines = CountLines(FileName)        
        -- calls the countlines function to see how many lines of text is
        -- in the file

The last line is what gives me the following:

H:\getorders.e:41
CountLines has not been declared
    Lines = CountLines(FileName)        
                     ^
Countlines is a function that should return how many lines on text is is the
file we are looking at, but for some reason it thinks it's another variable.

Sorry if I'm missing something obvious, but for the life of me I don't know
what!

Thanks!!
Rich

p.s., to give credit where it's due, I got the countlines function out of the
archive, sorry, don't remember the author, but it saved me alot of coding!!
It was just what I needed so a big thank you!!

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu