
-----------------------------------
endusto
Sat Mar 05, 2005 1:47 pm

Scrolling Text
-----------------------------------
var font0 : int := Font.New ("Courier New:40:bold")
var message : string := "Andrew is cool"
var messageLength : int :=length ( message ) + 1
var messagePos : int := 0
loop
if (messagePos <  messageLength) then
        Font.Draw (message (1 .. messagePos), 0, 25, font0, blue)
messagePos += 1
delay(100)
end if
end loop


-----------------------------------
[Gandalf]
Sat Mar 05, 2005 2:45 pm


-----------------------------------
Very nice.

But you could do it the easy way too - one letter at a time with a delay.  :)

-----------------------------------
person
Sat Mar 05, 2005 4:58 pm


-----------------------------------
i simplified it a little


var font0 : int := Font.New ("Courier New:40:bold")
var message : string := "person is cool"
var messagePos : int
for x : 1 .. length (message)
    messagePos := x
    Font.Draw (message (messagePos), -30 + x * 30, 25, font0, blue)
    delay (100)
end for


ur code was 11 lines...mine is 8 lines without the if statement

-----------------------------------
Bacchus
Sat Mar 05, 2005 7:34 pm


-----------------------------------
even smaller, and could prbably be rediced moreso
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), 0+Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for

-----------------------------------
endusto
Sun Mar 06, 2005 2:20 pm


-----------------------------------
even smaller, and could prbably be rediced moreso
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), 0+Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for

i made it 2 characters shorted by taking out the 0+ in 0+Font.Width

var font : int := Font.New ("Courier New:15:bold") 
var message : string := "to keep with the trend: Bacchus is cool" 
for x : 1 .. length (message) 
    Font.Draw (message (x), Font.Width(message(1..x-1),font), 25, font, blue) 
    delay (100) 
end for



edit: i also made a horizontal scrolling text :P
setscreen ("offscreenonly")
View.Set ("graphics:800;600")
var font0 : int := Font.New ("Courier New:40:bold") 
var x, y : int
x := 0
y := maxy - 40
loop
if x = maxx then
x:= 0
end if
end loop


-----------------------------------
Bacchus
Sun Mar 06, 2005 6:42 pm


-----------------------------------
hm.. i dont kno y i had that zero in there, maybe starting point for text so u could start it in middle of screen etc

-----------------------------------
ssr
Mon Mar 07, 2005 7:01 pm


-----------------------------------
even smaller, and could prbably be rediced moreso
var font : int := Font.New ("Courier New:15:bold")
var message : string := "to keep with the trend: Bacchus is cool"
for x : 1 .. length (message)
    Font.Draw (message (x), 0+Font.Width(message(1..x-1),font), 25, font, blue)
    delay (100)
end for

i made it 2 characters shorted by taking out the 0+ in 0+Font.Width

var font : int := Font.New ("Courier New:15:bold") 
var message : string := "to keep with the trend: Bacchus is cool" 
for x : 1 .. length (message) 
    Font.Draw (message (x), Font.Width(message(1..x-1),font), 25, font, blue) 
    delay (100) 
end for



edit: i also made a horizontal scrolling text :P
setscreen ("offscreenonly")
View.Set ("graphics:800;600")
var font0 : int := Font.New ("Courier New:40:bold") 
var x, y : int
x := 0
y := maxy - 40
loop
if x = maxx then
x:= 0
end if
end loop



setscreen ("offscreenonly")
View.Set ("graphics:800;600")
var font0 : int := Font.New ("Courier New:40:bold")
loop
    for x : - 400 .. maxx + 400
        cls
        Font.Draw ("I don't either", x, maxy - 40, font0, brightblue)
        View.Update
        delay (5)
    end for
end loop

A little different one :D

-----------------------------------
mike200015
Tue Mar 08, 2005 8:54 pm


-----------------------------------
wow that last ones really nice, not 2 diffucult but looks really good :)

-----------------------------------
Naveg
Sun Mar 27, 2005 8:45 pm


-----------------------------------
theyre all pretty cool, i especially like the last one

