Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Font.Draw Problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeroPaladn




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jan 18, 2006 11:36 am   Post subject: (No subject)

I don't have Turing on my Mac. By now you should know to specify what the error is Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
ZeroPaladn




PostPosted: Wed Jan 18, 2006 11:51 am   Post subject: (No subject)

Embarassed sorry.

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

there we go.
codemage




PostPosted: Wed Jan 18, 2006 12:07 pm   Post subject: (No 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?
ZeroPaladn




PostPosted: Wed Jan 18, 2006 12:12 pm   Post subject: (No 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
ZeroPaladn




PostPosted: Wed Jan 18, 2006 12:15 pm   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: