Having trouble printing variables with PP256's CharPrintXY

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
DaveUnit

Having trouble printing variables with PP256's CharPrintXY

Post by DaveUnit »

I'm using PixelPlus 256's CharPrintXY rather than PRINT. The problem I'm having is that it can only print strings. I need to print variables like health, strength, etc. Is there any somewhat easy way to get the variables I want printed to the screen using CharPrintXY? Or am I just screwed and need to find a better PRINT alternative?
Any and all help will be appreciated, Thanks.
DaveUnit. (I should really register, I go to this site at least a few times a day.) :)
User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle »

Just use

Charprintxy STR$(variable), x, y, etc.

Instead. You might need to remove a leading space; I can't remember.
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

Kylemc wrote:Instead. You might need to remove a leading space; I can't remember.
Yes, depending on your program, you might. Replace this with Kylemc's line.
Charprintxy LTRIM$(STR$(variable)), x, y, etc.
-----------------^ That removes the leading space(s).
DaveUnit

Post by DaveUnit »

Thanks guys, I actually found the answer on my own after I posted this topic and felt like a total idiot for asking a question with such a simple solution. However, I had no internet access(I was waiting for an important phone call and i have Dial-Up :( ) to say that I had found the answer already. BUUUT, thanks so much for addressing the leading space problem, that was annoying. It would have taken me awhile to have figured that out on my own.
Thanks again.
DaveUnit.(who still needs to register)
User avatar
Kyle
Veteran
Posts: 107
Joined: Thu Apr 14, 2005 2:41 pm

Post by Kyle »

We aim to please :D
powerhouse
Newbie
Posts: 1
Joined: Mon Jul 25, 2005 12:30 pm

Post by powerhouse »

Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

Nathan1993 wrote:Deleted! Wait, I'm not a mod :oops:
Post Reply