Simulate Typing

Blitz3D Forums/Blitz3D Programming/Simulate Typing

Oiduts Studios(Posted 2008) [#1]
Is there different and easier way to do this?

Text 0,0,"A"
Delay 100
Text 10,0,"r
Delay 100
Text 20,0,"e"
Delay 100
Text 40,0,"Y"
Delay 100
Text 50,0,"o"
Delay 100
Text 60,0,"u"
Delay 100
Text 80,0,"S"
Delay 100
Text 90,0,"u"
Delay 100
Text 100,0,"r"
Delay 100
Text 110,0,"e"
Delay 100
Text 120,0,"?"
Delay 100
Text 60,20,"Y"
Delay 100
Text 70,20,"/"
Delay 100
Text 80,20,"N"


Stevie G(Posted 2008) [#2]
There are better methods but quickly ..

PrintText("Are You Sure?" , 0 , 0 )
PrintText("Y/N", 60,20 )

Function PrintText( t$ , x , y )

	For l = 1 To Len( t$ )
		Char$ = Mid$( t$, l, 1 )
		Text x + (l-1) * 10 , y , Char$
		Delay 100
	Next

End Function



Ross C(Posted 2008) [#3]
Or, similar to Stevie's method, use a data statement, keep track of what characters your on and display (after clearing the screen every frame of course) use mid(stringname$, 0, current character).


Oiduts Studios(Posted 2008) [#4]
Perfect, thanks alot!


andy_mc(Posted 2008) [#5]
I use a random delay, makes it look more realistic so use: delay rand(80,120) instead.


Knight #51(Posted 2008) [#6]
May I get a better description of the funtion "Mid"?


Mortiis(Posted 2008) [#7]
Let's say you have a string "GIZMO" and you want to print only IZM characters, you write this code.

name$="GIZMO" 
Print Mid$(name$,2,3) ;String, Which character to start, how many characters



Knight #51(Posted 2008) [#8]
Cool. Thanks, Mortiis :)