Help with a diary. [Solved for now]

Started by Bulbapuck, Thu 03/06/2010 11:34:48

Previous topic - Next topic

Bulbapuck

Hello!

I'm making a game for the current MAGS and I want one of the games features to be a diary in which you collect information.

Problem is, I have no clue how to even start making what I want.

So, here's how I want it to work:

Whenever you get information I want to add a line of text to the diary. This text you can press and get a small screen featuring a little bit more text.

EDIT: I suppose you could refrase the question as this: Can you add more buttons to a GUI during gameplay?

Khris

Create all the buttons to fit on one page of the diary but turn them invisible in game_start.
After adding the entry, turn them visible.

Gord10

#2
I have coded a similar quest/diary for a commercial AGS game, unfortunately I don't think I'm allowed to share the codes but let me give you hints.

I have used a static queue data structure.

The notebook screen consists of buttons with initially blank texts. There is an integer variable which keeps the amount of the quests we have taken. Each quests have their own ID's and an array stores which notebook line is about which quest (first line being about the quest ID 2, which is "Collect woods for fire", etc.). Each time we receive a quest, that amount variable increases and places the quest into the notebook (and there's a boolean array whether a quest can be added or not).

For your question, you can run this algorithm for a X button, which is actually the line of the questbook:

For each quest ID's,
 if line{x}==-1 //Let's say -1 is the initial value for lines
   Do nothing;
 else if line{x}==questID
    Run codes for that quest (like showing the GUI about that quest, etc...)    

And like Khris said, the buttons which aren't assigned to a quest can be invisible (or unclickable).
Games are art!
My horror game, Self

Bulbapuck

That's a very clever solution gord10!

I'll see if I can make it work, otherwise I always have Khris's solution as a backup plan.

Thanks guys :)

Gord10

And I forgot to say: Each time we receive a quest, the corresponding line's (which is actually a button's) text is changed into the quest string.

Khris's solution is also adaptable for my method.
Games are art!
My horror game, Self

tzachs

#5
And just to confuse you further, I did this completely different when I did this in "The Energizer"  ;D.
I used an inventory window for the notebook, where each item in the inventory is in the width of the inventory window itself, thus each inventory item is really a line in the notebook.

On the minus side, you have to draw each line as an image, so it's probably not the approach I would take if I had many lines, but if I knew in advance I had few lines (like for a MAGS game), it should be ok.

On the plus side, there's no fancy scripting involved (even if you have more than one page it's still just like moving a regular inventory),
and since you draw each line yourself you can add scribbles and whatnot...

Bulbapuck

Quote from: tzachs on Thu 03/06/2010 19:31:54
And just to confuse you further, I did this completely different when I did this in "The Energizer"  ;D.
I used an inventory window for the notebook, where each item in the inventory is in the width of the inventory window itself, thus each inventory item is really a line in the notebook.

On the minus side, you have to draw each line as an image, so it's probably not the approach I would take if I had many lines, but if I knew in advance I had few lines (like for a MAGS game), it should be ok.

On the plus side, there's no fancy scripting involved (even if you have more than one page it's still just like moving a regular inventory),
and since you draw each line yourself you can add scribbles and whatnot...

This is the approach I first considered, but the rules in the MAGS are as follows:

"No inventory allowed"

I think this might be a slight breech of that rule, but since it's a lot simpler I will probably ask for permission to do this (it's not the "standard" inventory anyway.) Thanks Tzachs :)

Still, I'm planning to make a larger game featuring this after the MAGS, and hence I will probably have to do it the way Gord10 did it. But this solution will do for now.

Khris

You can draw the inventory item graphics / notebook lines in-game using DynamicSprites & DrawingSurface.DrawString.

Bulbapuck

Quote from: Khris on Fri 04/06/2010 00:09:02
You can draw the inventory item graphics / notebook lines in-game using DynamicSprites & DrawingSurface.DrawString.
I'll look those up in the manual, thank you Khris!

SMF spam blocked by CleanTalk