how to run dialog in monkey_05_06 template?

Started by Gribbler, Tue 20/02/2007 08:24:11

Previous topic - Next topic

Gribbler

I'm working on a game and I'm using MonkeyTemplate 0.83 by monkey_05_06.
I'm new to scripting and all so be gentle:) I know how to script AGS dialogue (learned from tutorial)but when I script dialogue using that template it's displayed over GUI (give, use, pick up etc.). Hiding GUI didn't help because gui.visible is not blocking:

gui[0].visible = false;
RunDialog(0);
gui[0].visible = true;

and even if it did it wasn't MI-themed but AGS so it's no good.
I know that it has to be set up independently but I can't figure it out how.
Here is the question: how to write dialog script using monkey template so it will be displayed in monkey dialog GUI? Meybe someone could provide a sript sample of such dialogue?

monkey0506

I was going to reply...I just needed some time to think over how best to respond.

See...to use my *dialog* module you have to define all of your dialog interactions in the script. You'll have to have both the ScrollingDialog_Setup and ScrollingDialog modules imported (in that order). Then you have to edit the ScrollingDialog_Setup module script (Script -> Module Manager -> Edit script...) and then you will have to scroll down to find the line like this:

Code: ags
static void ScrollingDialog_Setup::Initialize() {


Inside that function you have to put your dialog text like this:

Code: ags
SetDialogText(0, 0, "Who are you?");


The parameter list for SetDialogText (a custom function available only with the ScrollingDialog_Setup module script) is as follows: TOPIC, OPTION, TEXT, STATE, SAY. The STATE and SAY parameters are optional.

The next step (after you have set up all your dialog topics/options like this) is to set up your dialog interactions. To do this, in the ScrollingDialog_Setup module script, look for the line like this:

Code: ags
static void ScrollingDialog_Setup::RunInteraction(int topic, int option) {


Inside that function you must define your dialog interactions. An example of how to do this is as follows:

Code: ags
static void ScrollingDialog_Setup::RunInteraction(int topic, int option) {
  if (topic == 0) {
    if (option == 0) {
      // topic 0, option 0
      cOtherchar.Say("I'm nobody.");
      player.Say("Oh...I see.");
      }
    }
  }


After you have all your dialog interactions set up, you are then ready to change your code. When you're ready to run a dialog you would then do it like this:

Code: ags
gMain.Visible = false;
ScrollingDialog.Run(0);


When you're ready to end the dialog, do this:

Code: ags
ScrollingDialog.End();
gMain.Visible = true;


Hopefully you can get something out of this, although it does require a bit of knowledge of AGS scripting to get this all set up properly.

Note however that I can't guarantee the stability of either of these modules at the moment...I think they are both currently stable releases, though, as I mentioned previously, it has been some time since I've worked with them.

Gribbler

Ok, I get it now how to write a dialogue in your module. I deleted "/*" signs in demo code included in module_setup script and replaced cMerchant with my character's name just to see how it works withoud messing with it deeper (adding more topics etc.). The result was that there were no arrows on the left. Well there shouldn't be any since there were only two options and nothing to scroll but the options' text was covered on the left by the black vertical rectangle. Here's code:

static void ScrollingDialog_Setup::Initialize() {
  /* set up your dialogs here! */
  // DEMO CODE //
  SetDialogGUIs(gDialog, gDlgarrows);

  SetDialogText(0, 0, "Who are you?");
  SetDialogText(0, 1, "Tell me more about your wares.");
  SetDialogText(0, 2, "Bye, see you later.");
  SetDialogText(1, 0, "How much is a jacket?");
  SetDialogText(1, 1, "How much for a fake eyeball?");
  SetDialogText(1, 2, "That's all for now.");

  }

static void ScrollingDialog_Setup::RunInteraction(int topic, int option) {
  /* place your interactions here! */

  // DEMO CODE //
  if (topic == 0) {
    if (option == 0) {
      cGuy2.Say("My name is Derek, and I'm a local merchant.");
      cGuy2.Say("I can sell you all sorts of things.");
      }
    else if (option == 1) {
      cGuy2.Say("I specialise in selling various random items.");
      cGuy2.Say("My jackets and fake eyeballs are popular.");
      }
    else if (option == 2) {
      cGuy2.Say("Do pop by again sometime.");
      mouse.Mode = eModeWalkto;
      }
    }
  else if (topic == 1) {
    if (option == 0) {
      cGuy2.Say("A fine leather jacket - for you, just $200!");
      player.Say("That's a bit expensive, isn't it?");
      cGuy2.Say("Not for this Sir, it's hand-made by my wife.");
      player.Say("Oh, ok then.");
      }
    else if (option == 1) cGuy2.Say("A perfect joke item, the eyeball is just $3.99");
    else if (option == 2) cGuy2.Say("Very well.");
    }
  }

Also when in game I choose any option characters say their text and then nothig happens, dialogue doeasn't return to other options.

In cGuy2 "Talk to character" interaction I wrote:

gMain.Visible = false;
ScrollingDialog.Run(0);


monkey0506

Okay, in the ScrollingDialog module script you'll see a line like this:

Code: ags
static void ScrollingDialog::RunInteraction(int topic, int option) {


Inside that function you'll see some more "// DEMO CODE //". Uncomment that part and it should function normally except for the DLGARROWS GUI still being shown. I think I know why it's doing that, but it will require a fix to the dialog module, and perhaps the MonkeyTemplate module as well. I'm currently in the process of completely rewriting the dialog module which could take some time before it is ready. Especially considering the new method I'm using might possibly be too slow to run properly, which would then require me to rewrite it once more.

For now, you should be able to just set the background and border colors as well as the background image for the DLGARROWS GUI to 0. That should help fix the visibility problem...I think.

Gribbler

that worked, dialogs work fine and yeah arrows GUI isn't working and the black rectangle is still hiding dialog topics. But I managed to avoid this very simple way: I changed X-position of DialogGUI by 20pix to the right and now they are visible. There's a small 1,5cm gap between left edge and text but it's acceptable:) I will be checking forums for your module's updates. Thanks a lot for help bro!

SMF spam blocked by CleanTalk