Computer Science Canada

Placing variables in Font.Draw command

Author:  strike_hawk89 [ Wed Jun 01, 2005 7:36 pm ]
Post subject:  Placing variables in Font.Draw command

hi, i was just wondering if this was possible and how i am able to do it. I wanted it so that it would display the user's name but in a different text. I tried it a couple of times but had no success. i tried:
code:
Font.Draw ("blah, blah, blah, ", username, ".", 200, 200, font7, brightblue)

Author:  jamonathin [ Wed Jun 01, 2005 7:42 pm ]
Post subject: 

Close, only instead of ' , ' use ' + '.

code:
Font.Draw ("blah, blah, blah, "+ username+ ".", 200, 200, font7, brightblue)


That is assuming username is a string, if its an int juss use intstr (usernumber)

Author:  strike_hawk89 [ Wed Jun 01, 2005 8:04 pm ]
Post subject: 

thx alot man, really needed that.... Very Happy Very Happy Very Happy

no wait that didnt work, error message
Operands of 'prefix +' must be integer or real[/quote]

Author:  jamonathin [ Wed Jun 01, 2005 8:24 pm ]
Post subject: 

You sure? Chek your typing, because this seems to work fine.
code:
var font : int := Font.New ("Arial:20")
var username : string := "jamonathin"
Font.Draw ("Username: " + username + ".", 20, 100, font, black)

Author:  strike_hawk89 [ Wed Jun 01, 2005 9:00 pm ]
Post subject: 

ya, it looks like i typed something wrong. sry bout that. Embarassed works fine now. Thanks again. Very Happy


: