Hey guys.
I'm currently working on a game that implements a journal. The main idea is a Journal GUI which pops up after you click the Journal button on the main GUI.
What I can't seem to figure out is a way for the Journal GUI to only show the relevant information after you have gotten the information from a source in the game.
I have all my variables set up, but can't figure out how to display only the relevant messages on the GUI. Do I use labels?
Please, if someone could help me with this, I would appreciate it very much.
Hm...Okay, I dont know really how to do this, but it may work. You can have every piece of information as an object. I know this sounds stupid. And hide them all. When you get that information, You can just put the interaction to show them again. Forgive me If it does not work.
Using of objects is a possibility but you may run out of them quickly.
I think, a good idea is indeed to have a GUI and display a text on it.
Darcness, how do you store that information, in string variables?
And what do you mean by the relevant information, do you just want to add a new entry to the journal each time the player reachs a certain part of the game, or should the journal GUI display info relevant to the current room or to the game progress, or?
Thanks so far guys.
Well, Scorpiorus, I do store the information in string variables. By relevent information I mean that the journal should only show what the character has learned so far about the case.
This next screenshot shows my problem.
(http://img.photobucket.com/albums/v242/Darcnyss/journal.gif)
The second entry should not be available yet. I've switched of that GUI option on game start but it still shows up. I'm seriously looking for a way to fix this, since the journal is a very important tool in the game.
Aha, I see.
I'd put a single Listbox GUI object and add entries into it.
main global script file:// make our life easier:
function AddEntry(string textline) {
Ã, Ã, ListBoxAdd(GUIJOURNAL, 1, textline); //listbox num = 1
Ã, Ã, ListBoxSetSelected(GUIJOURNAL, 1, -1); // to get rid of the listbox cursor
}
script header:import function AddEntry(string textline);
a new entry(s) must be added:Ã, AddEntry("1. Find out what's Sarah's strange");
Ã, AddEntry("message was about");
Ã, AddEntry(""); // just a blank line
Ã, Ã,Â
Ã, AddEntry("2. Get to aldens and Sarah's place");
Ã, AddEntry("to get items and map to coven falls");
Ã, AddEntry("");
The only annoying thing is that you'll have to align messages by yourself in the script.
You may also probably want to hide listbox border.
And, by the way, the player will be able to get listbox cursor back by clicking over the listbox. In the next version of AGS (2.7) it will be possible to remove the listbox cursor completely but for now there is a workaround:
- add two listboxes (gui objects: 0 and 1) and make the first listbox (it must be a gui object
0!) cover the 2nd one.
You add entries to listbox 1 while listbox 0 is clear. But when the player tries to click over listboxes the clear one will be clicked and since it has no text items there is no cursor appear.
Let us how it turned out ;)
Also, keep in mind that there's a limit to the number of lines you can add to a listbox. My last info is about 150 lines of text. Haven't checked though.
Thanks a lot, guys. It works like a charm, Scorpiorus. You've really helped me a lot. (Going into my thanks list)
No problem :)
By the way, if you want to make a journal with a possibility to turn pages (in case there will be many entries) then just add two "arrow" (or whatever) buttons and on player clicking them do:
at the top of the main globa script:
int page = 0;
on pressing the turn forward button:
if (page < LAST_PAGE) page++;
ListBoxSetTopItem (GUIJOURNAL, 1, page * THE_NUMBER_OF_TEXTLINES_PER_PAGE);
on pressing the turn back button:
if (page > 0) page--;
ListBoxSetTopItem (GUIJOURNAL, 1, page * THE_NUMBER_OF_TEXTLINES_PER_PAGE);
But yeah, keep in mind, there is about 150 lines you can have, as Strazer correctly pointed out. But you can always add another listbox (initially hidden) and then use that also.Ã, :=
EDIT:
Oh, and to be on a safe side, replace LAST_PAGE with
ListBoxGetNumItems(GUIJOURNAL, 1) / THE_NUMBER_OF_TEXTLINES_PER_PAGE