Sign in to follow this  

Parsing some simple markup and displaaying it

This topic is 3112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering what would be the best way to quickly parse a string to pull out formatting data, and then be able to format it quickly later with some sort of error handeling (eg if the format string expects a .name atribute and the object passed doesnt have that attribute). The format of the script does not have to be as describe here, just able to achive the same effect. Eg I have that following string:
Your ship <col=yellow><var>this.name</var></col> was destroyed by <col=yellow><var>killer.name</var></col> in sector <col=yellow></var>this.sector.name</var></col>.



Then when a ship killed I need to pass the info to the renderer (ie the two ship objects involed) so that it can render some text from the above format string on the screen (wrapping to multiple lines correctly if it wont fit within the avaible width). The ship objects have methods like string GetName() and Sector GetSector() (and a GetName for the sector object too) for accessing the info about them. I'm using d3d9 and d3d10 with c++ and am currently using the D3DX Font interfaces for text rendering. Previously I was hardcoding such format stuff but then regretted it when trying to implement the large number of diffrently formatted strings for log entries and mission breifings and stuff like that. [Edited by - Fire Lancer on June 7, 2009 1:45:11 PM]

Share this post


Link to post
Share on other sites
Ok, so that can parse the string (when I work out how...I guess some sort of object model), how am I meant to store the format data, fill out the <var> sections with the argument data and then render it?

Share this post


Link to post
Share on other sites

This topic is 3112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this