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.

Newcomers DBPro Corner / My program, will not display text.

Author
Message
Major Payn
20
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 28th Dec 2004 09:39
I have tried several times to print variouse things to the screen in my game, but nothing happens. Here is the code....



I used quite a bit of media, so you won't be able to run it right now, but you can still look it over, and see if something is wrong.

Guns arn't the problem, people are the problem, shoot all the people and guns arn't a problem anymore.
eek
19
Years of Service
User Offline
Joined: 26th Dec 2004
Location:
Posted: 28th Dec 2004 12:40
Well, I'm a n00b so I'm not sure about anything. What are you trying to print though, and is there any attempts in your code? The code for printing text is print "Text goes here" to my knowledge. All you would have to do is put that code along with whatever you wanted to print in your loop wherever its needed and after something that triggers it if you don't want it there the whole time your program runs.

Sorry if I'm an idiot, but I'm new at this...

insert cool signature here
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 28th Dec 2004 15:13
Is this DBC or DBP?

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 29th Dec 2004 00:29
try this command in your code some where before the 'do' in the do loop part,

set current bitmap 0

hard to check if this will work with your images as we do not assces to them, however this should show something on the screen, like it should show the word paused when p is pressed.

come back again if no joy and someone else may be able to help.

In Space No One can Hear You Scream! (When your comm Line is cut?)
Major Payn
20
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 29th Dec 2004 11:00
Nope, that didn't seem to do anything, text is still not showing up!

Guns arn't the problem, people are the problem, shoot all the people and guns arn't a problem anymore.
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 30th Dec 2004 01:44
my version of db says 'texture backdrop' is obsolete.
anyway try 'color backdrop 0' after 'backdrop on'
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 30th Dec 2004 02:32
you can just do

load image "planetname.bmp",num

rather than keep loading bitmaps and then getting images from them, also you are leaving all those bitmaps loaded, so your code has got a load of unused bitmaps that you don`t remove eating memory (once you got the image you didn`t need the bitmap any more), when you press pause then all you should see is the game paused message and any objects in view unless you have set the ink to black (black ink...black background..not very visible), also you can only use center text in the Pro version of darkbasic, if you have classic then remove the word center, the your text will be a bit off to one side, so add

+(text width("PAUSED")/2)

to the first co-ordinate, that should help, I just tried your code without the media and it worked ok here btw.

Mentor.

PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 30th Dec 2004 03:42
@ mentor: Center Text,X,Y,"text" works in DBC not just DBP

Am I the only one here who's really confused?
http://db1games.topcities.com
(used to be demonsbreath - apparently my name was too long to have no spaces though)
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 30th Dec 2004 05:25 Edited at: 30th Dec 2004 05:26
* edit *

oops read deamons post wrong


The word "Gullible" cannot be found in any English Dictionary.
Major Payn
20
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 30th Dec 2004 09:32
Quote: "
+(text width("PAUSED")/2)

to the first co-ordinate, that should help, I just tried your code without the media and it worked ok here btw."


what coordinates? And could there be any other reason why this isn't working? I mean I canno't print anything, for example, if I add something like this....

set cursor 10,10: print "this is working"

nothing shows up, nothing at all. I really need to be able to print things, as It is a vital part of my game, health, resources..etc are all needed, and must be printed, so this is a big, big problem!

Guns arn't the problem, people are the problem, shoot all the people and guns arn't a problem anymore.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 30th Dec 2004 20:24 Edited at: 30th Dec 2004 20:24
if no better solution can be found, then you might have to resort to Set Camera View [x1],[y1],[x2],[y2]. This will mean that everything outside the box [x1],[y1],[x2],[y2] will be displayed as normal. There is probabably a better way of doing it, but this is all I can think of, and should work in the meantime (so you could draw the box with a big gap at the bottom and a small gap at the right, and have most of the stats on the bottom and some on the right)

Another method is detailed in the 3D monster hunt tutorial (the HUD bit - tut 23 or something) but I can't get that to work so I won't try and explain it.

Am I the only one here who's really confused?
http://db1games.topcities.com
(used to be demonsbreath)
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 30th Dec 2004 21:50 Edited at: 30th Dec 2004 21:56
you print stuff right before the sync, it should be NO problem, does this work?

` code example A
sync on: sync rate 40
backdrop on
do
cls
print "hello"
sync
loop

or this

` code example B
sync on: sync rate 40
backdrop on
for i=1 to 20
make object sphere i,1
position object i,rnd(4),rnd(4),rnd(4)
color object i,rgb(rnd(255),rnd(255),rnd(255))
next i
position camera -2,-2,-2
point camera 2,2,2
do
set cursor 0,0:print "hello"
set cursor 100,100:print "this is text"
sync
loop

or this

` code example C
sync on: sync rate 40
backdrop on
for i=1 to 20
make object sphere i,1
position object i,rnd(4),rnd(4),rnd(4)
color object i,rgb(rnd(255),rnd(255),rnd(255))
next i
position camera -2,-2,-2
point camera 2,2,2
counter = 0
do
inc counter
for i=1 to 20
move object i,0.1
turn object left i,i
next i
set cursor 0,0:print "hello"
set cursor 100,100:print "this is text"
text 200,120,"as is this"
text 50,50,str$(counter)
sync
loop

all these work here, basicaly you draw your text after you have done everything else, then you sync, that shows the current screen with all your text drawn over it, the other thing you should do is to delete the backdrop and place the whole solar system inside a textured sphere, but these examples have the backdrop on and work just fine here, so I don`t think that that is your problem, but it may be worth just remming out the backdrop commands for a while, theres a screenshot attached to this post to show it in action.

Mentor.

ps: this line

center text screen width()/2,screen height()/2,"PAUSED"


becomes

text (screen width()/2)+(text width("PAUSED")/2)
,screen height()/2,"PAUSED"

which has the same effect of centering the text, but I understand classic has the center text command (I thought it didn`t) so theres no need for it.

PC1: P4 3ghz, 1gig mem, 3x160gig hd`s, Radeon 9800pro w cooler (3rd gfx card), 6 way speakers.
PC2: AMD 2ghz, 512mb ram, FX5200 ultra, 16 bit SB.
Mini ATX cases suck.

Attachments

Login to view attachments
Major Payn
20
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 31st Dec 2004 02:06
Hmmm, I don't know what I did exactly, but it seems to work now, or atleast when I add the command

set cursor 10,10: print "text is working YAY!"

that seems to work lol. Well thats one problem down, now on to the next.

Thanks everybody for your help!

Guns arn't the problem, people are the problem, shoot all the people and guns arn't a problem anymore.

Login to post a reply

Server time is: 2024-09-23 08:29:34
Your offset time is: 2024-09-23 08:29:34