Tag System - Up The Swanie

Blitz3D Forums/Blitz3D Beginners Area/Tag System - Up The Swanie

Ok I've had a peek and a poke about the routines, and I am a little lost somewhat.

I've tried to implement different sized tags, and check what to increment with the i=i+??? and as you'll see it horribly wrong.

A routine I am trying to pull off, is a text Bitmap Font (or true type font - which evers more versatile) writter, for using as an instructions screen to scroll through, thats why I opted for an image buffer to reproduce the text information with. And the text will be obtained from a Loaded file (Txt Document).

If you know what I've done wrong, or there is a better method then Id really appreciate it and love to know.

Graphics 640,480
SetBuffer BackBuffer()

Type Word
	Field Txt$
	Field Col$
End Type

Global message$
message$=			"[Red]Please [Green]Change [Blue]My [Purple]colors[Return]"  
message$=message$+	"[Normal]And this is default / normal text and this should be [Blue]blue Text"

Global char$,ColCode$,skip=False
Global XPos,YPos
Global Text_Area=CreateImage(640,256)

Draw_To_Screen()

While Not KeyHit(1)
Cls
	DrawImage Text_Area,0,0
Flip
Wend


Function Draw_To_Screen()
SetBuffer ImageBuffer(Text_Area)
this.word=New word
For i = 1 To Len(message$)  
	
	CurrentChar$=Mid$(message$,i,1)

	If CurrentChar$ = "[" Then
		
		If Skip=False
			this.word=New Word
			ColCode$=Mid$(message$,i+1,4)
			this\col$ = Lower(ColCode$)

			If this\col$="Red]" 
				i=i+4
				Skip=True
			End If
		
		End If
	
		
		If Skip=False	
			ColCode$=Mid$(message$,i+1,6)
			this\col$ = Lower(ColCode$)

			If this\col$="Green]" 
				i=i+6
				Skip=True
			End If
		End If
		
		If Skip=False
			ColCode$=Mid$(message$,i+1,5)
			this\col$ = Lower(ColCode$)

			If this\col$="Blue]"
			 	i=i+5
				Skip=True
			End If
	
		End If
		
		If Skip=False
			ColCode$=Mid$(message$,i+1,8)
			this\col$ = Lower(ColCode$)

			If this\col$="Purple]" Or this\col$="Return]" Or this\col$="Normal]" 
				i=i+8
				Skip=True
			End If
		
		End If

	Else
		this\txt$=this\txt$+CurrentChar$
	End If
	
	skip=False

Next


tx=x

For this.word = Each word
	Color 0,0,0
	
	;If shadow=1 Then Text tx,y+2,this\txt$
		
	Select this\col$
		Case "Red]"		:Color 255,000,000
		Case "Blue]"	:Color 080,080,255
		Case "gold]"	:Color 200,200,070
		Case "black]"	:Color 000,000,000
			
		Default:Color 255,255,255
		
	End Select
		
	Text tx,Y,this\txt$
		tx=tx+StringWidth(this\txt$)
	Delete this
		
Next

SetBuffer BackBuffer()
End Function


Cheers and bless you all!
-Mikey F :)