Author Topic: MODULE: ScrollingDialog v3.0 - Updated 27 January 2016  (Read 16077 times)

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Don't call it a rewrite! :-D

For the first time in years, the ScrollingDialog module is back! And what's more, it actually works this time!!! := This is a major overhaul, written entirely from scratch and is in no way comparable or compatible with the older versions of the module.

You will need AGS 3.4.0.6 or higher to use this module. You will also need the MathsPlus module, which is included in the download.

DOWNLOAD

Why do you need another dialog module? Well, because this one's pretty cool, and if you want to be a cool guy, you'll use it. Just look at this actual, functioning code sample:

Code: Adventure Game Studio
  1. function game_start()
  2. {
  3.   ScrollingDialog.Width = 320;
  4.   ScrollingDialog.Height = 75;
  5.   ScrollingDialog.Padding.Top = 5;
  6.   ScrollingDialog.Padding.Left = 5;
  7.   ScrollingDialog.Padding.Bottom = 5;
  8.   ScrollingDialog.Padding.Right = 5;
  9.   ScrollingDialog.X = 0;
  10.   ScrollingDialog.Y = 125;
  11.   ScrollingDialog.TextColorNormal = player.SpeechColor;
  12.   ScrollingDialog.TextColorActive = 14;
  13.   ScrollingDialog.TextColorChosen = player.SpeechColor;
  14.   ScrollingDialog.LineSpacing = 3;
  15.   ScrollingDialog.Bullet.ActiveGraphic = 6;
  16.   ScrollingDialog.Bullet.Padding.Top = 2;
  17.   ScrollingDialog.Bullet.Padding.Right = 3;
  18.   ScrollingDialog.Bullet.Float = eFloatLeft;
  19.   ScrollingDialog.ScrollArrows.Float = eFloatLeft;
  20.   ScrollingDialog.ScrollArrows.Up.NormalGraphic = 10;
  21.   ScrollingDialog.ScrollArrows.Up.MouseOverGraphic = 9;
  22.   ScrollingDialog.ScrollArrows.Up.PushedGraphic = 13;
  23.   ScrollingDialog.ScrollArrows.Up.Padding.Top = 4;
  24.   ScrollingDialog.ScrollArrows.Up.Padding.Bottom = 2;
  25.   ScrollingDialog.ScrollArrows.Up.Padding.Right = 5;
  26.   ScrollingDialog.ScrollArrows.Down.NormalGraphic = 8;
  27.   ScrollingDialog.ScrollArrows.Down.MouseOverGraphic = 7;
  28.   ScrollingDialog.ScrollArrows.Down.PushedGraphic = 12;
  29.   ScrollingDialog.ScrollArrows.Down.Padding.Top = 2;
  30.   ScrollingDialog.ScrollArrows.Down.Padding.Right = 5;
  31.   ScrollingDialog.NumberStyle = eDialogOptionNumbersDrawn;
  32.   ScrollingDialog.TextAlignment = eAlignRight;
  33.   ScrollingDialog.AutosizeHeight = true;
  34.   ScrollingDialog.AnchorPoint = eAnchorBottomLeft;
  35.   ScrollingDialog.Background.Color = 1632;
  36.   ScrollingDialog.Background.Transparency = 75;
  37.   ScrollingDialog.Background.Graphic = 11;
  38.   ScrollingDialog.Background.AnchorPoint = eAnchorCenter;
  39.   ScrollingDialog.MinWidth = 107;
  40.   ScrollingDialog.SetTag("%LOCATION%", "SPARTA");
  41.   ScrollingDialog.Background.BorderDecoration.Top = 6;
  42.   ScrollingDialog.Background.BorderDecoration.Bottom = 6;
  43.   ScrollingDialog.Background.BorderDecoration.TopLeftCorner = 6;
  44.   ScrollingDialog.Background.BorderDecoration.TopRightCorner = 6;
  45.   ScrollingDialog.Background.BorderDecoration.BottomLeftCorner = 6;
  46.   ScrollingDialog.Background.BorderDecoration.BottomRightCorner = 6;
  47.   ScrollingDialog.Background.BorderDecoration.Left = 6;
  48.   ScrollingDialog.Background.BorderDecoration.Right = 6;
  49.   ScrollingDialog.Font = eFontBlackAdder;
  50. }

