Text colour and Hyperlink for PDA(Solved)

Started by Maverick, Sat 02/12/2006 10:06:48

Previous topic - Next topic

Maverick

Hi
I created a GUI in my game that represents a PDA. As part of the functionality I want the player to be able to research certain topics that would become available as the game progresses. I'm using a text box on the GUI to display the information in string format, which is updated if and when an objective is met, and it also includes the ability to view previous entries (this part works fine). The problem I have is that I want to be able to display certain words in the text in a different colour and then also enable the player to click on the text to “jump” to a different entry on the PDA that would supply more information. If anyone has played Gabriel Knight III (Blood of the sacred blood of the damned) and can recall the “SYDNEY” computer used by Grace, which is exactly what I'm looking for. and if you are not familiar with the game then a better comparison is the way the threads in the forum works.

Example:

John and Joe played Tic-Tac-Toe

If you click on the highlighted word you jump to another page

Tic-Tac-Toe
A game invented by Fred Finklestein in 1215 AD. The game consist of a grid made up of 3 x3 squares ……Back

When you click on Back it jumps back to the previous text above

I searched all the threads and although the topic has come up before nobody came up with a solution that can help me in any way and I have no idea where to even start with this.

Can anyone throw me a bone here please.

Thanks


SSH

A very good question. Now if you only had a few of these to do, a quick-and-nasty way would be to have one gui with  the normal text,  then any words in red duplicated as button text on another gui with a transparent background on top... but if you've got lots that would take ages to do and be a real pain.

The other, more general,  solution that springs to mind would be to write your own text rendering thing that did invisible rawdraws while the screen was saved, then restore the screen and put the captured dynamic sprite on the gui, all the while keeping a srtuct with the positions of every hyperlink (x,y top, x,y bottom) then use the mouse-co-ords to check if a click is inside any hyperlink, etc.... a lot of work!
12

Maverick

#2
SSH

Thanks for the response.

The PDA is used often in the game so the first option will become very untidy.

As for the second suggestion I think it is possibly beyond my coding skills but for and expert module writer like yourself it may seem easy(hint hint). Based on the response so far it seems that either very few people are interested in such a feature or not too many people know how to go about doing this. Maybe this would make a good topic for the next coding competition.

Ashen worked on something like this before but he is digging through a stack of backups to try and help me out. If I'm not mistaken he mentioned that he used capitalization for the words that must stand out and I suppose he then tracked the mouse click coords. Even though it is not exactly what I want it may give me just enough to get started,

As for the text rendering "thing", I have no idee how to do it but if you can give me some info as to how to go about it I'll give it a shot.

Thanks

GarageGothic

#3
I have coded a system like this, which emulates basic html functionality (also inspired by SYDNEY). It's quite similar to what SSH describes, except it uses pure RawDraw instead of GUIs. It was rather complicated and I wouldn't recommend it to a beginner, even though most of the big problems were related to line-breaking, scrolling/non-scrolling frames and images inserted into the text - things you don't mention needing.

My system uses separate commands for text elements such as:
AddText(String htmltext) //formatting of main text is set in a style-sheet  beforehand
AddHeadline(String text, int color, int font, PicAlign alignment)
AddLink(String linktext, int linktopage, LinkStyle param, String description, int offset) //offset is used to link to specific sections of the text

This is mainly because of the 500 char line length limit when writing text directly in the script editor (and also when I started coding it, AGS still used 200 char limit strings). I do see some benefits in using formatting codes within the String itself, but since the script editor limits prevents me from cut-n-pasting large amounts of text from elsewhere, it doesn't seem worth the effort to me.

SSH

Basic HTML... Frames?  :o

I've been thinking about this some more, and to speed up the processing, I was thinking of some system like having your text marked up, but characters at the front of a word give special markup, e.g.

=John =and =Joe[John /and Joe played _Tic-Tac-Toe

Rendering as something like:

John and Joe
John and Joe played Tic-Tac-Toe

The advantage being speed of processing. When I wrote an XML parser for the walkcycle generator, it was very slow...

12

GarageGothic

Quote from: SSH on Tue 05/12/2006 16:03:44Basic HTML... Frames?  :o

Heh :) Frames only in the meaning of scrolling/non-scrolling parts of the webpage, sometimes common for all pages on the same site, sometimes unique. Not as in horrible things that keep opening pages within tiny little parts of the screen. In general I haven't bother implement functionality which I consider bad web design.
The only big thing - from a user perspective - which my system currently is missing is the ability to highlight and copy text (to paste into search boxes). I developed a concept for how it would work, but I don't know if I'll get it implemented before completing Shadowplay.

Maverick

#6
Quote from: GarageGothic on Tue 05/12/2006 15:45:35
I have coded a system like this, which emulates basic html functionality (also inspired by SYDNEY). It's quite similar to what SSH describes, except it uses pure RawDraw instead of GUIs. It was rather complicated and I wouldn't recommend it to a beginner, even though most of the big problems were related to line-breaking, scrolling/non-scrolling frames and images inserted into the text - things you don't mention needing.

Wow,
That is exactly what I am looking for (at the top of my Christmas wish list ;D) but I toned it down as I imagined that it would be way too ambitious for me to attempt something like that and that it is best left to the experts.

I'm planning on doing something similar to Gabriel Knight III where the user will have to do research on the PDA to unlock certain information that can be used in solving puzzles later on in the game. It will also be “turn based” i.e. a different character will fulfill this role and these chapters will take up about 30% of the game. The ability to add visual representation of information disclosed will just enhance the impact of the storyline a 100 fold. The ideal is that the interface should behave exactly like a browser with all the bells and whistles but like I said, it's on my wish list so I'll settle for a toned down version.

I managed to do the basic layout where I can add “web pages” (using text boxes) and move back and forth between them or edit and add information. It's just that I have absolutely no idea how to do the rest of it although the hyperlink part should not be that much of an issue as SSH mentioned (just track the “entry numbers”).
The biggest problem as I see it is to get parts of the text to stand out so the user will know that it needs further investigation. It just seems natural to me that this should be in a different colour than the original text.

Quote from: SSH on Tue 05/12/2006 16:03:44
I was thinking of some system like having your text marked up, but characters at the front of a word give special markup, e.g.

=John =and =Joe[John /and Joe played _Tic-Tac-Toe

Rendering as something like:

John and Joe
John and Joe played Tic-Tac-Toe

Great as usual but then again I would expect nothing less from the "Module Master". The walk sequence genarator is one off your greatest "inventions" in my humble opinion. Saved me hours of work so far.

SSH

#7
A quick demo of my work-in-progress was here, but is now gone!
12

Maverick

Holy mackerel :o

That was pretty quick and right on the money too!
Can't wait to see the final product with all the bells and whistles.
Great work!

SSH

Here's the module and demo game. I've not made it its own thread, etc. yet, but I'll do so later today...
12

Maverick

Thanks SSH! ;D
I have no idea how you come up with these modules so fast but I appreciate the time and effort that went into this. I just hope that my game will do it justice.

GREAT WORK!!

SMF spam blocked by CleanTalk