Writing some demo code that does a teletype effect i.e) Text that prints to the screen one letter at a time, which could be useful for a little information text box. I tried searching the forums for something I could already use, but had no joy, and instead found something in the original db documentation! Thats gotta be a first no?
Anyway- the code either runs too fast or there is some other runtime error, as it is not displaying very well, i\'ve remarked the place I\'ve tried hammering some timer stuff into(to delay it) but it still just displays then disappears immediately.. I dont know whether it is just scrolling up on the y axis too fast or whatever.
Anyway, of to bed now, someone give us a hand. I\'m sure this will make a useful addition to the codebase if we get it working, I\'ll even turn it into a function when the bugs are squished.
Cheers in advance.
rem Set default screen
color backdrop rgb(0,32,32)
set text font \"Verdana\"
ink rgb(0,255,0),0
set text to bold
set text size 20
sync on : sync rate 0
if check display mode(1024,768,32)=1 then set display mode 1024,768,32
rem Text data
dim htext$(5)
teletypeBaseX = (screen width() / 2)
begin=1
//experimenting
make object plain 1,320,240
rem Begin narration
do
//gosub debugConsole
if begin=1 `doOnce
begin=0
for h=1 to 5 : htext$(h)=\"\" : next h`makes an array to hold the text
text$=\"\"
restore _Introduction
time=timer()`do not alter
endif
gosub Teletype
sync
loop
debugConsole:
return
Teletype:
//leaper code. 1 reads whether to include the next data line like a \'/n\' (new line)
//if (timer() - time => 2000)
read leaper
read nar$
nari=1
//endif
for r=1 to leaper `scrolls up the neccessary amount if data entry is 1.
if nari<=len(nar$)
a$=mid$(nar$,nari)
text$=text$+upper$(a$)
inc nari
endif
next r
//scroller code
if nari>len(nar$)`if more than one letter do the scroll.
for h=5 to 2 step -1 `run through a text array size \'5\'
htext$(h)=htext$(h-1)
next h
htext$(1)=text$
text$=\"\"`reset value
endif
//this part sends the text up the y axis. lets send it on the x axis instead, ideally we need to delete it
for h=1 to 5
center text teletypeBaseX, 32-(h*16),htext$(h)
next h
center text teletypeBaseX, 32,text$
return
rem Narration:
_Introduction:
rem Introduction Data;
data 1,\"Welcome to \"\"XXX GAME\"\" by XXX \"
data 1,\"This text is a new line \"
data 1,\"This text the next line. \"