There isn't a demo game for this (yet), but one may be made (I'm going to ask Secret Fawful to make graphics for it, so if it never happens, blame him).

For the most part, the properties should all speak for themselves as to what they do, and there's some limited documentation in the module. One really cool feature that the module includes is dialog option tagging. What that means is that you can create a custom tag that you will later replace with some other text, such as a character's name. You tell the module what you want to replace the tag with (using ScrollingDialog.SetTag), and then when the dialog options are drawn, the module will handle it for you!

Code: Adventure Game Studio
  1.   cPet.Name = "Spike";
  2.   ScrollingDialog.SetTag("%PETNAME%", cPet.Name);

Then if you have a dialog option set to "My dog's name is %PETNAME%." (for example), then the text would be displayed as "My dog's name is Spike.".

There is also a built-in tag for the player name (ScrollingDialog.PlayerNameTag), which is always replaced with the current player name. This will save you from having to change the tag if you change the player, as it will always stay up-to-date with the current player character.

NOTE: If you are using a tagged dialog option, you should always leave the Say check-box unchecked. The module can't overwrite the actual dialog option text, so if the player reads that option, they would end up saying the original text, as set up in the editor. If you want the player to read that option, then instead include a line such as this in your dialog script:

Code: Adventure Game Studio
  1. // dialog script
  2. @S
  3. return;
  4. @1 // My dog's name is %PETNAME%.
  5.   player.Say(ScrollingDialog.SelectedOption.Text); // say "My dog's name is Spike."
  6. return;

This will ensure that the dialog tags are replaced appropriately.
« Last Edit: 27 Jan 2016, 22:33 by monkey0506 »

Shade

  • Hello again!
    • Shade worked on one or more games that won an AGS Award!
    •  
    • Shade worked on one or more games that was nominated for an AGS Award!
wow! :o great job monkey_05_06 and thanks for sharing! first of all the mosule is easy to use and i like the way how you can customise almost everything!

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
I'm glad that you like it then.

Right now I'm just trying to decide if I should use an array or a vector for storing the dialog tree...it would actually be easier on my part to use a vector, but it would mean you would have to include another module, so I'm still undecided.

But monkey, you also made the vector module, right? So can't you just copy the code from that into the dialogue module and add a note in the readme to make sure that people don't use both?

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    • SSH worked on one or more games that won an AGS Award!
    •  
    • SSH worked on one or more games that was nominated for an AGS Award!
You could detect, using #ifdef, if the user has already got the vector module included, and if they have: use it, if not use an array...

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
I could do that. But then I'd have to program it both ways...that's no fun. :D

I'll work on this today...see if I can't come up with something.

[EDIT:]

I didn't feel like using an array because it really would have been much more complicated for me to have to deal with...so I just wrote a customized version of the int vector class into the module! :D

It works better that way. And so the new version's up now. For those that won't read the edit in the first post, you can now have multiple dialog topics run at the same time (nested dialogs for complex dialog trees). You just use ScrollingDialog.Run as you normally would. To go back one step you call ScrollingDialog.Return. If you call ScrollingDialog.Return when only one topic is running it calls ScrollingDialog.End.

It's worthy noting though that you can't call ScrollingDialog.Run from the ScrollingDialog_Setup module. So for nested dialogs you will have to put interactions in the ScrollingDialog module itself.

Code: [Select]
// example of how to put interactions in the ScrollingDialog module
static void ScrollingDialog::RunInteraction(int topic, int option) {
  if ((topic < 0) || (topic >= eScrollingDialog_MaxTopics))
    AbortGame("Invalid parameter 'topic' to function 'ScrollingDialog::RunInteraction'. Range 0..%d, value %d.", eScrollingDialog_MaxTopics - 1, topic);
  if ((option < 0) || (option == eScrollingDialog_MaxOptions))
    AbortGame("Invalid parameter 'option' to function 'ScrollingDialog::RunInteraction'. Range 0..%d, value %d.", eScrollingDialog_MaxOptions - 1, option);
  if (ScrollingDialog_Topics[topic].Say[option]) player.Say(ScrollingDialog.GetText(topic, option));
  ScrollingDialog_Setup.RunInteraction(topic, option);
  if (topic == 0) {
    if (option == 0) ScrollingDialog.Run(15);
    else if (option == 1) {
      cMan.Say("That's hard to believe.");
      player.Say("I saw it with me own two eyes.");
      }
    }
  /* ... */
  else if (topic == 15) {
    if (option == 0) ScrollingDialog.Return();
    }
  }

