Computer Science Canada

Font.Draw Problem

Author:  ZeroPaladn [ Wed Jan 18, 2006 11:31 am ]
Post subject:  Font.Draw Problem

When i got to draw the text, i get an error message.

heres the code, you can try it out.

code:

proc scoreread
    open : fNum, "maps/highscores.txt", get
    for r : 1 .. 10
        get : fNum, highscore (r)
        get : fNum, highscorename (r)
    end for
end scoreread

proc highscoreview
    loop
        exit when scorecheck = false
        scoreread
        cls
        colourback (brightblue)
        Font.Draw ("HIGH SCORES!", 200, maxy - 50, font, black)
        for e : 1 .. 10
            Font.Draw (intstr (e) + ".  " + highscore (e) + "   " + highscorename (e), 100, maxy - 100 - (e * 30), font, black)
        end for
        scorecheck := false
        View.Update
        delay (5000)
    end loop
end highscoreview


thanks alot guys.

Author:  Tony [ Wed Jan 18, 2006 11:36 am ]
Post subject: 

I don't have Turing on my Mac. By now you should know to specify what the error is Wink

Author:  ZeroPaladn [ Wed Jan 18, 2006 11:51 am ]
Post subject: 

Embarassed sorry.

Operands of " + " must be both interger or real, compatible sets, or both.

there we go.

Author:  codemage [ Wed Jan 18, 2006 12:07 pm ]
Post subject: 

Odd.
I can't spot anything at a cursory glance.

Can you try casting your expression into a temporary string variable and then give that variable (instead of the expression) to Font.Draw?

Author:  ZeroPaladn [ Wed Jan 18, 2006 12:12 pm ]
Post subject: 

i get the same error using this code...

code:

var scoretext : array 1 .. 10 of string
for i : 1 .. 10
scoretext (i) := highscore (i) + "   " + highscorename (i)
end for

Author:  ZeroPaladn [ Wed Jan 18, 2006 12:15 pm ]
Post subject: 

sorry for double post, but i figured out the problem!!!

original code
code:

Font.Draw (intstr (e) + ".  " + highscore (e) + "   " + highscorename (e), 100, maxy - 100 - (e * 30), font, black)


highscore is an INTERGER! you cant Font.Draw with those!

revised code
code:

Font.Draw (intstr (e) + ".  " + intstr (highscore (e)) + "   " + highscorename (e), 100, maxy - 100 - (e * 30), font, black)


sorry for both the caps and the double post.


: