Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub TypeText2 (Text as zString Ptr)
  2.     Dim as Integer X = 1
  3.     For CharNum as Integer = 0 To Len(*Text)-1
  4.         pCon.Lock()
  5.         ' When we come to a space
  6.         If Text[CharNum] = 32 Then
  7.             ' Check if the next word's length is longer
  8.             ' than the remaining screen space
  9.             If X+Instr(CharNum, *Text, Chr(32))-CharNum >= SCREEN_WIDTH-2 Then
  10.                 ' If it is, go to the start of the next line
  11.                 TextRow += 1: X = 1
  12.             Else
  13.                 ' Otherwise just advance the cursor over the space
  14.                 X += 1
  15.             End If
  16.         ' Parse any newlines
  17.         ElseIf Text[CharNum] = Asc(!"\n") Then
  18.             TextRow += 1: X = 1
  19.         ' Ignore \r if we hit it
  20.         ElseIf Text[CharNum] <> Asc(!"\r") Then
  21.             ' Print the next character and advance the cursor
  22.             CharPtr(X, TextRow) = Text[CharNum]
  23.             X += 1
  24.         End If
  25.         pCon.Unlock()
  26.         Sleep 25,1
  27.     Next CharNum
  28. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement