Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / I feel stupid but, I need help with a text problem.....

Author
Message
Evad
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 14th Jun 2003 08:26
Hi, I am making a battle demo, 3D graphics and such, I have all the 3D stuff worked out, but I can't seem to figure out the HP and MP text stuff, I can display it on the screen okay, but what is the best way to update it, I have tried using Strings, but with that, the numbers just over lap, I have tried using functions, but I can't seem to figure them out well enough, so what would be the best way of doing this? Any help would be nice, thanks.

--Dave
rapscaLLion
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 14th Jun 2003 08:28
?

A little more detail please? I'm confused as to what the question is... around here the more specific the question the better

Alex Wanuch
aka rapscaLLion
rapscaLLion
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 14th Jun 2003 08:30
hmmm. after re-reading it sounds like your putting text were there is no backdrop. If that's true then of course they overlap. You have to clear the previous spot. Try drawing a box were the text previously was in the same color as the background.

Alex Wanuch
aka rapscaLLion
Evad
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 14th Jun 2003 08:38
is there any other way to clear the screen with out clearing EVERYTHING (CLS)?? I have a texture behind the numbers, and If I put another square of texture there, it will cover the whole thing, making me have to re-print everything, every time, I guess Ic an do this, but if there is an easier way I would like to know about it

--Thanks

Evad
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 14th Jun 2003 08:44
Can't you just do it with strings!? a$ = a$ - 1, but when I do that it says something about in valid, but if you put quotes around it it is exact, so you use a# = a# - 1, but then the text command doesn't work any longer, so you use set cursor and print, but then it over laps.

There is a better explination of my problem.

thanks.

MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 14th Jun 2003 08:57
So, you're wanting to display text over the screen at a certain position every loop, with a texture under it?

Lets say this is your main loop, replacing the remarks with actual code:

do
rem Display graphics
rem Display info bar w/hp and mp
rem Print the HP and MP
loop

and you have previously set a value like MainChar_HP = 200 and MainChar_MP = 10 or something. During your loop, in place of "rem Print the HP and MP" you could say

text xpos,ypos,"HP: "+Str$(MainChar_HP)
text xpos2,ypos2,"MP: "+Str$(MainChar_MP)

...where xpos, ypos, xpos2, and ypos2 are wherever you want the values to be displayed.

This should print the values to the screen every loop, and they will auto-update whenever you change them. For example: if, in a subroutine for damage, the player takes 100 damage, you do your HP=HP-100 thing and such. Then, when it comes back to time to display the HP and MP, the updated HP will be shown automatically.

It is important, if you want this method to work, that you text the values to the screen after you've put any other graphic on there or else it will cover it up.

Hope it helps...
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 14th Jun 2003 09:01
Hmm, I was typing my reply as you replied to your own post again. I believe to use text to print a variable, you must first convert it to a string using Str$(). You could, for example:

hitpoint=200
hitpoint$=Str$(hitpoint)
text 0,0,hitpoint$

Try that and see if it works. It should display the value 200. If you wanted to prefix the value with something like "HP", you could do

hitpoint=200
hitpoint$="HP: "+Str$(hitpoint)
text 0,0,hitpoint$

The above would display
HP: 200

Good luck on your battle demo. They're pretty hard.
Evad
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 14th Jun 2003 09:13
That worked, exactly what I needed, thanks!!!

Evad
23
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 14th Jun 2003 09:14
don't worry, I was working on it while you were typing your last post, I got the first post working so, thanks.

--Dave

indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 14th Jun 2003 09:18
an easy to save yourself grief in some situations where you only want to update a part of the screen is to use the box command to paint the area where the text will be displayed then update the text command.

when this code is called it wipes out any previous graphics with a black box then prints some text over it.

ink rgb(0,0,0),1
box 0,0,100,100

ink rgb(250,250,250),1
text 0,0,mystring$

Login to post a reply

Server time is: 2026-07-17 19:33:35
Your offset time is: 2026-07-17 19:33:35