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 / Why does some Text not show when Backdrop On is active?

Author
Message
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 23rd May 2005 05:49 Edited at: 23rd May 2005 07:32
Greetings:

Have a small annoying problem- Backdrop On

This command is not allowing TEXT,INPUT or PRINT to work even with Sync.
Am i not doing a procedure right?
I am including a sniplet sample of what I am trying to do

hide mouse

sync on : sync rate 0 : color backdrop rgb(0,128,0)
set text font "arial" : set text size 16
set text to bold : set text opaque

print "LOADING ... Please Wait":sync
backdrop off
color backdrop backcolor
cls

dim elf(22)
dim hero(22)
dim wiz(22)
dim super(22)
dim Lighting(22)
dim fire(22)
do
sync
text 0,0,line1$
text 0,30,line2$
text 0,60,line3$
text 0,90,line4$
text 0,120,line5$
text 0,150,line6$
sync
set cursor 0,200
line1$=" "
line2$=" "
line3$=" "
line4$=" "
line5$=" "
line6$=" "
input "e,h,s,w",char$
cls
s=rnd(21)+1
flag=1
for i=1 to 22
k=rnd(11)+1
elf(i)=k
k=rnd(11)+1
hero(i)=k
k=rnd(11)+1
super(i)=k
k=rnd(11)+1
wiz(i)=k
k=rnd(11)+1
lighting(i)=k
k=rnd(11)+1
fire(i)=k
next i
choice$=""
gosub battle

if choice$="T" or choice$="t" then goto nofight
line6$="Monster Hit Points="+str$(TotalHP)
gosub attack
nofight:


loop



`==============================
` player rolls dice to attack
`==============================
battle:
if flag=0 then return
IF MOUSECLICK()=1 then return
dice1=rnd(10)+2
line1$="Player roll Dice of "+str$(dice1)
` determine the character; if wizard, will he use fire or lighting or fight.
if char$="e" or char$="E"
TotalHP=elf(s)
else
if char$="h" or char$="H"
TotalHP=hero(s)
else
if char$="s" or char$="S"
TotalHP=super(s)
else
if choice$="B" or choice$="b"
TotalHP=wiz(s)
endif
if choice$="L" or choice$="l"
TotalHP=Lighting(s)
else
TotalHP=fire(s)
endif:endif
endif:endif
return

attack:
if dice1 >= TotalHP
line3$="You have attacked the monster and defeated him!"
return
else
if dice1 < TotalHP
line3$="You have attacked the monster and failed!"
gosub monster_attack
endif
endif
return

monster_attack:
dice=rnd(10)+2
line4$="Monster roll Dice of "+str$(dice)
if dice=2
line5$= "Adventurer Killed! Drop ALL Treasures. Return to START"
else
if dice = 3
line5$= "Wounded! Drop ALL Treasures. Return to ladder on this Level"
else
if dice = 4
line5$= "Retreat to somehere! Drop one Treasure"
else
if dice = 5
line5$= "Retreat to somehere! Drop one Treasure"
else
if dice=6
line5$= "Retreat and Drop one Treasure"
else
if dice=7
line5$= "Monster attacks and misses. No Effect"
else
if dice = 8
line5$= "Retreat to somehere! Drop one Treasure"
else
if dice = 9 or dice = 10
line5$= "Retreat and Drop one Treasure"
else
if dice=11
line5$= "Monster attacks and misses. No Effect"
else
if dice = 12
line5$= "Wounded! Drop ALL Treasures. Return to ladder on this Level"
else
endif:endif:endif:endif:endif
endif:endif:endif:endif:endif
return

Old Programmer's are not ugly; they are just Visually BASIC.
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 23rd May 2005 21:21
Sorry, PC "hiccuped". I was saying I had Direct 9Xc installed so I am up to date on my drivers and software. I would very much appreciate any help you can give me. This is the 'first' graphics program I have attempted, something I have wanted to do since I've owned an Apple IIc (yes that long ago). Thanks!!!

Old Programmer's are not ugly; they are just Visually BASIC.
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 23rd May 2005 21:31
Must be Monday, My third post showed up before my second post.
On the above sniplet, set Backdrop ON. My problem is that on my program only CERTAIN TEXT comamnds work and others don't. It may be just my PC but if I leave BACKDROP OFF the text works but the graphics are screwed up. There are no graphics on this snip but the backdrop ON is a real pain. I tried TEXT and PRINT but I still am not getting my text on screen all the way. In some cases, the text appears for just a second then vanishes under the graphics.
What am I doing wrong? I know its probably a simple matter, but its got this newbie dumbfounded. Thanks

Old Programmer's are not ugly; they are just Visually BASIC.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd May 2005 22:18
The backdrop is used to clear the screen every so often. In your case, this is every time you issue the sync command.

