writting a simple text program

Blitz3D Forums/Blitz3D Beginners Area/writting a simple text program

Hi um I am curious about something

I'm trying out the text command but is there a way to.

1. The text shows up on the screen.

2. It clears screen.

and 3. shows the rest of the text after clear screen.

Text 50,90,"Anyway what do you think know"



Text 50,100,"About my Blitz3D program Skills "


Text 50,110,"Huh! This Text is nothing compared."


Text 50,120,"To the true power of Blitz3D."


Text 50,150,"To Exit Hit Esc key on your keyboard."

While Not KeyHit(1)

Wend

also is there a way to move the text slowly up or down
and one line of the sentence dissappears.

Like Credits from a movie

Don't quite know what you're on about, but, the EDIT button is your friend.

graphics 800,600,16,2
dim Mytext$(5)
Mytext$(0)="Anyway what do you think know"
Mytext$(1)="About my Blitz3D program Skills " 
Mytext$(2)="Huh! This Text is nothing compared." 
Mytext$(3)="To the true power of Blitz3D." 
Mytext$(4)="To Exit Hit Esc key on your keyboard." 
Mytext$(5)="...."
i=0
time=millisecs()+1000
repeat
if millisecs()>time and i<5 then 
time=millisecs()+1000
i=i+1
endif 
cls
text 50,100,mytext$(i)
flip
until i>=4 and keydown(1)>0
end


or if you want it scrolling:
graphics 800,600,16,2
dim Mytext$(5)
Mytext$(0)="Anyway what do you think know"
Mytext$(1)="About my Blitz3D program Skills " 
Mytext$(2)="Huh! This Text is nothing compared." 
Mytext$(3)="To the true power of Blitz3D." 
Mytext$(4)="To Exit Hit Esc key on your keyboard." 
Mytext$(5)="...."
y=600
repeat
cls
if millisecs()>time then y=y-1:time=millisecs()+50
for i=0 to 5
text 100,y+15*i,Mytext$(i)
next
flip
until keydown(1)>0
end



Thank you soo much Matty

for showing me how to make it scroll now um how
do you adjust the text to the left , right or middle of the screen

:)

this line...
text 100,y+15*i,Mytext$(i)

is using an x-ordinate of 100 each time. Instead you could use Len$(MyText$(i)) to figure out how many characters are in the phrase and then adjust the x value accordingly.

Give it a try, ask for help if you can't get it.

P.S. This might not be the most efficient way of doing this - Text has two optional parameters that decide whether the output is centred...
Text x,y,string$,[center x],[center y]
usage... Text 400,0,"Hello There!",True,False


text 100,y+15*i,Mytext$(i) worked. But the other one didn't

expecting expression or something

Thanks Black Jumoer :)

seferey, there is an Edit button at the top right of every one of your posts. You're welcome to use it...

The Len$() command will actually return the number of characters in the string... An even better measure is the StringWidth() function that gives you the answer in pixels.

Here is a modified version of MAtty's code. Note that the line that is commented out is the more efficient version of the two lines above. You could comment out (A) and (B) and uncomment (C) with no discernable difference. Hopefully lines A + B give you some insight into what is happening though !!

Graphics 800,600,16,2
Dim Mytext$(5)
Mytext$(0)="Anyway what do you think know"
Mytext$(1)="About my Blitz3D program Skills " 
Mytext$(2)="Huh! This Text is nothing compared." 
Mytext$(3)="To the true power of Blitz3D." 
Mytext$(4)="To Exit Hit Esc key on your keyboard." 
Mytext$(5)="...."
y=600
Repeat
Cls
If MilliSecs()>time Then y=y-1:time=MilliSecs()+50
For i=0 To 5
Adjustment = 400 - StringWidth(Mytext$(i))/2    ; (A) this calculates the 'width' needed to centre text
Text Adjustment,y+15*i,Mytext$(i)               ; (B) this prints text to the calculated position

;Text 400,y+15*i,Mytext$(i), True, False        ; (C) this line is equivalent to the two lines above

Next
Flip
Until KeyDown(1)>0
End