Character in to Type Filed

BlitzPlus Forums/BlitzPlus Programming/Character in to Type Filed

weebo(Posted 2004) [#1]
Hi maybe someone can help with this problem I'm having.

I have a type:

Type ticker
Field startletter
Field endletter
Field speed
Field x
Field y
End Type

And I have the following loop to create and populate the type:

;Create a ticker for each letter
For count = 0 To 11
For count2= 0 To 3 ;columns
For count3 = 1 To 34 ;416 tickers
letter.ticker = New ticker
letter\endletter = Mid(bayarray(count,count2),count3,1)
letter\x = count3 + 2.5 ;xposition of this ticker is placeholder/Column 0 to 34
letter\y = count + 2 ;yposition of this ticker is placeholder/Row 0 to 11
Next
Next
Next

----------------------------------------------------

The array bayarray(count,count2) contains a table, rows and columns. Each containing a string.

What I want to do is put each individual character from these strings in to the endletter field as the types are created.

I know the coding functions because if I replace the "letter\endletter = Mid(bayarray(count,count2),count3,1)"line and output to a file it outputs each character a line at a time, with 34 characters in total for each field in the table.

However if I output to the letter\endletter I end up with useless data.

Can anyone help me out on this one?

Many thanks!


soja(Posted 2004) [#2]
Try declaring
Field endletter
as
Field endletter$
...either that or change this
 letter\endletter = Mid(bayarray(count,count2),count3,1)
...to this:
 letter\endletter = Asc(Mid(bayarray(count,count2),count3,1))
...and then when you want the letter, use
Chr$(letter\endletter)


It's probably easiest to add the "$" to the declaration.