You have this code in your main loop:


All of that text will simply not appear to have been drawn.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 23rd May 2005 22:31
Well I'll be....

I knew it was something simple. I guess I don't understand the principles of "SYNC" since I am mostly out of sync myself LOL.

Thank you IanM and I will adapt it to this and future programs.

Old Programmer's are not ugly; they are just Visually BASIC.
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 24th May 2005 03:05
The Sync command will tell the computer to refresh the screen, for example if you were to move a cube up 1 then down 1 THEN sync, the cube would never seem to move.
In my code I always just use one sync command at the end of my Do Loop, I dont often find a reason to use it more than just this once.

James

My first sexual experiance was in my girlfriends house, then she came down stairs and ruined it...
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 24th May 2005 03:22
Thanks James

Here is a little sniplet of the real program I am having problems with:


randomize timer()
`=============================================================================
backdrop on
color backdrop backcolor
cls
do
if ladder=1:gosub level:ladder=0 :endif
if spacekey()=1
showmap("media/dungeon"+str$(level)+".map",mapsize)
else
endif
set text size 16
text 550,0,text$
text 550,500,dce$
text 550,550,die3$
text 0,0,line1$
text 0,30,line2$
text 0,60,line3$
text 0,90,line4$
text 0,120,line5$
text 0,150,line6$
`text 800,825,"Gold=$"+ str$(mytreasure)
`text 800,900,"Hit points remaining="+ str$(Hit)
text 800,925,"Monster HP remaining="+ str$(TotalHP)
text 800,950,"Lives remaining="+ str$(lives)
line1$=" "
line2$=" "
line3$=" "
line4$=" "
line5$=" "
line6$=" "
for xr=1 to knt
text 800,0+25*xr,lastwin$(xr)
next xr
gosub battle
...
loop

If I do not add those extra syncs, the text does not even attempt to show. I did place only on sync as you suggested at the bottom of the DO Loop, but it only gave me a graphics screen minus Text

I got the above example (post #1) to work, but just not in the real program....yet.

Thanks for all your help and suggestions

Old Programmer's are not ugly; they are just Visually BASIC.
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 24th May 2005 03:24
PS: Line1$ thru Line6$ are messages called from Subroutine Battle.

Not to confuse you with the 'blank' ones. They are there so when the next set of messages come up they don't write on top of the others.

Old Programmer's are not ugly; they are just Visually BASIC.
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 24th May 2005 06:43
Hello Again:

Just to let you know I resolved my problem. It is in the placing of the BACKDROP ON and adding a BACKDROP OFF. Basically (pun intended) all I did was turn off the Backdrop, print the text, turn on the backdrop, program some, then sync. Using Post#1 example I also removed the " " Blanks.

hide mouse

sync on : sync rate 0 :sync

set text font "arial" : set text size 16
set text to bold : set text transparent

backdrop off
color backdrop backcolor

dim elf(22)
dim hero(22)
dim wiz(22)
dim super(22)
dim Lighting(22)
dim fire(22)

do
sync
backdrop off
text 10,0,line1$
text 10,30,line2$
text 10,60,line3$
text 10,90,line4$
text 10,120,line5$
text 10,150,line6$
`line1$=" "
`line2$=" "
`line3$=" "
`line4$=" "
`line5$=" "
`line6$=" "
set cursor 10,180
input "e,h,s,w ",char$
backdrop on : color backdrop rgb(0,0,0)
s=rnd(21)+1
flag=1
for i=1 to 22
k=rnd(11)+1
elf(i)=k
k=rnd(11)+1
hero(i)=k
k=rnd(11)+1
super(i)=k
k=rnd(11)+1
wiz(i)=k
k=rnd(11)+1
lighting(i)=k
k=rnd(11)+1
fire(i)=k
next i
choice$=""
gosub battle


As you see I just shut off before I wrote the text and turned back on after. Why this works on my machine I can't guess. The method also works on the main program very well.

If you have any more comments or suggestions, let me know.
Thanks again for putting me in the right direction (getting senile you know). LOL

Old Programmer's are not ugly; they are just Visually BASIC.
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 25th May 2005 00:00
Hello Again:

Spoke to soon! The TEXT Works well, but once I added a INPUT Statement, the TEXT disappears again until I hit a letter. IS this a bug in DBPro? IS there an INKEY$ like command I can use instead?
It is strange that the demo program I listed on Post #1 and #9 works with an Input statement but on my main program it does not.

print " ":Input "PICK YOUR CHARACTER (E)lf, (H)ero, (S)uperHero, (W)izard: ",char$
print "LOADING ... Please Wait" :sync
...
...
...
backdrop off

` Start Main Loop

