Two dialogue questions

Started by Jordanowen42, Thu 20/06/2024 02:19:47

Previous topic - Next topic

Jordanowen42

Hello all-

So I'm doing my first dialogue section for my game. It's actually the dialogue system being used to allow the players to read journal entries from a computer screen. To that end I need to be able to make the text appear on a certain part of the screen and only take up a certain block of space rather than covering the whole screen in the center. Any advice on how to do this?

Also- I have set up the dialogues so that each one goes to a separate screen where the person talking appears on one side of the screen while their words appear next to them in a black void. I did this by making a second room from dialogues. To that end I want to make the last option of each dialogue menu be "EXIT" so as to allow the player to return to the previous screen. Any advice on how to do that?

heltenjon

Quote from: Jordanowen42 on Thu 20/06/2024 02:19:47Hello all-

So I'm doing my first dialogue section for my game. It's actually the dialogue system being used to allow the players to read journal entries from a computer screen. To that end I need to be able to make the text appear on a certain part of the screen and only take up a certain block of space rather than covering the whole screen in the center. Any advice on how to do this?
I'm not sure using the dialog system is the best way to do this, but ok.

You could either make a character cJournal that is invisible (a pixel in the same colour as the background will do) and place it in the correct spot. The dialogue will appear over its "head".

Or you could uncheck the "Say" box in the dialog editor, and instead use the SayAt command, which gives you the opportunity to give coordinates for the lines of text. (You can use regular script commands in the dialog system if you add a space or two before entering the command.)

QuoteAlso- I have set up the dialogues so that each one goes to a separate screen where the person talking appears on one side of the screen while their words appear next to them in a black void. I did this by making a second room from dialogues. To that end I want to make the last option of each dialogue menu be "EXIT" so as to allow the player to return to the previous screen. Any advice on how to do that?
I think you can simply change room to player.PreviousRoom (The same as above, you need to indent by a space or two before using a regular script command).

RootBound

Quote from: heltenjon on Thu 20/06/2024 08:46:18Or you could uncheck the "Say" box in the dialog editor, and instead use the SayAt command, which gives you the opportunity to give coordinates for the lines of text.
SayAt will also give an optional third parameter to set the width of the dialog speech text box, so it might work well enough for this purpose.
They/them. Here are some of my games:

Jordanowen42

Awesome but how do I implement "SayAt?" The dialogue page doesn't give me a place to enter code, just dialogue options.

Snarky

#4
To change how the list of dialog options are displayed you can first of all edit the GUI that they're displayed on. If that's not enough, you'll need to implement custom dialog options rendering.

There's currently very little ability to change how the response when you select an option is displayed. See the release notes for AGS 3.5.0:

Quote- Added "Custom Say/Narrate function in dialog scripts" options which determine what functions are used when converting character lines in dialog scripts to real script.
   Important: this does not work with the "Say" checkbox. The workaround is to duplicate option text as a first cue in the dialog script.

In other words, the "Say" checkbox always uses Say(). As already suggested you may set and position an invisible dummy character to say it, but you won't be able to control text width, for example.

In general, this whole approach is probably not the best way to do what you want. (You'll also have to deal with the text advancing on timer or when the player clicks.) I would suggest using a GUI with a Label. Then you can set the text however you like.

heltenjon

Quote from: Jordanowen42 on Fri 21/06/2024 04:33:31Awesome but how do I implement "SayAt?" The dialogue page doesn't give me a place to enter code, just dialogue options.

Example:
Code: ags
// Dialog script file
@S  // Dialog startup entry point
 cAlfred.SayAt(454, 74, 100, "I am happy that Master Bruce values my input.");
return
@1
 cAlfred.SayAt(454, 74, 100, "Perhaps I should prepare a simple meal?");
 cAlfred.SayAt(454, 74, 100, "Some Mulligatawny soup?");
 cBatman.SayAt(483, 225, 100, "Tempting as that is, it will have to wait.");
option-off 1
return
// cAlfred.SayAt(454, 74, 100, "Hello, old chap. Back so soon?");
// cBatman.SayAt(483, 225, 100, "I am Batman. I never left.");
@2
  cAlfred.SayAt(454, 74, 100, "It might prove opportune to get a good night's sleep for once.");
 cBatman.SayAt(483, 225, 100, "I manage on micro-sleeps and this tantric meditation technique that allows me to rest far more effectively than by regular sleep.");
  cAlfred.SayAt(454, 74, 100, "If you say so, Master Bruce.");
option-off 2
return

(From my dialogue-only short game Prep Time in case you need to see it in action.)

This should be displayed in a window to the right when you are in the dialog editor. You can see that the dialog script commands (option-off, return) are used without indentation, while to use normal script commands, I have pressed space to indent. (Showing this warts and all, with some places one space and other places two. Will make the better coders here a good groan, I'm sure.)

If I recall correctly, the first two numbers in the paranthesis are coordinates, and the third one is width before line change.

Quote from: Snarky on Fri 21/06/2024 07:00:47In general, this whole approach is probably not the best way to do what you want. (You'll also have to deal with the text advancing on timer or when the player clicks.) I would suggest using a GUI with a Label. Then you can set the text however you like.
This is what I was hinting at in the first reply.
Quote from: heltenjon on Thu 20/06/2024 08:46:18I'm not sure using the dialog system is the best way to do this, but ok.

Khris

I'd use a custom say function to handle the coordinates. Like this:

Code: ags
function DSay(this Character*, String message) {
  int x = 483;
  int y = 225;
  if (this != player) { x = 454; y = 74; }
  this.SayAt(x, y, 100, message);
}

SMF spam blocked by CleanTalk