Of course if you don't call any of the ScrollingDialog functions from your interaction script you can put it in the ScrollingDialog_Setup module. You can even have interactions defined in both places, however anything in the ScrollingDialog module before the line "ScrollingDialog_Setup.RunInteraction(topic, option);" will be run before the interactions defined in ScrollingDialog_Setup, and anything after it will be run after those interactions.
« Last Edit: 01 Aug 2006, 21:58 by monkey_05_06 »

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #6 on: 16 Aug 2006, 18:53 »
Small suggestion - how hard would it be to allow your dialogs to recognize numbers for topics (pressing 1 equal clicking on first dialogue, and so on)? It would be a very handy feature.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #7 on: 16 Aug 2006, 19:12 »
Question: Is that implemented into AGS's system?

Because it would be fairly easy to implement (either for the module or individually):

Code: [Select]
function on_key_press(int keycode) {
  if ((keycode >= '0') && (keycode <= '9') && (ScrollingDialog.GetRunning() != -1)) {
    if ((keycode == '0') && (9 < eScrollingDialog_LabelCount)) keycode = 40;
    if ((keycode == '0') || (keycode - 31) >= eScrollingDialog_LabelCount) || (ScrollingDialog.GetOptionOnLabel(keycode - 31) == -1)) return;
    ScrollingDialog.RunInteraction(ScrollingDialog.GetRunning(), ScrollingDialog.GetOptionOnLabel(keycode - 31));
    }
  }

Okay, there's a few more checks than I initially anticipated...but...that would allow you to press 1 - 0 to run options 0 - [9/eScrollingDialog_LabelCount - 1] (because the options are indexed from 0 to eScrollingDialog_MaxOptions).

