This function processes long strings of text and displays as seperate lines.
!This can be tested in a new project(no loading of anything needed.)Just copy and paste!
No screenies becuase I'm not sure how useful this would be to someone, but if it helps I'm using it to show dialogue in my RPG.
Here it is.
//Send large amounts of text to an array and sort them into lines.
Function UpdateDialogue()
//All the variables below can be used as input for a more custom function; Testing for now.
LongString$ = "HELLO from the WORLD of Uhoo!. Please be aware that magic is possible here and so are allot of other things."
totalLines as Integer :LineSpacing =20 : totalLines = 10 : CharLimit = 31 : CurrentLine as Integer :x=Screen Width()/2-CharLimit : y=100
//Make and array
Dim TextBuffer(totalLines) as String
//Fill the array by filering using some rules
`Working through each character in the string will help to break down the dialogue.
For n=1 to Len(LongString$)
//Work from the left and start to work out when the next line should start.
CurrentChar$ = Mid$(LongString$,n)
//Build a solid sentence by storing every single character until a new line is created
GetLine$ = GetLine$ + CurrentChar$
//If the current character is a full stop then this would indicate a new line is to be created.
If CurrentChar$ = "."
//Lets also remove any blank characters before the line is stored
tmp$ = RemoveIntBlnkSpcs(GetLine$)
//Again store the newly processed string in the prev. created variable.
GetLine$ = tmp$
//Store the current string and start a new line
TextBuffer(CurrentLine) = GetLine$
//Move to nect line
Inc CurrentLine,1
//Reset the varable that stores the whle string for each line
GetLine$ = Free String$()
Endif
//Also move on to new line if the string storing the sentence has passed more than the character limit.
If Len(GetLine$) >= CharLimit
//Lets also remove any blank characters before the line is stored
tmp$ = RemoveIntBlnkSpcs(GetLine$)
//Again store the newly processed string in the prev. created variable.
GetLine$ = tmp$
//Store the current string and start a new line
TextBuffer(CurrentLine) = GetLine$
//Move to nect line
Inc CurrentLine,1
//Reset the varable that stores the whle string for each line
GetLine$ = Free String$()
Endif
Next n
//Output the array breakdown
For n=0 to totalLines
//Show only if array position has content. Exit for loop when a blankline is detected.
If TextBuffer(n) <> "" Then Text x,0+y+(n*LineSpacing),TextBuffer(n) Else Exit
Next n
//Un-Make The array
Undim TextBuffer(0)
Endfunction
//Remove all blank spaces from the begining of a senteces/String.
Function RemoveIntBlnkSpcs(String$)
For n=1 to Len(String$)
//From the left
If Mid$(String$,n) = "" or Mid$(String$,n) = " "
//Do nothing because we dont need any blanks at the beggining
Else
//Store when characters are 1st detected. Work from the right and exclude the characters that have already been analysed(n is the total that has been analysed in this case)
ReturnString$ = ReturnString$ + Right$(String$,Len(String$)-(n-1))
Exit
Endif
Next n
Endfunction ReturnString$
Not sure what the efficiency of this is but it works
Sorry about the grammer and spelling mistakes

Tierd

Thank,
Quote: "
fOoD OR fEEdBaCk
"