MODULE: ScrollingDialog v3.0 - Updated 27 January 2016

Started by monkey0506, Mon 31/07/2006 06:33:57

Previous topic - Next topic

monkey0506

I'll look into this problem, but I still don't see why it would producing that error with those line numbers. It's possible that I'm just creating a stack-overflow by trying to check that the parameters are valid...but...I'm currently exploring some new ideas about this module. No word as yet as to when the next beta will be released, but don't give up hope about me working on it.

Mazoliin

#21
OK! I'll just keep working whit every thing else and save the dialogs for later. ;)


[EDIT]
----------------------------------------------------------
I think I found a nother solution for my needs.

Gribbler

Hi

Could someone provide an example on how to define and run dialog in game?
---------------------------------------------------------------------------------------------------------
static void ScrollingDialog_SetupType::InitializeText() {
  // set up your dialog text here!
  ScrollingDialog.SetOption("new topic", 0, "this is some 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") {
    }
  }
--------------------------------------------------------------------------------------------------------

maybe some demo code?
I have read the manual but I just can't quite figure it out...

monkey0506

Oh, sorry! I'd read this but got distracted. ::)

Code: ags
static void ScrollingDialog_SetupType::InitializeText() {
  // set up your dialog text here!
  ScrollingDialog.SetOption("merchant", 0, "this is option 0 of topic 'merchant'");
  ScrollingDialog.SetOption("merchant", 1, "How much for those fine leather jackets?");
  ScrollingDialog.SetOption("merchant", 2, "How much for the glass eyeball?");
  }


- The first parameter to this function is the name of your dialog. This is similar to the way you can name your dialogs in the dialog topic pane in the editor.
- The second parameter is the option number, which I've indexed from 0 instead of 1.
- The third parameter is the option text, similar to the way you set "Option names" in the editor.
- The next two parameters are optional:
   - state parameter: Controls the state the option starts out at; whether on or off (eScrollingDialog_OptionOn or eScrollingDialog_OptionOff usually). Defaults to eScrollingDialog_OptionOn. This is the same value as AGS's eOptionOn except the module has an extra value defined, 'eScrollingDialog_OptionOffByScrolling' so it's important to note that if the option has been turned off it will hold this value and not one of the values defined by AGS.
   - say parameter: Controls whether the option text (the "option name") should be said when you click on this option. Defaults to true.

Code: ags
void ScrollingDialogType::RunInteraction(String topic, int option) {
  if (this.GetSay(topic, option)) player.Say(this.GetText(topic, option)); // DO NOT EDIT OR REMOVE THIS LINE ;)
  // set up your dialog interactions here!
  if (topic == "merchant") {
    if (option == 0) { // "this is option 0 of topic 'merchant'"
      cMerchant.Say("That's great. Thanks for telling me.");
      player.Say("You're welcome.");
      }
    else if (option == 1) { // "How much for those fine leather jackets?"
      cMerchant.Say("They're on sale! They're only a hundred dollars a piece!");
      player.Say("I'll take eight!");
      }
    else if (option == 2) { // "How much for the glass eyeballs?"
      cMerchant.Say("25 cents a pieces.");
      }
    }
  }


You'll have to have a basic grasp on scripting to use this, but basically the format is that this function is called whenever you click on a dialog option. The appropriate dialog name and option number will be passed into the TOPIC and OPTION variables respectively. You can then check which topic has been called using a simple if statement as shown above. Next you can check which option it was called for, and finally you can set up your dialog interaction. This is whatever you want to take place when the user clicks on your dialog option. In the above example, if the player asks the merchant "How much for these fine leather jackets?" the merchant will give him a price quote, and the player can decide to buy some jackets.

I hope this has described it well enough to get you started. I really have to go, but if you have more questions don't hesitate to ask.

Gribbler

I get the idea now, i think:) How can I run the dialog from the game? In the previous version of your module it was something like this:

// script for Character 1 (someguy): Talk to character
gMain.Visible = false;
ScrollingDialog.Run(0);

now it doesn't work cause it doesn't recognize "run".

Gribbler

I suppose I should use ScrollingDialog.Start command so it would look like this:

Code: ags

// script for Character 0 (YGUY): Talk to character
player.Walk(142, 119, eBlock);  
player.FaceLocation(220, 113,eBlock);
gMain.Visible = false;
ScrollingDialog.Start("merchant");


The game compiles with no errors but when I'm trying to "talk to" the character the game crashes...

the dialog setup looks like the one you provided:

Code: ags

static void ScrollingDialog_SetupType::InitializeText() {
  // set up your dialog text here!
  ScrollingDialog.SetOption("merchant", 0, "this is option 0 of topic 'merchant'");
  ScrollingDialog.SetOption("merchant", 1, "How much for those fine leather jackets?");
  ScrollingDialog.SetOption("merchant", 2, "How much for the glass eyeball?");
  }

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 == "merchant") {
    if (option == 0) { // "this is option 0 of topic 'merchant'"
      cBum.Say("That's great. Thanks for telling me.");
      cYguy.Say("You're welcome.");
      }
    else if (option == 1) { // "How much for those fine leather jackets?"
      cYguy.Say("They're on sale! They're only a hundred dollars a piece!");
      cBum.Say("I'll take eight!");
      }
    else if (option == 2) { // "How much for the glass eyeballs?"
      cYguy.Say("25 cents a pieces.");
      }
    }
  }