-----------------------------------
dann_west
Mon May 02, 2005 2:15 pm

Re: Scrolling Text
-----------------------------------
Great!
if its ok i may use that idea in one of my programs!

-----------------------------------
strike_hawk89
Mon May 09, 2005 9:33 am


-----------------------------------
how would u make the horizontal scrolling text to go to the next line?

-----------------------------------
Dylan-182
Thu May 12, 2005 2:08 am


-----------------------------------
hey sweet scrolling txt is actually what i was looking for just now lol

-----------------------------------
MysticVegeta
Sat May 14, 2005 5:03 pm


-----------------------------------
eh what the hell? I cant believe i wasted my time doing this ->
setscreen ("offscreenonly,nobuttonbar,position:truemiddle,centre,graphics:max;max")
var arial : int := Font.New ("arial:50:bold,italic")
var clr : int := 218
colorback (7)
cls
for s : 0 .. 19
    RGB.SetColor (clr, 0, s / 19, 0)
    Font.Draw ("Mystic pWns j0Oz @$$", (maxx div 2) - (maxx div 3), ((maxy - (maxy div 2.1)) - (s + 2)), arial, clr)
    View.Update
    delay (25)
end for


-----------------------------------
Lapsus Antepedis
Tue May 17, 2005 7:21 am


-----------------------------------
Add a randomized delay (within reasonable limits) and it looks like someone typing at you... 
(how pointless is that?)

var font : int := Font.New ("Courier New:15:bold") 
var message : string := "It looks like my typing when you randomize the delay" 
for x : 1 .. length (message) 
    Font.Draw (message (x), Font.Width(message(1..x-1),font), 25, font, blue) 
    delay (Rand.Int(10,200)) 
end for 


-----------------------------------
gohan
Tue May 17, 2005 10:19 am


-----------------------------------
hey MysticVegeta..yours was pretty cool man

-----------------------------------
strike_hawk89
Sat May 21, 2005 1:56 pm


-----------------------------------
how would u make the text go to the next line? If any of you have noticed, when the text goes past the window border the program doesnt stop.

-----------------------------------
Delos
Sat May 21, 2005 3:14 pm


-----------------------------------
You'd need to do some length calculations.  Since Font.() commands render the text as a picture, you can have it return the length of a particular string in a particular font setup.  Use Font.Width() to find the length of the string you're using.
Then, limit the allowed width per 'line' to the length of the screen.  Figure out which letter that would be.
Cut the string up into sections and recall the 'scroll' routine on the new text.

-----------------------------------
RaPsCaLLioN
Sat May 21, 2005 7:46 pm


-----------------------------------
var iWindow : int := Window.Open ("offscreenonly, graphics:640;200, noecho, nocursor")
var iFont := Font.New ("Courier New:40:bold")
var message : string := "WHOOOAAAAA!!!"
var rArb, rTime, j : real
loop
    rTime := Time.Elapsed / 10
    for i : 1 .. length (message)
        Font.Draw (message (i), Font.Width (message (1 .. i - 1), iFont), round (sin (Math.Distance (0, i * 2 - rTime, 128.0, 128.0) / 4.0)) * 5 + 85, iFont, blue)
    end for
    Window.Update (iWindow)
    cls
end loop

and...

var iWindow : int := Window.Open ("offscreenonly, graphics:640;200, noecho, nocursor")
var iFont := Font.New ("Courier New:50:bold")
var message : string := "WHOOOAAAAA!!!"
var rArb, rTime, j : real
loop
    rTime := Time.Elapsed / 10
    for i : 1 .. length (message)
        Font.Draw (message (i), Font.Width (message (1 .. i - 1), iFont), round (sin (Math.Distance (0, i * 2 - rTime, 128.0, 128.0) / 4.0)) * 5 + 85, iFont, black)
        Font.Draw (message (i), Font.Width (message (1 .. i - 1), iFont) - 2, round (sin (Math.Distance (0, i * 2 - rTime, 128.0, 128.0) / 4.0)) * 5 + 87, iFont, white)
    end for
    Window.Update (iWindow)
    cls
end loop
