Tag System - Up The Swanie
Blitz3D Forums/Blitz3D Beginners Area/Tag System - Up The Swanie
| ||
Hiya All! :) As you'll see from the routine below, I am trying to implement a tag system (like html codes to switch what should effect the text) And I have never used the Left$ or Right$ commands before, and as you will also spot that it doesnt work in my favour at all. And thus, I'd really appreciate any help in getting it working as it should do. What it should do is: Read the Message$ text Decipher any tags found in the square brackets Reset to just before the tag Change the colour / effect or what have you And draw the finished outcome. Im using an imagebuffer as I can reposition the whole thing alot easier, then calling to update each time etc. Cheers & Many many thanks, Mikey F :) |
| ||
In the alien breed CP code.zip, in inc\utils.bb there's a function called readitem. Have a read and see it this helps. |
| ||
Here's one I wrote a while back. Uses a similar system, except ^WH or ^BL, etc. I'm sure you could adapt it. Very fast, and doesn't require a graphics buffer, or creating images on the fly. Just uses text commands. :) Example included of course - the guts of it is the "Word" TYPE, which is used to split up the sentence into each color code section (or you could use other codes, for bold, etc - I just parse that in the main function call as you can see), and the function. +BlackD |
| ||
Excellent, I'll look into both! Cheers! |
| ||
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. Cheers and bless you all! -Mikey F :) |
| ||
I usually seperate the functions into 3 sections. Input, lexical analyzer, and parser. The input just sends the next character to the lexical analyzer, the lexical analyzer strings the input into tokens, and the parser actually acts upon the whole thing. I know that seems like a lot for just changing colors, but it'll make it easier when you add functions, as well, as changing input. Like you could change to reading from a file or over a network connection just by changing the GetCharacter routine. |
| ||
Hiya! Is there any way to prevent their being to big a gap between the texts after a tag has been performed? Usual formatting, of each letter follows and sits nicely together? As I'm about to add different sized fonts being specified this Bit's easy its the aligning thats a tad puzzling :_) I am also having difficulties turning this into a Bitmap Font version too. Many Many Thanks for your help. Mikey F |
| ||
Any luck, Im going slightly bald as it's driving me crazy. Hehehe. I'd love very much for this to draw a letter of a bitmap font rather then text. Thanks immensly!! :) |
| ||
then draw a bunch of bitmaps and adapt it. As for the "gap", are you remembering to remove the Stringwidth(tag$) (or whatever its called) from the equation, so it doesn't move on that far? +BlackD |
| ||
The gaps, I've sorted out now. And as for the adapting to Bitmaps, I couldn't sort that out at all. So am sticking with True Type fonts for the time being. |
| ||
Is you code currently as posted above? If so, I'll adapt it to a bitmap system after work (8 hours away.. just walking out the door now). :) |
| ||
Yes it is dude, and thanks kindly for that mate! Cheers and all the best, Mikey F :) |
| ||
Ooops I forgot! LOL I'll do it tomorrow. :) |
| ||
No worries dude! I'm wondering too, if anyone could help with adding in a word limit per line, so that the text automatically formats onto the next (carriage returns). That too would be amazing!! Cheers once again for all your kind and generous help!! Excellent :) |