Posted: 21st Dec 2011 0:36
Given this code, the ONLY thing I should see on the screen is the value of count, a single number. However, look at the image of my output, it makes no sense!

+ Code Snippet
    s$ = "test"
    openToRead(1, "dict7.txt")
    if fileIsOpen(1) = 0
        `if getErrorOccurred() then s$ = getLastError()
    else
        s$ = readString(1)
        count = val(s$)
        r = random(1, count)

        for i = 1 to r
            `s$ = readString(1)
        next i

        closeFile(1)
    endif

    print("1. "+s$)

    sync()
    do:loop


Posted: 21st Dec 2011 1:05
With the first version of AppGameKit there was (and still could be) a bug with "Read String" that would actually read out the whole file. The solution was to use "ReadLine( )" instead of "ReadString( )". Give that a try, and if that doesn't work, mind posting the contents of the "dict7.txt" file.

Sean
Posted: 21st Dec 2011 1:08
I beleive it's because AppGameKit readstring from file takes the endofstring character as the null character.
if your strings are on seperate lines separated by either LF or LFCR then this will not be picked up and the whole file (or as much as it can fit in it's buffer) will be printed out.