monkey0506

Can you post the error message you're receiving when the game crashes (Ctrl+C to copy it)?

I don't see any obvious reason for it to be crashing based on the code provided, but knowing what error was generated will help me better determine why it crashed.

Gribbler

I couldn't copy it so I took a screenshot and sent you via e-mail. Check it out. When I click on "OK" button the game closes and returns to the editor...

Gribbler

damn... I just read earlier posts by Monkey Entertainment. I got exactly the same message.

monkey0506

I don't know why I thought the line numbers didn't match up...I checked and it makes perfect sense. It's a simple stack overflow...which is exactly what AGS said. My test dialogs (obviously) didn't encounter this, but it appears the end users are having problems.

Just a heads-up, I'm developing the latest version with AGS 2.8, so you'll need the latest version (which is still in beta) once I release the new version of the module. It re-implements some of the limits I tried to remove, but since it now uses dynamic arrays instead of storing all the data in Strings you'll get much faster data access in fewer function calls...so in theory this will eliminate the stack overflow...in theory. 8)

Lt. Smash

Hey guys!

I keep getting an error message when calling ScrollingDialog.Start:

-------------------------------
An internal error has occurred. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 3.01.1012)

Error: run_text_script1: error -6 running function 'on_key_press':
Error: call stack overflow, recursive call problem?
in "ScrollingDialog_2_0_BETA_1.asc", line 102
from "ScrollingDialog_2_0_BETA_1.asc", line 107
from "ScrollingDialog_2_0_BETA_1.asc", line 114
from "ScrollingDialog_2_0_BETA_1.asc", line 459
from "ScrollingDialog_2_0_BETA_1.asc", line 514
from "ScrollingDialog_2_0_BETA_1.asc", line 554
-------------------------------

Does anybody now how to solve it?

And here is a suggestion for the module: I think it would be nice to be able to support bullets (in the form of buttons) for the available dialog options.

ps I know this thread is quite old but I don't wanted to start a new thread. I think it suits in here better.

monkey0506

Hmm...yes...I know what's wrong. I never released a fix for this version. I've been working too many hours lately and coming home mostly to find my two younger sisters exerting some sort of tyrannical dictatorship over the computer...

I know I said back in August I was working on a new version...but one thing led to another and I got sidetracked. My apologies.

I can't make any promises, but I'll try to have a fix up before the end of the month.

monkey0506

I wanted to post an update on this. Due to certain circumstances beyond my control, I no longer have any reliable computer access. I can bum off the computers at Circuit City or at the apartment complex for Internet purposes, but it's not really any good for development.

Further complicating the matter, all my developmental files are saved to a SATA hard drive which is currently sitting on top of my dresser. Until I can afford to buy a computer and plug the HDD in...most of my files are somewhat in lock-down.

I apologize for the inconvenience and will try to update as soon as the issue is resolved.

-monkey

monkey0506

*bump* for new version. See first post for details.

selmiak


monkey0506

#35
It's for custom dialog option rendering. To use the module you need to specify some basic info, such as the size and position of the "GUI" where the dialog options will be drawn:

Code: ags
  ScrollingDialog.X = 0;
  ScrollingDialog.Y = 125;
  ScrollingDialog.Width = 320;
  ScrollingDialog.Height = 75;
  ScrollingDialog.TextColorNormal = player.SpeechColor;


That alone should be enough to get you going, I think. The normal text color should actually be defaulted by the module, but I think I overlooked that.

The other options allow you to change various other graphical features, background graphics, border decorations, scroll arrows, etc.

The module does much more than just provide scroll arrows at this point, but I kept the name for historical purposes. The early versions were the modularization of the scripts I submitted in my early days of AGS, long before the custom dialog rendering system was put into place.

daneeca

It doesn't work with the newest AGS :-/ Can I fix it somehow?

QuoteFailed to save room room7.crm; details below
MathsPlus.ash(20): User error: The MathsPlus module requires AGS version 3.4.0.6 or higher. Please use a newer version of AGS to use this module.

daneeca

Okay, don't listen to me! I just needed to rewrite the version numbers in the script.

Crimson Wizard

Quote from: daneeca on Fri 21/10/2016 15:54:44
Okay, don't listen to me! I just needed to rewrite the version numbers in the script.

This is error in AGS, it cannot compare those versions properly. I hope to release a small patch soon with this bug fixed.
Until then simply change long version string into short one in the #ifver command (e.g. 3.4.0.6 into 3.4.0)

Monsieur OUXX

in a nutshell, how do you hook into what the player is about to say?
 

SMF spam blocked by CleanTalk