I may decide to implement it if it's implemented in the built-in system, but for right now...I'm off to find something to entertain myself...lol...(I'm very bored and the A/C is broken...)
« Last Edit: 17 Aug 2006, 14:14 by monkey_05_06 »

Rui 'Trovatore' Pires

  • Lunge da lei per me non v'ha diletto!
    • I can help with AGS tutoring
    • I can help with play testing
    • I can help with proof reading
    • I can help with scripting
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #8 on: 16 Aug 2006, 21:45 »
Oh ayuh, very possible to do. I've just played 3 or 4 AGS games recently in which it was not only possible - it was a very welcome shortcut. Very, very welcome.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #9 on: 01 Oct 2006, 23:36 »
When i try to import the module i get an error.

Something like "You need a newer version of AGS..."
« Last Edit: 02 Oct 2006, 23:58 by Pendorcho »

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #10 on: 02 Oct 2006, 00:03 »
What version of AGS are you using? It was built with the latest version, AGS v2.72. So make sure you're using the latest version of AGS. If it still doesn't work, you can try redownloading the file.

Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #11 on: 02 Oct 2006, 21:06 »
I'm using the latest version.

=S

Until yesterday, the link was broken, so i downloaded a mirror from http://www.americangirlscouts.org/agsresources/.

I'll try the one you've just uploaded (http://monkey0506.madpage.com/ScrollingDialog_1_21.rar) and see what happens.

Edit:

It works perfectly.

Thank you very much.
« Last Edit: 03 Oct 2006, 14:52 by strazer »

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Re: MODULE: ScrollingDialog v1.21 (Updated 15 August 2006)
« Reply #12 on: 02 Oct 2006, 22:20 »
I'm glad to hear you've gotten it working. However I see that you posted twice, and within only a few minutes of each other. You're really supposed to use the "Modify" button to edit your posts if no one else has posted since your last post, or unless it's been several days. (I'm not a mod, just trying to watch out for my consumers ;D)

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Quote from: The friendly forum reminder
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

*bump*

Yes forum, I'm sure I want to post. This may just be a beta version, but it's at least mostly stable. :) Right now I'm looking into the unstable bits...more later.

Mazoliin

  • Now how do I get down...
    • Mazoliin worked on one or more games that won an AGS Award!
    •  
    • Mazoliin worked on one or more games that was nominated for an AGS Award!
How do I use ScrollingDialog
« Reply #14 on: 19 May 2007, 15:03 »
Hi! I'm makeing a game whit a FOA look-a-like dialog gui.
I've tried to use monkey_05_06's ScrollingDialog module to change the color and font, but when I then try to test my game, I get this error saying the gui isn't initialized.

What does that mean?!

I've looked for an answer everywhere I can think of.
Maybe someone else had a similar problem?
I don't know too much about code.
Many excuses for my bad english.

Mazoliin

  • Now how do I get down...
    • Mazoliin worked on one or more games that won an AGS Award!
    •  
    • Mazoliin worked on one or more games that was nominated for an AGS Award!
Exact error:

Quote
A fatal error has been generated by the script using the AbortGame function. Please contact the game author for support.

in ScrollingDialog (line293)
from ScrollingDialog_Setup (line36)

Error: ScrollingDialog error: Dialog GUI not initialized. Check manual for mor info.

Haven't been able to find anything in the manual.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
You may have read this in the manual:

Quote
bool ScrollingDialog_Setup.SetDialogGUI(GUI* dialogGUI, optional int seed_control,
optional int x_offset)

  Sets the GUI to use for displaying the dialog options. Requires
  eScrollingDialog_LabelCount labels starting from SEED_CONTROL (default 0).
  X_OFFSET sets the offset for this GUI if the arrows GUI is activated (similar to the
  way the GUI is moved in The Secret of Monkey Island(TM)).

As denoted by the manual entry the dialog GUI requires eScrollingDialog_LabelCount GUI label controls. The default value for eScrollingDialog_LabelCount is 7. If you need to change this, you will need to look in the ScrollingDialog module header where you will see this:

Code: [Select]
enum ScrollingDialog_Variables {
  eScrollingDialog_LabelCount = 7,
  eScrollingDialog_MaxTopics = 500
  };

You can change 7 to whatever value you need (however many rows of options you need to show on the dialog GUI at once) however you must have as many labels on the dialog GUI as this value defines or your game will crash.

It's been a while since I worked on this module, however I may find time to take back up my work on it again shortly.

If this doesn't solve your problem, feel free to describe exactly what you've done, as well as any errors you receive (Ctrl+C to copy the errors, Ctrl+V to paste them in your messages).

Mazoliin

  • Now how do I get down...
    • Mazoliin worked on one or more games that won an AGS Award!
    •  
    • Mazoliin worked on one or more games that was nominated for an AGS Award!
Fixed it. Must read the manual more carefully. But when I'm going to talk, this happend:
Quote
---------------------------
Adventure Game Studio
---------------------------
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.72.920)

Error: run_text_script1: error -6 running function 'character1_a':
Error: call stack overflow, recursive call problem?
in ScrollingDialog (line 102)
from ScrollingDialog (line 107)
from ScrollingDialog (line 114)
from ScrollingDialog (line 459)
from ScrollingDialog (line 514)
from ScrollingDialog (line 554)
(and more...)


---------------------------
OK   
---------------------------

Can't wait until I can get the demo and see what I'm doing wrong! >:(
This is just silly! I'm really need a tutorial for this or something...
« Last Edit: 20 May 2007, 17:11 by Monkey Entertainment »

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Can you post the exact code you used? Because unless you've modified the script for the ScrollingDialog module...there's no way that error message is correct. The line numbers it's giving don't match up at all.

If all else fails would it be too much to ask for you to zip/rar up your game files and PM them to me?

Mazoliin

  • Now how do I get down...
    • Mazoliin worked on one or more games that won an AGS Award!
    •  
    • Mazoliin worked on one or more games that was nominated for an AGS Award!
On "Talk to character" I have...
Code: [Select]
gGui2.Visible = false;
ScrollingDialog.Start("new topic");

And this is how it look in the ScrollingDialog Script.
Code: [Select]
static void ScrollingDialog_SetupType::InitializeText() {
  // set up your dialog text here!
  ScrollingDialog.SetOption("new topic", 0, "this is some text");
  ScrollingDialog.SetOption("new topic", 1, "More text");
  }

void ScrollingDialogType::RunInteraction(String topic, int option) {
  if (this.GetSay(topic, option)) player.Say(this.GetText(topic, option));
  // set up your dialog interactions here!
  if (topic == "new topic") {
    if (option == 0){
      cGoog.Say("Eat fish!");
      cEgo.Say("Oh...");
    }
    if (option == 1){
      cGoog.Say("Fish, FISH!");
    }
    }
  }

I hope the demo will be available soon. I really think it would help me a lot.