do
if ladder=1:gosub level:ladder=0 :endif
if spacekey()=1
set cursor 0,0
set text to normal
set text size 10
showmap("media/dungeon"+str$(level)+".map",mapsize)
else
endif
if flag=1
gosub battle
if char$="w" or char$="W"
Input "Use (L)ighting,(F)ireball,(T)eleport,or (B)attle?: ",choice$

Rem Had to double my Text Statement here just show it will show
rem as long as "W" is not selected as Character.

set text to bold
set text size 32
text 550,0,text$
text 550,500,dce$
text 550,550,die3$
text 10,0,line1$
text 10,30,line2$
text 10,60,line3$
text 10,90,line4$
text 10,120,line5$
text 10,150,line6$
text 10,180,line7$

if choice$="t" or choice$="T"
Line7$="ZAP! You have Teleported!"
goto nofight
else
line6$="Monster Hit Points="+str$(TotalHP)
gosub attack
nofight:
endif:endif:endif

set text to bold
set text size 32
text 550,0,text$
text 550,500,dce$
text 550,550,die3$
text 10,0,line1$
text 10,30,line2$
text 10,60,line3$
text 10,90,line4$
text 10,120,line5$
text 10,150,line6$
text 10,180,line7$

text 800,825,"Gold=$"+ str$(mytreasure)
text 800,855,"Lives remaining="+ str$(lives)
for xr=1 to knt
text 800,0+25*xr,lastwin$(xr)
next xr


backdrop on: color backdrop rgb(0,0,0)
color backdrop backcolor
...
...
Sync
Loop



The INPUT Statement never shows unless I turn the "message" into a TEXT ###,###,"Message" and leave off the input statement. The TEXT Commands are repeated twice to force the text to show. There are no CLS commands and the SYNC is just before the LOOP statement. THe Program is far from completed. I have to add functions to the choices of the INPUT Statement, But right now I am trying to get the visual text part of the program to run. The Graphics runs great, but just having a pain getting the text onto the graphics.

Can someone look at this and see if you notice anything wrong with it? I worked on it for hours last night and I can not get the combination right. It's possible there are commands I am not familiar with that I need to use. Thanks Again from a Old Newbie.

Old Programmer's are not ugly; they are just Visually BASIC.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th May 2005 21:29
The INPUT command is useless beyond basic text adventures. Don't use it.

Instead, I suggest that you use something like the code I have in codebase : http://www.thegamecreators.com/?m=codebase_view_code&i=4c2ab9b620f37a56011f61e34c261fcc

This uses the ENTRY$() function and the CLEAR ENTRY BUFFER command to accept input. The bit you want in your code is from the line 'global CurrentInput$ as string' downwards.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 25th May 2005 21:44
Thank you IanM

This is what I am looking for. It will take me a moment to decipher but Entry$() and/or Inkey$() is what I need. MY program is coming along well and I have my nephew helping me Beta-test it. DarkBasic Pro is a far cry from what I use to write on the Apple systems and a major difference from the Fortran and COBOL code I wrote on Honeywell Bull systems. I never had to write graphics back then but databases and Text. This is a fun experience for me in graphics programming. Thank you again IanM.

Old Programmer's are not ugly; they are just Visually BASIC.
master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 31st May 2005 15:29
Okay, no matter how much you use the "sync" command or how you use it, the "input" command will ALWAYS be bad when we go to an 3D object or backdrop on. The text and print commands can be scooted around. Use this snip.


Of course, the "input" still works, it's just hard to see it because the refresh rate makes it disappear, but if flashes for a split second while you enter something durint the "input" part of your program. If you need more help, e-mail me.



______________________________________
<<<<I can program using anything>>>>
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 31st May 2005 21:12
Well I sat down during the Holiday and re-wrote the program with help from my nephew and it is working fairly well. We resolved the text problem with some well placed DO-Loop commands (Thanks guys for the heads up). SO now the program works but I am not happy with the graphics. When I see the hi-res graphic possibilities that DBP can do and what I see from examples from the DBP websites, my program almost seems like Doom #1 or Reader Rabbit. But like I said before, I am enjoying learning the language. I guess you use tools that right now I can not afford. Anyhow thank you for all the help you have benn giving me and I hope to be able to share this program soon with the community - code and all.

Old Programmer's are not ugly; they are just Visually BASIC.
Perokreco
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Bosnia and Herzegovina
Posted: 1st Jun 2005 02:58
Also could you use code brackets for code.
OLDTom
20
Years of Service
User Offline
Joined: 28th Jul 2004
Location:
Posted: 1st Jun 2005 03:09
Ok

Old Programmer's are not ugly; they are just Visually BASIC.

Login to post a reply

Server time is: 2024-09-23 21:28:59
Your offset time is: 2024-09-23 21:28:59