Adventure Game Studio | Forums

AGS Support => Modules, Plugins & Tools => Topic started by: Snarky on Sun 03/12/2017 11:28:04

Title: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sun 03/12/2017 11:28:04
Here's a module to do comic book-style speech bubbles. It's an alternative to Phylactere, because the older module doesn't work properly with 32-bit color. This module requires AGS 3.4, and for now it only works in 32-bit mode (or rather, transparency only works in 32-bit mode).

Initial development of this module was paid for by bx83, who agreed to allow it to be open-sourced.

To use, you call Character.SayBubble():

Code (ags) Select
  player.SayBubble("This line will be said in a speech bubble.");

To configure, you set the SpeechBubble properties:

Code (ags) Select
  SpeechBubble.BorderColor = Game.GetColorFromRGB(0,128,0);
  SpeechBubble.BackgroundColor = Game.GetColorFromRGB(128,255,128);
  SpeechBubble.BackgroundTransparency = 33;
  SpeechBubble.PaddingTop = 5;
  SpeechBubble.PaddingBottom = 5;
  SpeechBubble.PaddingLeft = 15;
  SpeechBubble.PaddingRight = 15;


(You should probably do this in game_start() in GlobalScript.)

This module is still under development, and is currently missing some functionality (in particular support for background speech). Please report any bugs you experience.

The module is available on GitHub (https://github.com/messengerbag/SpeechBubble).

Download SpeechBubble v0.8.0 (https://github.com/messengerbag/SpeechBubble/releases/download/v0.8.0/SpeechBubble_0.8.0.scm)

Change Log:
0.8.0 (https://github.com/messengerbag/SpeechBubble/releases/download/v0.8.0/SpeechBubble_0.8.0.scm)
-Implemented Character.SayBackgroundBubble()
-Added SpeechBubble.DefaultGui property
-Fixed crash with characters that don't have a speech view set

0.7.6 (https://github.com/messengerbag/SpeechBubble/releases/download/v0.7.6/SpeechBubble_0.7.6.scm)
-Fixed an issue with lines with speech clips in text-only mode

0.7.5 (https://github.com/messengerbag/SpeechBubble/releases/download/v0.7.5/SpeechBubble_0.7.5.scm)
-Initial pre-release
Title: Re: Speech Bubble Module (v0.7.5)
Post by: CaptainD on Sun 03/12/2017 14:26:11
Thanks Snarky!

Definitely think I will be using this at some point.
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Bavolis on Sun 03/12/2017 14:31:55
Awesome! Definitely going to play with this one. Thank you! :)
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Crimson Wizard on Sun 03/12/2017 15:38:10
Finally someone did it :).


Although, Phylactere sounds so much nicer than Bubble, after all French is such a refined language, compared to the barbaric ones.
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Snarky on Sun 03/12/2017 18:41:00
Quote from: Crimson Wizard on Sun 03/12/2017 15:38:10
Although, Phylactere sounds so much nicer than Bubble, after all French is such a refined language, compared to the barbaric ones.

"Phylactere" always makes me think of "prophylactic". This module, in contrast, is 100% condom-free.
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Bavolis on Mon 04/12/2017 00:28:09
Everything's working very smoothly with only a couple of minor hiccups I'm trying to sort out. They may be on my end:

1. I have one cinematic scene where a floating head is in the middle of the screen. For some reason, it keeps shifting the SayBubble between above and below the character. I thought maybe it was a text length thing, but it puts some short ones on the bottom right next to long ones and then go back to the top for the next line. I don't seem to have any other characters with this problem. In the following example, all the SnipShadow lines play above his head, but cWinfillowFace alternates (but not in any kind of pattern) Here's what it looks like:

Code (ags) Select
function room_AfterFadeIn()
{
cWinfillowFace.SayBubble("&1 You'll have a much bigger name than that.");
cSnipShadow.SayBubble("&10 Gah! Spooky voice has a spooky face. Perfect.");
cWinfillowFace.SayBubble("&2 We have much to discuss.");
cSnipShadow.SayBubble("&11 Who are you? Are you me?");
cWinfillowFace.SayBubble("&3 No. You are me. Now listen...");
cWinfillowFace.SayBubble("&4 You must meet me at the peak of the Knobbly Crook.");
cSnipShadow.SayBubble("&12 Right. Sure.");
cSnipShadow.SayBubble("&13 Um. I'm just going to head back home now.");
cWinfillowFace.SayBubble("&5 O'Sirus the Could Have Been...");
cWinfillowFace.SayBubble("&6 O'Sirus the Never-Was...");
cWinfillowFace.SayBubble("&7 Both are apt names.");


2. The text displays fine when I've got voices turned on, but if I turn them off in the game options, the larger text boxes close way too fast, even if I set my game text speed to 1 (which should be 1 character per second, if I'm not mistaken. The default 15 closes extremely fast. I'm not sure if this is due to AGS 3.4 or this module.
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Snarky on Mon 04/12/2017 07:15:10
Quote from: Bavolis on Mon 04/12/2017 00:28:09
1. I have one cinematic scene where a floating head is in the middle of the screen. For some reason, it keeps shifting the SayBubble between above and below the character.

Thanks! I'll look into it.

It'd be helpful to have some more info:

-What is your game resolution, room resolution, and position of your characters during this dialog?
-In the dialog, which lines display in the wrong location?
-What SpeechBubble settings are you using?
-Have you changed SB_sayImpl() (or any other part of the module)?

Quote2. The text displays fine when I've got voices turned on, but if I turn them off in the game options, the larger text boxes close way too fast, even if I set my game text speed to 1 (which should be 1 character per second, if I'm not mistaken. The default 15 closes extremely fast. I'm not sure if this is due to AGS 3.4 or this module.

Ah yes. This is a known issue that is actually a bit difficult to solve properly. (It's because AGS relies on the speech clip length to determine how long to play spoken lines, so the module sends a line containing just the speech clip code and no text (because we're already displaying the speech bubble and don't want the text to appear twice) to Character.Say(). However, if speech is turned off, it falls back to using String length, and since the String is so short it goes away almost immediately.)

The easiest workaround is to set an invisible font (SpeechBubble.InvisibleFont). Here is one you can use: http://www.angelfire.com/pr/pgpf/if.html
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Mon 04/12/2017 21:00:54
I haven't been able to reproduce the first issue with the speech bubble positions. Maybe if I could get those details I asked for.

Quote from: Snarky on Mon 04/12/2017 07:15:10
Quote from: Bavolis on Mon 04/12/2017 00:28:092. The text displays fine when I've got voices turned on, but if I turn them off in the game options, the larger text boxes close way too fast, even if I set my game text speed to 1 (which should be 1 character per second, if I'm not mistaken. The default 15 closes extremely fast. I'm not sure if this is due to AGS 3.4 or this module.

Ah yes. This is a known issue that is actually a bit difficult to solve properly.

This turned out to be embarrassingly easy to fix, and the solution embarrassingly obvious. Updated in first post.
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Bavolis on Mon 04/12/2017 23:36:46
Great news on the first solution! Sorry, I've been at work all day, so just now getting to answer. Here are the details:

1024x768 is my game resolution and the room size.

These are the settings I changed (in the global script):

Code (ags) Select
  SpeechBubble.BorderColor = Game.GetColorFromRGB(255,255,255);
  SpeechBubble.BackgroundColor = Game.GetColorFromRGB(0,0,0);
  SpeechBubble.BackgroundTransparency = 20;
  SpeechBubble.PaddingTop = 8;
  SpeechBubble.PaddingBottom = 5;
  SpeechBubble.PaddingLeft = 15;
  SpeechBubble.PaddingRight = 15;


I didn't change any of the code outside of the global script settings.

The two speaking characters are at:

397, 752 <--working fine
552, 483  <--this is the one having problems. The character's top Y coordinate is at 185.

Line positions (Winfillow only because Snipshadow is working fine):

Code (ags) Select

cWinfillowFace.SayBubble("&1 You'll have a much bigger name than that."); <--BOTTOM
cWinfillowFace.SayBubble("&2 We have much to discuss.");<--TOP
cWinfillowFace.SayBubble("&3 No. You are me. Now listen..."); <--TOP
cWinfillowFace.SayBubble("&4 You must meet me at the peak of the Knobbly Crook."); <--BOTTOM
cWinfillowFace.SayBubble("&5 O'Sirus the Could Have Been...");<--TOP
cWinfillowFace.SayBubble("&6 O'Sirus the Never-Was..."); <--BOTTOM
cWinfillowFace.SayBubble("&7 Both are apt names."); <--BOTTOM
cWinfillowFace.SayBubble("&8 Horse."); <--TOP


I had some problem with the first room being corrupt and had to recreate it. If you don't see any reason for this bug, I can go ahead and redo this one too and see if that fixes it. This is my second oldest room that's gone through a few AGS updates.
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Dave Gilbert on Tue 05/12/2017 15:21:37
This is so cool! Is there any way to make these bubbles non-blocking?
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Tue 05/12/2017 15:39:28
Thanks Dave! I haven't implemented non-blocking speech yet, but it's next on my TODO list, after I figure out the bug Bavolis is experiencing.

Bavolis, please don't redo the room: I don't see any legitimate reason why it should screw up the module, and it's better to have a bug that can be reliably reproduced than one that we don't know how to trigger any more. Thanks for the additional details, BTW! I'll see if I can recreate the problem with a similar setup. If all else fails I might ask you to send me your project for me to test (or I could make a special debug version of the module for you that would help me nail down where it goes wrong).
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Bavolis on Wed 06/12/2017 02:11:12
Quote from: Snarky on Tue 05/12/2017 15:39:28
Bavolis, please don't redo the room:

I'll wait to see what you can find out - any way I can help, let me know. I thought maybe it was a screen position thing and tried moving the character all the way to the bottom of the screen and the bubble still appeared below him. It's worth pointing out that there's nothing complex going on in this room, too - it's just a straightforward cinematic with lots of says.

EDIT: Snarky solved my problem - it was due to a normal view being tiny when what was being displayed in the idle view was proper sized. It comes as no surprise that the issue was on my end, but I appreciate the troubleshooting to help me find my mistake!
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Wed 06/12/2017 20:15:28
Though it's worth noting that the SpeechBubble module behaves a little differently from AGS Character.Say() in this respect:

With Character.Say(), as near as I can tell, the text positioning is always based on the height of the (first frame in the) NormalView â€" unless it has been Locked to some other view â€" even if speech starts while an Idle view is playing. Character.SayBubble(), on the other hand, uses the current view at the time when speech starts, so if the idle animation is playing at that moment, it goes by the height of the Idle view. (I believe it can also be the SpeechView, if the character it already speaking.)

I can't see any way to determine whether the current view (if different from the NormalView) has been set with LockView() or is playing for some other reason, so I'm not sure it's possible to completely match the AGS behavior here.
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Bavolis on Sat 09/12/2017 05:41:43
Another small hiccup I'm having... if I have an inventory window open and look at an item, the saybubble appears behind the GUI(whereas the say function would appear in front of it). IS there a way to set an always in front priority? I don't see ever wanting to have the speech bubbles behind anything. Maybe it's already there and I missed it.
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Sat 09/12/2017 08:02:38
This is an AGS limitation (http://www.adventuregamestudio.co.uk/forums/index.php?topic=52049.0). It renders things in a certain order that cannot be changed, back-to-front:

-The room and Objects and Characters in it
-Overlays, including SayBackground() overlays
-GUIs
-The Say() Overlay (and as of 3.4.1, the speech portrait)
-The cursor

So only by using Say() will text always show up in front of the GUIs. (Personally I think it would be more logical for speech to display behind GUIs by default, but it is what it is. The best thing would be if we could manipulate the Z-order freely.) By default, the SpeechBubble module displays the speech bubbles on Overlays, so they'll appear behind any GUIs.

However, there is a way to work around that limitation: you can pass a GUI to SayBubble() as an optional argument, and the module will display the bubble on that GUI instead of on an overlay. (The GUI should be empty and set to a transparent background and border.) If you set the GUI.ZOrder property higher than any of your other GUIs, it will display on top.

Also, as a pro-tip, if want to always use that GUI and don't want to add the argument every time you call SayBubble(), you can edit the SayBubble() function in the module to add this line at the very top (should be line 967):

Code (ags) Select
  bubbleGui = gSpeechBubble; // Replace gSpeechBubble with the name of the GUI you want to use

(In an upcoming version I'll add a default-GUI property to the module so that you won't have to do this.)
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Loslem on Sat 09/12/2017 13:49:08
Really like that Module!

What would I have to do to make it wqork in the Tumbleweed Dialogues?

Greetings

Loslem
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Sat 09/12/2017 14:29:20
Thanks!

You mean this template (http://www.adventuregamestudio.co.uk/forums/index.php?topic=54762.0)? I haven't used it, but as far as I can tell it doesn't really change anything to do with speech, so you should be able to use both the Tumbleweed Verbs template and the SpeechBubble module at the same time without issue. So you just import the module into your game project. (Save the scm file to your computer, and from the AGS "Explore Project" pane, right-click on "Scripts" and choose "Import Script...")

To get the speech bubble effect, you have to call Character.SayBubble(). So you should put that wherever you had Character.Say() before (where Character is replaced by the name of some character, or the special player variable).

So instead of this:

Code (ags) Select
  cRoger.Say("It's a blue cup.");

You write this:

Code (ags) Select
  cRoger.SayBubble("It's a blue cup.");

In dialog scripts, you must use the command instead of the simple "name: line" format, and have to indent the line with spaces or tabs. So instead of this:

Code (ags) Select
player: What we have here is a failure to communicate.
Davy: What was that?


Put this (Notice that the lines start with two spaces):

Code (ags) Select
  player.SayBubble("What we have here is a failure to communicate");
  cDavy.SayBubble("What was that?");


There's not much more to it. Hope that answers your question!
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Loslem on Sat 09/12/2017 15:19:15
Ah right it workes! I tried putting the commands in the dialog before and I got an error, but that was because I used the Hologram character from the template, and it had no Talking view. Error was "SetCharacterView: invalid view number (You said 0, max is 10)"

So, Characters seem to need to have a talking view assigned. I don't know if that is of any help :)
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Sat 09/12/2017 16:00:32
Yeah, I just came across that issue as well. I've put in a check for it. Thanks!
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Bavolis on Sat 09/12/2017 23:15:06
Quote from: Snarky on Sat 09/12/2017 08:02:38

Also, as a pro-tip, if want to always use that GUI and don't want to add the argument every time you call SayBubble(), you can edit the SayBubble() function in the module to add this line at the very top (should be line 967):

(In an upcoming version I'll add a default-GUI property to the module so that you won't have to do this.)

Thanks for the quick help yet again!
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Dave Gilbert on Tue 12/12/2017 18:56:56
I just want to say that this module is FANTASTIC. It's too late in my game's production to use it for my own, but I will definitely look into it for the next one.
Title: Re: Speech Bubble Module (v0.7.6)
Post by: Snarky on Tue 12/12/2017 19:19:33
Thanks again, Dave! ;-D

I've forgotten to mention that bx83 hired me to develop this module for his upcoming game (and agreed to let it be made available to the AGS community), so he deserves the kudos for its existence. Check out his game when it's finished: from what I've seen it looks pretty slick!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sat 23/12/2017 12:06:26
Bump for latest update, v0.8.0 (https://github.com/messengerbag/SpeechBubble/releases/download/v0.8.0/SpeechBubble_0.8.0.scm):
-Implemented Character.SayBackgroundBubble() (as requested by Dave Gilbert (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55542.msg636576642#msg636576642))
-Added SpeechBubble.DefaultGui property (to address issue reported by Bavolis (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55542.msg636576896#msg636576896))
-Fixed crash with characters that don't have a speech view set (as reported by Loslem (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55542.msg636576930#msg636576930))
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: dayowlron on Wed 10/01/2018 14:53:07
This is a great module. I wanted think bubble to work also so I looked at how this was working and you had "//TODO" with no code for the thinkBubble function so I added the following code into the think bubble routine and it worked great.
It is basically calling the say bubble function but passing a false to the renderBubble32 function to change the tail.


// TODO
void ThinkBubble(this Character*, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...")
    this.SB_sayImpl(message);
  else
  {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, false);
    // Position bubble over character head
    int x = this.x - GetViewportX() - bubbleSprite.Width/2;
    x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
    int y = this.y - GetViewportY() - bubbleSprite.Height - this.GetHeight() - (_heightOverHead - _talkTailHeight + 1);
    y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);

    this.realSayAtBubble(x, y, message, bubbleGui, bubbleSprite);
  }

}



I also wanted the think bubble to be a different color so I set the _backgroundColor at the top of the function to a different color then set it back at the bottom of the function.

Snarky, if you add this to your module as an enhancement make it where there is another property for Think Background Color.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 10/01/2018 21:12:38
Thanks, dayowlron!

I'm glad you were able to get it to work for you. To fully implement the Think bubble I want to make sure it plays the character's think animation and otherwise behaves just like Character.Think(), which is a little different from Character.Say().

Quote from: dayowlron on Wed 10/01/2018 14:53:07
Snarky, if you add this to your module as an enhancement make it where there is another property for Think Background Color.

Good note, thanks!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Sun 14/01/2018 22:31:06
Hey! Finally playing around with this. I'm really digging it so far, but is there way to tell the module to NOT use a talking view for background speech? I use portrait view for all my characters and the module keeps changing the character sprite to the portrait. Thanks in advance! :)

edit: Aha! Nevermind. Figured it out. I do have another question. Is there a way to set the position of the background bubble? There is an option to set the position of the standard bubble, but not the background one.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Mon 15/01/2018 05:40:47
Quote from: Dave Gilbert on Sun 14/01/2018 22:31:06
Hey! Finally playing around with this. I'm really digging it so far, but is there way to tell the module to NOT use a talking view for background speech? I use portrait view for all my characters and the module keeps changing the character sprite to the portrait. Thanks in advance! :)

edit: Aha! Nevermind. Figured it out.

Presumably you passed false for the animate parameter? I think that should do the trick.

QuoteI do have another question. Is there a way to set the position of the background bubble? There is an option to set the position of the standard bubble, but not the background one.

No, not at the moment. I'm not happy with the bubble positioning logic overall (I particularly want to ensure that the tail is always positioned to point to the character, even when the bubble butts up against the side of the screen), and it's one part I really want to redo.

However, unless this is urgent I'll put it on pause for a bit to focus on the Awards Ceremony.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Loslem on Tue 13/02/2018 23:51:41
Hiho!

Okay I ran into another issue,

if one uses the Tumbleweed-Template(9-Verb GUI), you have to assign the Unhandled messages for all Verbs that aren't important for the hotspot e.g.

These are defined in the verbgui.asc.
I copied the chunk of code for the unhandled USE command (I altered one of the say commands, the other remained the same)

Code (ags) Select
  if (AGSCursorMode != eModeUsermode2 && type != 0) {
    if (type==2 || type==6) player.FaceCharacter(character[location_id], eBlock);

    // unhandled USE
    if (Verbs.UsedAction(eGA_Use)) {
      // use inv on inv
      if (type >= 5) player.Say("That won't do any good.");
      // use
      else player.SayBubble("I can't use that.");
    }


This is the Error I get:
verbgui.asc(1594): Error (line 1594): '.SayBubble' is not a public member of 'Character'. Are you sure you spelt it correctly (remember, capital letters are important)?

Any way to solve this? I don't know if it's interesting for anyone using the Verbs-GUI...

thanks in advance,

Loslem
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Wed 14/02/2018 00:14:55
Quote from: Loslem on Tue 13/02/2018 23:51:41
verbgui.asc(1594): Error (line 1594): '.SayBubble' is not a public member of 'Character'. Are you sure you spelt it correctly (remember, capital letters are important)?

Make sure that Bubble module is positioned above verbgui in the list of scripts. In AGS scripting scripts can only use functions and variables declared before them.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Loslem on Wed 14/02/2018 06:54:32
Sometimes I'm embarrassed by my problems :D
Thanks Wizard!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on Sat 17/02/2018 20:41:59
Great module.

I'm having 2 issues, one blocking:

1) for some reason, the actual text is rendered 100% transparent. So I can see the layout of the text, and through it the background ! I copy pasted your settings into game start at global, and the ballons are updated, but the font keeps being transparent (using player.say works perfectly, so not sure what's going on).

2) This is probably something that needs to be implemented. I have scrolling backgrounds, and I can move the character while he is saying something (like LucasArts games), but the balloon is pinned to its current location, is there a way to make the balloon follow the character around ?

Thanks
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sat 17/02/2018 21:20:03
Quote from: DarkMoe on Sat 17/02/2018 20:41:59
Great module.

I'm having 2 issues, one blocking:

1) for some reason, the actual text is rendered 100% transparent. So I can see the layout of the text, and through it the background ! I copy pasted your settings into game start at global, and the ballons are updated, but the font keeps being transparent (using player.say works perfectly, so not sure what's going on).

That sounds like this problem (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55713.0). Probably some game setting isn't set to the right value: Color depth should be 32-bit, sprite and GUI alpha modes should be set to proper alpha blending.

Quote2) This is probably something that needs to be implemented. I have scrolling backgrounds, and I can move the character while he is saying something (like LucasArts games), but the balloon is pinned to its current location, is there a way to make the balloon follow the character around ?

Yeah, this is something that isn't implemented. What you can do for now is provide a GUI as an argument to SayBackgroundBubble(), and then in repeatedly_execute() move that GUI depending on the position of the character.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on Sat 17/02/2018 21:49:11
Proper alpha blending fixed it, had it as classic before for some reason. Thanks !

Will try to work it out, and also to change the shape of the globe and position. Will come back if I fail
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Loslem on Mon 19/02/2018 22:13:35
Hi! It's mee again, still finfing and not understanding Errors while using the Module with the Tumbleweeds-Template (Hooray for me!)

Okay, so you all know that there are these Unhandled Events in the Template. Looks like this:

Code (ags) Select

// unhandled LOOK AT 
    else if (Verbs.UsedAction(eGA_LookAt)) {
      // look at hotspots, objects etc.
      if (type!=2) player.Say("Nice %s", locationname);
      // look at characters
      else player.Say("It's %s",locationname);
    }


So, I tried to alter that to this:

Code (ags) Select

    // unhandled LOOK AT 
    else if (Verbs.UsedAction(eGA_LookAt)) {
      // look at hotspots, objects etc.
      if (type!=2) player.SayBubble("Nice %s", locationname);
      // look at characters
      else player.Say("It's %s",locationname);
    }


I get this Error for the change:
verbgui.asc(1600): Error (line 1600): Type mismatch: cannot convert 'String' to 'GUI'

It works for Uhandled events that dont Mention the Thing you clicked at

Code (ags) Select

if (door_script == 1) player.SayBubble("It is already open.");
// THIS WILL WORK
else if (type ==2) player.SayBubble("%s would not like it.",locationname);
// THIS WON'T


You think there's a solution for this?

Thanks for reading,

Loslem
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Mon 19/02/2018 22:31:04
SayBubble() doesn't support inline text-replacement using tokens like %s. This is an AGS limitation. What you'll have to do is to use String.Format() to insert those arguments, like so:

Code (ags) Select
player.SayBubble(String.Format("Nice %s", locationname));
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on Tue 20/02/2018 01:36:00
Ive been playing with the library code for 4 hours now, I cannot think anymore.

Is there a way to change the font color in mid dialogue ? In case its not possible, any lead on a possible fix/hack ?

Thank you for your help
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 20/02/2018 05:46:42
You mean in the same line of dialog, on the same speech bubble, change the font so that some words are in one font and other words in a different font?

That is not a supported feature.

The only way I know to do that is to use SSH's old hypertext module (http://www.adventuregamestudio.co.uk/forums/index.php?topic=29358) (and when I say old, I mean it was last updated 10 years ago, so I have no idea how well it works in the current AGS version). There's a working link in this thread (http://www.adventuregamestudio.co.uk/forums/index.php?topic=53823.0).
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Loslem on Tue 20/02/2018 07:03:12
Quote from: Snarky on Mon 19/02/2018 22:31:04
SayBubble() doesn't support inline text-replacement using tokens like %s. This is an AGS limitation. What you'll have to do is to use String.Format() to insert those arguments, like so:

Code (ags) Select
player.SayBubble(String.Format("Nice %s", locationname));


Thanks so much! I would habe never figured that out!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on Wed 21/02/2018 01:55:07
Ill try that plugin, hopefully theres some kind of way to hack the colors
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on Fri 23/02/2018 01:27:01
Wasted hours and hours, that plugin is a disaster in the current version, completely incompatible.

Do you think theres a way to include changing colors mid dialogue somehow ? I may need a lead to start developing that into the module directly.

Also, I tried to change the height and width of the tail of the baloon, but couldnt do it (also, to flip it depending on which way the character is facing). Any help ?

Thank you very much
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 23/02/2018 06:44:29
All development of this module is on hold while I'm working on the AGS Awards Ceremony client.

To do text in multiple colors you have to break it up into separate strings that you render individually (using DrawingSurface.DrawString()), with the appropriate x and y offsets. There's an outline of how you might do it here (http://www.adventuregamestudio.co.uk/forums/index.php?topic=53523.msg636535305#msg636535305).

To see how you're meant to be changing the tail, check out this post (http://www.adventuregamestudio.co.uk/forums/index.php?topic=55687.msg636579286#msg636579286). Unfortunately there's a bug in the module which means you have to edit the internal initSpeechBubble() function instead, as shown in the post above.

The tail flipping depending on character angle is a feature I've been meaning to add, but it's not implemented. Basically, in renderBubble32() there are two calls to drawPixelArray(). The last two arguments are whether to flip the array horizontally or vertically, and both are set to false. If you set the second-to-last to true in both calls, it will flip it. So I would add a bool argument to renderBubble32(), and pass that along to drawPixelArray(). Then in the calls to renderBubble32() in realSayAtBubble(), SayBubble() and SayBackgroundBubble() you would set the argument depending on which way the character is facing.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Narehop on Wed 07/03/2018 19:04:32
How i can to set a custom background?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 08/03/2018 21:45:19
You can set a background color with SpeechBubble.BackgroundColor. You cannot set a background graphic.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Narehop on Sun 01/04/2018 19:07:19
Quote from: Snarky on Thu 08/03/2018 21:45:19
You can set a background color with SpeechBubble.BackgroundColor. You cannot set a background graphic.

you'll be update with this option?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sun 01/04/2018 22:58:20
Sure, when I find time to work on it. I think TotalLipSync is first in line for an update, though.
Title: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 27/06/2018 08:13:17
Snarky, can you give us an ETA on 'ThinkBubble' function?
I would guess you just run speechbubble, but with 1 parameter change: to display the 3 bubbles going to the rounded corner box, instead of the angled-line going from the round corner box.
Title: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 27/06/2018 08:26:21
Too late, I wrote some shitty poorly tested code! :P

This is the same code as SayBubble, but with one parameter change (from true to false) on line 10:

void ThinkBubble(this Character*, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...")
    this.SB_sayImpl(message);
  else
  {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, false);  //<--- SETTING THIS TO FALSE WAS ALL I HAD TO DO
    // Position bubble over character head
    int x = this.x - GetViewportX() - bubbleSprite.Width/2;
    x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
    int y = this.y - GetViewportY() - bubbleSprite.Height - this.GetHeight() - (_heightOverHead - _talkTailHeight + 1);
    y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);

    this.realSayAtBubble(x, y, message, bubbleGui, bubbleSprite);
  }
}
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 27/06/2018 09:20:15
Quote from: bx83 on Wed 27/06/2018 08:13:17
Snarky, can you give us an ETA on 'ThinkBubble' function?

Well, it's part of the API I outlined when you contracted me to develop this module, so if you really need it I will make it a priority.

Quote from: bx83 on Wed 27/06/2018 08:13:17
I would guess you just run speechbubble, but with 1 parameter change: to display the 3 bubbles going to the rounded corner box, instead of the angled-line going from the round corner box.

There's a little bit more to it than that if it's to work fully like AGS's Character.Think(), but a simple version shouldn't be too hard.

The main work is to complete and test the 8.9 rewrite (http://www.adventuregamestudio.co.uk/forums/index.php?topic=56121.msg636585590#msg636585590), since I don't want to maintain two entirely separate branches going forward.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 27/06/2018 11:20:16
My code works, but perhaps not in all situations.
All good, I'm happy with it so far, take your time :)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Ray on Tue 24/07/2018 00:01:17
Thank you very much! Definitely will see to use this module in my game :)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bulka_tarta on Tue 20/11/2018 11:14:32
Hey! I really like this module, but I have a small hiccup with it recently. Occasionally, the dialogue skips lines waaaay too fast and it's very frustrating. Because it happens only every now and then, it's hard to determine why and when it occurs. I was wondering if anyone else has this issue, or if I messed something up at some stage.

In general settings I've set "Allow speech to be skipped by which events" to Mouse or keyboard. I've tried setting Game.IgnoreUserInputAfterTextTimeoutMs to ridiculous values, but it doesn't change anything. I also played around with some values in the module itself but to no avail.

The only settings I changed for the dialogues are below, although I highly doubt they would have an impact on skipping the lines since they're purely aesthetic changes.
Code (ags) Select

  // Lowers the dialog options a little bit
  game.dialog_options_x = 10;
  game.dialog_options_y = 10;
  // Changes the colour of highlighted dialogue option
  game.dialog_options_highlight_color = 19695;
  // Edit the Speech Bubble Module
  SpeechBubble.BorderColor = Game.GetColorFromRGB(10,12,14);
  SpeechBubble.BackgroundColor = Game.GetColorFromRGB(10,12,14);
  SpeechBubble.BackgroundTransparency = 0;
  SpeechBubble.PaddingTop = 8;
  SpeechBubble.PaddingBottom = 8;
  SpeechBubble.PaddingLeft = 8;
  SpeechBubble.PaddingRight = 8;
  SpeechBubble.MaxTextWidth = 230;
  SpeechBubble.CornerRoundingRadius = 0;
  SpeechBubble.HeightOverHead = 8;
  SpeechBubble.TextAlign = eAlignCentre;


The only other thing I've changed in the module is this:
Code (ags) Select

bool animateSpeech(this Character*, String message)
{
  if(this.Moving)
    this.StopMoving();
 
  if(this.SpeechView > 0)
  {
    this.LockView(this.SpeechView);
    if(Game.GetFrameCountForLoop(this.SpeechView, this.Loop) > 1)
      this.Animate(this.Loop, this.SpeechAnimationDelay, eRepeat, eNoBlock, eForwards);
  }
 
  int speechDuration = calculateDuration(message);
  if(BlockSpeech(speechDuration, true) == eBlockTimeOut)
  {
    //this.UnlockView();                          <---------------------- Commented this out
    int speechPause = calculateSpeechPause();
    return (BlockSpeech(speechPause, false) != eBlockTimeOut);
  }
  else
  {
    //this.UnlockView();                          <---------------------- Commented this out
    return false;
  }
}

When the above wasn't commented out, the characters would keep unlocking the view, so they always went back to idle/talking view when new line of dialogue appeared, so I couldn't get characters to talk while in a special animation (someone sitting on the ground and talking for example). Still, I don't think this would impact skipping the dialogue?

I'm using v0.8.0.

I'm really stuck with this issue and I'm not sure if this is AGS thing or the module or if there could be something else affecting the dialogues. If anyone has any ideas how to go about fixing the dialogue skipping problem, please let me know! Many thanks.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 20/11/2018 19:18:39
Yes, I noticed this when I tested your game. ;)

I'm fairly sure it's a problem with the custom blocking script. I don't have time to look into it right now, but you should try setting a transparent font. That will bypass all the custom blocking code and rely on the normal AGS speech blocking instead.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bulka_tarta on Wed 21/11/2018 11:11:35
You've given me quite a lot of feedback, so my Trello board is now full of things to change/fix/improve! (laugh)

I followed the instructions on the lip sync found in the Header of the script to find out how to set this up:
Code (ags) Select

  /*
  Note that to get text-based lip sync to work, you need to provide an invisible font,
  and set the SpeechBubble.InvisibleFont property accordingly. You may download one here:
                                                                                         
  http://www.angelfire.com/pr/pgpf/if.html
  */


After importing the font to AGS I simply added this to game_start()
Code (ags) Select
SpeechBubble.InvisibleFont = eFontInvisibleFont;

After some testing I didn't (yet) notice any line skipping, but I might have been just (un)lucky. There is definitely a noticeable change to the dialogue though. Before I've set the invisible font, you could have held down the left mouse button and the dialogue would skip automatically after around one second on each line. After setting the invisible font, nothing happens when you hold down the LMB, so hopefully things will be fixed now.

Is this all there is to it or did I miss something big time? It looks suspiciously too simple to bypass the custom blocking code. Thank you for the response!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 21/11/2018 11:21:10
No, that's all there is to it.

If it works for you, great! If not... I'm not sure when I'll have time to look into it, I'm afraid. Others have had problems related to the same part of the code, but I don't have any immediate ideas about what the problem might be. The ideal solution would be to extend the AGS Wait() API to cover all the cases you need for dialogue blocking.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bulka_tarta on Thu 22/11/2018 07:06:58
Great! Thank you for the help!

I will let you know if the problem persists. It's just hard to tell straight away.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Creamy on Sat 01/12/2018 20:52:26
Hi Snarky,

Great module you have here.
It's easy to set up and works like a charm...except for one room where my game crashes:

QuoteError: ScriptOverlay::Remove: overlay is not there

EDIT: nevermind, I've figured it out. If you change room before the bubble has disappeared, the game will crash as soon as you call Saybubble in the next room.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Sun 28/07/2019 03:06:08
I'm having trouble with line 3:


int calculateDefaultTextWidth(Character* c)
{
  int w = System.ViewportWidth * 2/3;
  if(c.x - GetViewportX() <= System.ViewportWidth/4 || c.x - GetViewportX() >= System.ViewportWidth * 3/4)
    w -= System.ViewportWidth/5;
  return w;
}


error is: SpeechBubble_0.8.0.asc(1059): Error (line 1059): '.ViewportWidth' is not a public member of 'System'.

This is with AGS 3.5.0b5
Making a new version for this AGS?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Sun 28/07/2019 06:22:47
Okay well I replaced everything it couldn't understand with Screen.Viewport.Width/Height/X/Y/etc. but now the speech bubbles just don't come up :/
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Laura Hunt on Sun 28/07/2019 07:02:59
In 3.5.0, Viewport is replaced with Camera. Try replacing all instances of "Viewport" with "Camera" and see what happens. You'll  need to keep an eye out for differences such as using Camera.Height instead of ViewportHeight and stuff like that...

Crimson Wizard also gave me these links for documentation of these new features:

https://github.com/adventuregamestudio/ags-manual/wiki/Camera

https://github.com/adventuregamestudio/ags-manual/wiki/Viewport
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Sun 28/07/2019 09:14:45
It's much easier to enable old functions in General Settings: set "Script compatibility level" to 3.4.1
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Sun 28/07/2019 09:33:49
Will this slow it down, have the old compiler etc. and basically be like using 3.4.1?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Sun 28/07/2019 10:04:24
Quote from: bx83 on Sun 28/07/2019 09:33:49
Will this slow it down, have the old compiler etc. and basically be like using 3.4.1?

It simply enables old script commands. They are hidden but still there.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Sun 18/08/2019 11:31:35
Cool, got it, changed and works.

I have a question for Snarky (or anyone if they know the answer).
SpeechBubble has a border of custom thickness and colour to text in the speech bubble. How do I do this elsewhere in the game?
I have an item description as a GUI with a label containig '@OVERHOTSPOT@', positioned at the top-centre of screen. How can I make this text with a 2px thickness black border, just as text in SpeechBubble?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sun 18/08/2019 11:42:01
SpeechBubble uses custom code to draw the outline (the function drawStringWrappedOutline()). To get this effect elsewhere in the game you would have to copy that code and draw the text yourself onto a dynamic sprite (shown as an overlay, GUI, etc.).

The AGS devs are currently working on incorporating something similar into the engine, but I'm not sure whether that covers all text or only speech.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: fernewelten on Sun 18/08/2019 19:54:18
Quote from: bx83 on Sun 18/08/2019 11:31:35
… colour to text in the speech bubble. How do I do this elsewhere in the game?

As concerns the colour of the outline in standard AGS without modules, see game.text_shadow_color (look for "game. variables" in the index of the online doc). You'll need to set the variable immediately before the  Say() or  Display() or whatever command and reset it immediately afterwards because this variable pertains to all outlines -- keep it at a certain value and the outlines will be coloured that way everywhere.

For my recent game Mamma mia Winter Ice Cream Mayhem (https://www.adventuregamestudio.co.uk/site/games/game/2359/), I've patched the Engine at the same place that the new code for variable outline thickness is going to go. I got thick outlines in the status line, too. So I think that the thick outlines will come everywhere, not only in Say().
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Tue 20/08/2019 02:28:24
To be clear, I mean the black colour around the font (the Stroke, for any photoshop aficionados), that fits the front perfectly like tight fitting clothing, not the rounded square frame around the speech bubble. Does anyone know which functions constitute this in speechbubble?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 20/08/2019 07:00:41
Like I said, drawStringWrappedOutline().
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 21/08/2019 03:34:45
Okay, I've attempted to copy this function (now called oulinedMessage) from speechbubble, and transplant my own outlineDrawStringWrappedAA into the function:

I've reduced the number of arguments, and supplanted default values hard-coded - these items will never change:

GlobalScript.asc

// Draw a string with outline (make sure the canvas has at least outlineWidth pixels on each side of the string)
function outlinedMessage(this DrawingSurface*, int x, int y, int width, String message)
{
 
  // This is what we draw on (because we might need to copy with transparency)
  DynamicSprite* outlineSprite = DynamicSprite.Create(this.Width, this.Height, true);
  DrawingSurface* outlineSurface = outlineSprite.GetDrawingSurface();
 
  // This holds multiple horizontal copies of the text
  // We copy it multiple times (shifted vertically) onto the outlineSprite to create the outline
  DynamicSprite* outlineStripSprite = DynamicSprite.Create(this.Width, this.Height, true);
  DrawingSurface* outlineStripSurface = outlineStripSprite.GetDrawingSurface();
 
  // This is our "text stamp" that we use to draw the outline, we copy it onto outlineStripSprite
  DynamicSprite* textSprite = DynamicSprite.Create(this.Width, this.Height, true);
  DrawingSurface* textSurface = textSprite.GetDrawingSurface();
 
  // Draw our text stamp
  textSurface.DrawingColor = 682;
  textSurface.DrawStringWrapped(x, y, width, 1, 2, message);
  textSurface.Release();
 
  // Draw Circular outline
  int maxSquare = 2*2+1; // Add 1 for rounding purposes, to avoid "pointy corners"
  int maxWidth = 0;
  outlineStripSurface.DrawImage(0, 0, textSprite.Graphic);
 
  // We loop from top and bottom to the middle, making the outline wider and wider, to form circular outline
  for(int i = 2; i > 0; i--)
  {
    // Here's the circular calculation...
    while(i*i + maxWidth*maxWidth <= maxSquare)
    {
      // Increase width of the outline if necessary
      maxWidth++;
      outlineStripSurface.DrawImage(-maxWidth, 0, textSprite.Graphic);
      outlineStripSurface.DrawImage(maxWidth, 0, textSprite.Graphic);
      outlineStripSurface.Release();
      outlineStripSurface = outlineStripSprite.GetDrawingSurface();
    }
    // Draw outline strip above and below
    outlineSurface.DrawImage(0, -i, outlineStripSprite.Graphic);
    outlineSurface.DrawImage(0, i, outlineStripSprite.Graphic);
  }
  // Finally the middle strip
  outlineSurface.DrawImage(0, 0, outlineStripSprite.Graphic);
 
  textSprite.Delete();
  outlineStripSurface.Release();
  outlineStripSprite.Delete();
 
  /// Now draw the text itself on top of the outline
  outlineSurface.DrawingColor = this.DrawingColor;
 
  //BEGIN OUTLINE DRAW STRING WRAPPED AA
 
  DynamicSprite* atextSprite = DynamicSprite.Create(this.Width, this.Height, true);
  DrawingSurface* atextSurface = atextSprite.GetDrawingSurface();
  atextSurface.DrawingColor = this.DrawingColor;
  atextSurface.DrawStringWrapped(x, y, width, 1, 2, message);
  atextSurface.Release();
  this.DrawImage(0, 0, atextSprite.Graphic, 0);
  atextSprite.Delete();
 
  //END OUTLINE DRAW STRING WRAPPED AA
 
  outlineSurface.Release();
  // ... And copy it onto our canvas
  this.DrawImage(100, 100, outlineSprite.Graphic, 0);
  outlineSprite.Delete();
}


GlobalScript.ash:

import function outlinedMessage(this DrawingSurface*, int x, int y, int width, String message);


in room2.asc:

function room_AfterFadeIn()
{
  ...

  outlinedMessage(100, 100, 100, "checking this out");
}


But I get the error:
Failed to save room room2.crm; details below
room2.asc(5): Error (line 5): Undefined token 'outlinedMessage'

oulinedMessage() is at the top of GlobalScript.asc
The definition is at the top of the function definitions in GlobalScript.ash (after some #define's and enums)

...wtf has happened? It must be something incredibly obvious, but I can't see how room2 can't see GlobalScript.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 21/08/2019 06:37:31
Well, that's because it's a "this" extender function, which has to be called on a DrawingSurface.

I'll take a look at adapting it to your needs.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sat 24/08/2019 16:33:33
OK, here you go:

Keep drawStringWrapped() as it is. Just add this line to SpeechBubble.ash so you can call it from outside the module:

Code (ags) Select
import void drawStringWrappedOutline(this DrawingSurface*, int x, int y, int width, TextOutlineStyle outlineStyle, FontType font,  Alignment alignment, String message, int transparency, int outlineColor, int outlineWidth);

Create a GUI that will display the mouseover text. It should be empty, without anything on it. Set the size and position to fit any text it will display. Make the background and border transparent, and make sure it's not clickable. I've named mine gFloatingText, but you can use any name.

Add this code to the script of the module that handles your UI, or as its own module:

Code (ags) Select
// Replace these values with whatever you want
#define FLOATING_TEXT_GUI gFloatingText
#define FLOATING_TEXT_FONT eFontfntSpeech
#define FLOATING_TEXT_OUTLINE_WIDTH 3
#define FLOATING_TEXT_COLOR 11
#define FLOATING_TEXT_OUTLINE_COLOR 0

String textContent;
DynamicSprite* sprtFloatingText;

void SetFloatingText(String floatingText)
{
  if(textContent == null)
    textContent = "";
  if(floatingText != textContent)
  {
    textContent = floatingText;
    if(sprtFloatingText == null)
      sprtFloatingText = DynamicSprite.Create(FLOATING_TEXT_GUI.Width, FLOATING_TEXT_GUI.Height, true);
    DrawingSurface* dsFloatingText = sprtFloatingText.GetDrawingSurface();
    dsFloatingText.Clear(COLOR_TRANSPARENT);
    if(!String.IsNullOrEmpty(textContent))
    {
      dsFloatingText.DrawingColor = FLOATING_TEXT_COLOR;
      dsFloatingText.drawStringWrappedOutline(FLOATING_TEXT_OUTLINE_WIDTH,
                                              FLOATING_TEXT_OUTLINE_WIDTH,
                                              FLOATING_TEXT_GUI.Width - 2*FLOATING_TEXT_OUTLINE_WIDTH,
                                              eTextOutlineRounded,
                                              FLOATING_TEXT_FONT,
                                              eAlignCentre,
                                              textContent,
                                              0,
                                              FLOATING_TEXT_OUTLINE_COLOR,
                                              FLOATING_TEXT_OUTLINE_WIDTH);
    }
    dsFloatingText.Release();
    FLOATING_TEXT_GUI.BackgroundGraphic = sprtFloatingText.Graphic;
  }
}


Now whenever you want to set the content of this "label" you just call SetFloatingText(). I'm not sure you can use the @OVERHOTSPOT@ symbol (actually, I'm pretty sure it won't work), but you can use Game.GetLocationName(mouse.x,mouse.y) in repeatedly_execute() â€" see the TwoClickHandler template for an example.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Mon 26/08/2019 01:21:07
Imported it all into global script/header. Set defines in header, put first 2 variables (line 3 and 4 in GlobalScript.asc) in function.
Works, compiles.

Does the GUI have an actual label control in it, or you're just referring to the whole thing as a label?

Also changed #define FLOATING_TEXT_FONT eFontfntSpeech from line 5 to eFontSpeech - this way it compiles. Correct usage? Otherwise it won't compile.

GetLocationName(mouse.x, mouse.y) gets a location's (Hotspot, Object, etc.) 'Description' (in the editor, in Properties window, under Appearance)?


Here's what I have:

GlobalScript.ash

//for gFloatingText 'description of what mouse is over'
...
//for gFloatingText 'description of what mouse is over'
#define FLOATING_TEXT_GUI gFloatingText
#define FLOATING_TEXT_FONT eFontSpeech
#define FLOATING_TEXT_OUTLINE_WIDTH 2
#define FLOATING_TEXT_COLOR 49664
#define FLOATING_TEXT_OUTLINE_COLOR 0
import function SetFloatingText(String floatingText);
import void drawStringWrappedOutline(this DrawingSurface*, int x, int y, int width, TextOutlineStyle outlineStyle, FontType font,  Alignment alignment, String message, int transparency, int outlineColor, int outlineWidth);
...


GlobalScript.asc

function SetFloatingText(String floatingText)
{
  String textContent;
  DynamicSprite* sprtFloatingText;
 
  if(textContent == null)
    textContent = "";
  if(floatingText != textContent)
  {
    textContent = floatingText;
    if(sprtFloatingText == null)
      sprtFloatingText = DynamicSprite.Create(FLOATING_TEXT_GUI.Width, FLOATING_TEXT_GUI.Height, true);
    DrawingSurface* dsFloatingText = sprtFloatingText.GetDrawingSurface();
    dsFloatingText.Clear(COLOR_TRANSPARENT);
    if(!String.IsNullOrEmpty(textContent))
    {
      dsFloatingText.DrawingColor = FLOATING_TEXT_COLOR;
      dsFloatingText.drawStringWrappedOutline(FLOATING_TEXT_OUTLINE_WIDTH,
                                              FLOATING_TEXT_OUTLINE_WIDTH,
                                              FLOATING_TEXT_GUI.Width - 2*FLOATING_TEXT_OUTLINE_WIDTH,
                                              eTextOutlineRounded,
                                              FLOATING_TEXT_FONT,
                                              eAlignCentre,
                                              textContent,
                                              0,
                                              FLOATING_TEXT_OUTLINE_COLOR,
                                              FLOATING_TEXT_OUTLINE_WIDTH);
    }
    dsFloatingText.Release();
    FLOATING_TEXT_GUI.BackgroundGraphic = sprtFloatingText.Graphic;
  }
}

...

function repeatedly_execute_always()
{
  if (Game.GetLocationName(mouse.x, mouse.y)!=null) {
    SetFloatingText(Game.GetLocationName(mouse.x, mouse.y));
  }
}



Surprise, due to something in my implementation of your function in my own code, the floating text doesn't appear. Putting cursor over trees, cave, quicksand etc. doesn't come up with anything - but this Hotspots are supposed to have descriptive Descriptions.
BUT it does come up for object->lookat, and also for speech (so far) - just a copy of the speechbubble.

Video:
https://bluekeystudios.com/img/floatingtext1.mp4

Note: When I change the text of the function to THIS (lines 5 and 6):


...
    if(!String.IsNullOrEmpty(textContent))
    {
      dsFloatingText.DrawingColor = FLOATING_TEXT_COLOR;
      dsFloatingText.drawStringWrappedOutline(683,    //1366/2 pixels left - dead centre
                                              15,     //15 pixels down
                                              FLOATING_TEXT_GUI.Width - 2*FLOATING_TEXT_OUTLINE_WIDTH,
                                              eTextOutlineRounded,
                                              FLOATING_TEXT_FONT,
                                              eAlignCentre,
                                              textContent,
                                              0,
                                              FLOATING_TEXT_OUTLINE_COLOR,
                                              FLOATING_TEXT_OUTLINE_WIDTH);
    }
    dsFloatingText.Release();
...


to try and position the floating text in the dead centre, the first error is gone, though now it's copying part of the DyanmicSprite for the custom dialogue functions:

https://bluekeystudios.com/img/floatingtext2.mp4


....SO it's a bug in the dynamic sprite used in SetFloatingText(), OR I've just gone and ruined the implementation of your code :D
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Mon 26/08/2019 06:39:36
Quote from: bx83 on Mon 26/08/2019 01:21:07
Does the GUI have an actual label control in it, or you're just referring to the whole thing as a label?

No, it should be empty. The text is drawn onto the GUI background image.

Quote from: bx83 on Mon 26/08/2019 01:21:07
Also changed #define FLOATING_TEXT_FONT eFontfntSpeech from line 5 to eFontSpeech - this way it compiles. Correct usage? Otherwise it won't compile.

Yes, you have to use whatever font name you have set up in the game, of course.

Quote from: bx83 on Mon 26/08/2019 01:21:07
GetLocationName(mouse.x, mouse.y) gets a location's (Hotspot, Object, etc.) 'Description' (in the editor, in Properties window, under Appearance)?

Correct. One of AGS's little naming inconsistencies.

The reason it's not showing up is that you've put these lines…

Code (ags) Select
String textContent;
DynamicSprite* sprtFloatingText;


… inside of the SetFloatingText() function. They need to be outside of it, so that the variables persist between function calls. That's why I put them outside.

I think that's also why it shows a copy of the SpeechBubble text: right after the SetFloatingText() DynamicSprite gets destroyed, SpeechBubble creates another one, so that gets the same sprite index, which the GUI background has been set to.

Oh, and also, you shouldn't mess with the positioning code. It's set to be centered and top-aligned within the GUI (with margins just wide enough to fit the outline): You're then shifting it half a screen right, which means it'll show up centered around the right edge of the screen. If you want to move the text, you should either choose a different alignment, or simply reposition/resize the GUI it appears on (e.g. moving it 15 pixels down). If the text may sometimes wrap over multiple lines and you want them bottom-aligned, that would require additional logic.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Mon 26/08/2019 08:43:24
Turned the two variables to globals.
Thank you, it works :)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Mon 26/08/2019 12:51:49
Glad you got it working!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Mon 10/02/2020 01:22:02
I'm using speechbubble 0.8.0

I'm trying to work out an equation that will display the speech bubbles above my characters head for SayAtBubble(), changed for scaling of the area (for example, 40pixels at 100%, 20pixels at 50%)

x axis is already sorted.

But the y axis keeps being out a bit depending on scaling. Looks good for 50%, too low at 5%, too high at 100%, etc. even though it's altered for scaling. The 'scaling point' moves slightly, when it should be fixed for all scaling.

Here's my equation. What am I doing wrong?


function cJulius_spk(String msg)
{
  cJulius.SayAtBubble(cJulius.x, cJulius.y - (FloatToInt( (460.0/100.0)*IntToFloat(cJulius.Scaling) )), msg);
}


Where msg is the message eg. "&123 I am a characters."
The 460.0 is my constant distance above Julius's head. His frames very high, so unless I set it manually, it's way above his head all the time.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Tue 11/02/2020 00:55:00
Don't worry, I solved it with this dandy piece of code.... which is just part of speechbubble copied and hardcoded, because I can't figure out how to get access to it's function renderbubble32():



function cJulius_spk(String msg)
{
  // Calculate text dimensions
  int textWidth = -1;

  int w = System.ViewportWidth * 2/3;
  if(cJulius.x - GetViewportX() <= System.ViewportWidth/4 || cJulius.x - GetViewportX() >= System.ViewportWidth * 3/4) {
    w -= System.ViewportWidth/5;
  }
  textWidth=w;

  if(textWidth < (System.ViewportWidth - 40)) {
    textWidth=textWidth;
  } else {
    textWidth=System.ViewportWidth - 40;
  }
 
  int textHeight = GetTextHeight(msg, 1, textWidth);
 
  int cut = textWidth;
  int height = textHeight;
  while(cut>1) {
    cut = (cut+1) >> 1; // Subtract half as much as we tried last time, rounding up
    height = GetTextHeight(msg, 1, textWidth - cut);
    if(height == textHeight) {
      textWidth -= cut;
    }
  }
  height = GetTextHeight(msg, 1, textWidth-1);
  if(height == textHeight) {
    textWidth=textWidth-1;
  } else {
    textWidth=textWidth;
  }

  int totalWidth = textWidth + 20 + 20;
  int bubbleHeight = textHeight + 10 + 10;
  int totalHeight;
  totalHeight = bubbleHeight + 9;

  SpeechBubbleHeight_blr=totalHeight;//BLR

  int headHeight=355;     //constant
  int spaceAboveHead=15;  //constant

  float h=IntToFloat( SpeechBubbleHeight_blr ); //constant
  float f=( (IntToFloat(headHeight+spaceAboveHead)/100.0)*IntToFloat(cJulius.Scaling) ) + h;

  cJulius.SayAtBubble(cJulius.x, cJulius.y - FloatToInt(f), msg);
}
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: daneeca on Fri 13/03/2020 21:55:09
This module is fantastic! Is it possible to make it work with QueuedSpeech module? And is there an easy way to change all "Say" command to "SayBubble"?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sat 14/03/2020 07:18:48
Thanks! Glad you find it useful.

I think it's more a matter of getting QueuedSpeech to work with this module (by calling SayBackgroundBubble() instead of SayBackground()).

To quickly replace all Say() calls with SayBubble() calls you can use Edit|Replace All… (Ctrl-Shift-E), but you have to be careful that it only changes those calls, not any string that includes "say", and only where you want it to (for example, not in the module itself). If you replace ".Say(" by ".SayBubble(" with Case Sensitive on, one script at a time, you should be relatively safe.

AGS 3.5 also has a new feature where you can designate a custom function to use instead of Say() in dialogs.
Title: How do I stop speech bubbles/samples being interrupted?
Post by: bx83 on Tue 24/03/2020 10:06:17
What I want to happen:
1. Buddhist speaks, speech bubble appears
2. The sound sample 1 is over; delete this speech bubble, and create the second one; start the second bit of speech
3. When that's over, delete speechbubble, speech sample 2 has obviously stopped because it's non-blocking
4. Fade out screen

What *actually* happens:
1. Buddhist speaks speech sample 1, speech bubble appears
2. Speech bubble stops halfway through this first speech sample, second bubble appears
3. Speech sample 1 eventually ends, speech samples 2 starts
4. Speech sample 2 stops early, both speech sample and speech bubble disappear
5. Screen fades out

I'm using SpeechBubble8.0.

What's going on here? The speech bubbles are obviously ending early because they estimate a shorter amount of time to read the bubble than the speech sample has to end; but what is blocking/non-blocking?
Should I just write 'Wait(the length of time for the 2 speech samples)', and included it at the beginning/end of the block of code?

Also: I have chosen eSkipAnyKeyOrMouseClick for speech skipping

Code:
cBuddhistCow.SayBubble("63 At the dawn of time, the island - all it's crea.....e by the god of cows; Mooaclah.");
cBuddhistCow.SayBubble("64 Mooaclah was a bored creature, with many ......many cow-shaped vessels to store his power...");
FadeOut(10);


(Ampersands deleted because they're screwing up the text display of this post)
Title: Re: How do I stop speech bubbles/samples being interrupted?
Post by: Khris on Tue 24/03/2020 13:11:15
Looks like it's an issue with the module which might not be compatible with Voice Speech? Anyway, I'd post in the module's thread instead.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 24/03/2020 14:29:13
Yup, merged.

Quote from: bx83 on Tue 24/03/2020 10:06:17
What I want to happen:
1. Buddhist speaks, speech bubble appears
2. The sound sample 1 is over; delete this speech bubble, and create the second one; start the second bit of speech
3. When that's over, delete speechbubble, speech sample 2 has obviously stopped because it's non-blocking
4. Fade out screen

I'm not quite sure I understand this description. What do you mean that "speech sample 2 has obviously stopped because it's non-blocking"? Is the behavior you're after different in any way from normal speech behavior? (Show speech text and play speech clip, then show next speech text and next speech clip.)

Quote from: bx83 on Tue 24/03/2020 10:06:17but what is blocking/non-blocking?
Should I just write 'Wait(the length of time for the 2 speech samples)', and included it at the beginning/end of the block of code?

No, definitely not. But again, what do you mean "what is blocking/non-blocking"?

Quote from: bx83 on Tue 24/03/2020 10:06:17The speech bubbles are obviously ending early because they estimate a shorter amount of time to read the bubble than the speech sample has to end;

Well, if you're providing a voice clip it should be using the length of the clip automatically. In fact, it's not calculating anything, just displaying the speech bubble, then calling the AGS Character.Say() function with the speech clip ID as the line and waiting until it's finished.

I think I recall from testing your game before that these lines are extremely long, though. Like, around a minute or so? And you're using the LipSync module as well, right? I seem to remember that there is some limitation somewhere that they overflow (either somewhere in the modules or in AGS). I would first try cutting them down to a more reasonable length and see if that solves things.

Another thing you could test is to replace these SayBubble() calls with Say(). If you still have the problem then it's not an issue with the module.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 25/03/2020 00:53:51
Solved: made sound files shorter.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Mon 06/04/2020 11:11:45
I am having a compile error on this line:

void SB_sayImpl(this Character*, String message)
{
//BLR ADDED
  this.SaySync(message);
}


I'm getting the error:
SpeechBubble_0.8.0.asc(19): Error (line 19): '.SaySync' is not a public member of 'Character'. Are you sure you spelt it correctly (remember, capital letters are important)?

...but it is. SaySync is most definitely a member of characters.

However I think I've made a typo around this code, but I can't find it.
It's just shot this error now, after months of not updating it.

here's the scripts:
https://bluekeystudios.com/filez/speechbubble.zip (https://bluekeystudios.com/filez/speechbubble.zip)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Mon 06/04/2020 11:24:43
Have you reordered the modules so that TotalLipSync is no longer above SpeechBubble? That's the only explanation I can think of.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Mon 06/04/2020 11:59:49
SOLVED!

I didn't even know the order in the right-column for Scripts had a meaning - you learn something every day :D
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Tue 21/04/2020 12:12:10
I'm using SayAtBubble to position the bubble as I want. I've put two defines into the global.ash to  set x and y coordinates:

in global.ash:

#define hare_x 590
#define hare_y 12


in a conversation with the Hare character:

@6
  cJulius.SayAtBubble(hare_x,hare_y,"&615 How did you get invited to this animal party village green thing?");
  cHare.SayBubble("&16 How'd *you* get invited? You an animal?");
...


...BUT the X coordinate does nothing. It always positions the bubble in the centre of Julius head:

(https://redrom.ltd/img/haress.png)

Here's the function code:


void realSayAtBubble(this Character*, int x, int y, String message, GUI* bubbleGui, DynamicSprite* bubbleSprite)
{
  // Render and display the speech bubble
  if(bubbleSprite == null)
    bubbleSprite = this.renderBubble32(message, true);
  Overlay* bubbleOverlay;
  if(bubbleGui == null && _defaultGui == null)
    bubbleOverlay = Overlay.CreateGraphical(x, y, bubbleSprite.Graphic, true);
  else
  {
    if(bubbleGui == null)
      bubbleGui = _defaultGui;
     
    bubbleGui.Clickable = false;
    bubbleGui.X = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
    bubbleGui.Y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);
    bubbleGui.Width = bubbleSprite.Width;
    bubbleGui.Height = bubbleSprite.Height;
    bubbleGui.BackgroundGraphic = bubbleSprite.Graphic;
    bubbleGui.Transparency = 0;
    bubbleGui.Visible = true;
  }
  SpeechBubble* bubble = SpeechBubble.Create(this, message, bubbleSprite, bubbleGui, bubbleOverlay);
 
  bubble.setX(x);
  bubble.setY(y);
  bubble.setBackgroundSpeech(false);
  bubble.setThinking(false);
  _addBubbleChar(this);
 
  // Play speech (this chunk blocks until speech is complete)

  String lineNumber = getLineNumber(message);
  // If we have set an invisible font, just call Say() - or whatever custom Say() implementation we have
  if(SpeechBubble.get_InvisibleFont() != -1)
  {
    FontType speechFont = Game.SpeechFont;
    Game.SpeechFont = _invisibleFont;
    this.SB_sayImpl(message);
    Game.SpeechFont = speechFont;
  }
  // Else if we're going to play a voice clip, call Say() with the clip number and a blank line of text
  // (takes care of animation and doesn't display any text). This doesn't work with text-based lip-sync,
  // so if you're using text-based lip-sync, you MUST set an invisible font to get lip-sync to work
  else if(lineNumber != null && Speech.VoiceMode != eSpeechTextOnly) // && !GetGameOption(OPT_LIPSYNCTEXT))
  {
    String s = lineNumber;
    while(s.Length < message.Length)
      s = s.AppendChar(' ');
    this.SB_sayImpl(s);
  }
  // Otherwise we have to do it manually...
  else
  {
    bubble.setAnimating(true);
    this.animateSpeech(message);
  }
 
 
  // Remove the bubble
  bubble.Remove();
}

...

void SayAtBubble(this Character*, int x, int y, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...") {
    this.SB_sayImpl(message);
  } else {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, true);
    x = this.x - GetViewportX() - bubbleSprite.Width/2;
    x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
   
    this.realSayAtBubble(x, y, message, bubbleGui, null);
  }
}

...


// Draw a speech bubble in 32-bit (using transparency)
DynamicSprite* renderBubble32(this Character*, String message, bool talkTail)
{
  // Calculate text dimensions
  int textWidth = _maxTextWidth;
  if(textWidth <= 0)
    textWidth = calculateDefaultTextWidth(this);
  textWidth = _minInt(textWidth, System.ViewportWidth - _paddingLeft - _paddingRight);
  int textHeight = GetTextHeight(message, Game.SpeechFont, textWidth);
 
  textWidth = calculateExactTextWidth(message, Game.SpeechFont, textWidth, textHeight);
 
  // Calculate bubble dimensions
  int totalWidth = textWidth + _paddingLeft + _paddingRight;
  int bubbleHeight = textHeight + _paddingTop + _paddingBottom;
  int totalHeight;
  if(talkTail)
    totalHeight = bubbleHeight + _talkTailHeight;
  else
    totalHeight = bubbleHeight + _thinkTailHeight;
 
  SpeechBubbleHeight_blr=totalHeight;//BLR
 
  // Set up the canvases
  DynamicSprite* bubbleSprite = DynamicSprite.Create(totalWidth, totalHeight, true);
  DrawingSurface* bubbleSurface = bubbleSprite.GetDrawingSurface();
  //bubbleSurface.Clear();
 
  DynamicSprite* bgSprite; DrawingSurface* bgSurface;
  DynamicSprite* borderSprite; DrawingSurface* borderSurface;
  if(_backgroundTransparency == 0)
  {
    bgSprite = bubbleSprite;
    bgSurface = bubbleSurface;
  }
  else
  {
    bgSprite = DynamicSprite.Create(totalWidth, totalHeight, true);
    bgSurface = bgSprite.GetDrawingSurface();
  }
  if(_borderTransparency == 0)
  {
    borderSprite = bubbleSprite;
    borderSurface = bubbleSurface;
  }
  else
  {
    borderSprite = DynamicSprite.Create(totalWidth, totalHeight, true);
    borderSurface = borderSprite.GetDrawingSurface();
  }
 
  int bgColor = mixColors(this.SpeechColor, _backgroundColor, _backgroundSpeechTint);
  int borderColor = mixColors(this.SpeechColor, _borderColor, _borderSpeechTint);
 
  // Draw!
  bgSurface.DrawingColor = bgColor;
  bgSurface.DrawRectangle(1, 1, totalWidth-2, bubbleHeight-1);
  drawRoundedCorners32(bgSurface, borderSurface, borderColor, 0, bubbleHeight);
  String tail[]; int tailWidth; int tailHeight;
  if(talkTail)
  {
    tail = _talkTail; tailWidth = _talkTailWidth; tailHeight = _talkTailHeight;
  }
  else
  {
    tail = _thinkTail; tailWidth = _thinkTailWidth; tailHeight = _thinkTailHeight;
  }
  bgSurface.DrawingColor = bgColor;
  bgSurface.drawPixelArray(tail, totalWidth/2-tailWidth, bubbleHeight, tailWidth, tailHeight, 'O', false, false);
  borderSurface.DrawingColor = borderColor;
  borderSurface.drawPixelArray(tail, totalWidth/2-tailWidth, bubbleHeight, tailWidth, tailHeight, 'X', false, false);
  borderSurface.DrawLine(_cornerRoundingRadius, 0, totalWidth - _cornerRoundingRadius, 0);
  // Left Line
  borderSurface.DrawLine(0, _cornerRoundingRadius, 0, bubbleHeight - _cornerRoundingRadius);
  // Right Line
  borderSurface.DrawLine(totalWidth-1, _cornerRoundingRadius, totalWidth-1, bubbleHeight - _cornerRoundingRadius);
  // Bottom Lines
  borderSurface.DrawLine(_cornerRoundingRadius, bubbleHeight, totalWidth/2 - tailWidth, bubbleHeight);
  borderSurface.DrawLine(totalWidth/2, bubbleHeight, totalWidth - _cornerRoundingRadius, bubbleHeight);
 
  if(_backgroundTransparency != 0)
  {
    bgSurface.Release();
    bubbleSurface.DrawImage(0, 0, bgSprite.Graphic, _backgroundTransparency);
    bgSprite.Delete();
  }
  if(_borderTransparency != 0)
  {
    borderSurface.Release();
    bubbleSurface.DrawImage(0, 0, borderSprite.Graphic, _borderTransparency);
    borderSprite.Delete();
  }
 
  bubbleSurface.DrawingColor = this.SpeechColor;
  int outlineColor = mixColors(this.SpeechColor, _textOutlineColor, _textOutlineSpeechTint);
  if(_textOutlineWidth > 0)
    bubbleSurface.drawStringWrappedOutline(_paddingLeft, _paddingTop, textWidth, _textOutlineStyle, Game.SpeechFont, _textAlign, message, _textTransparency, outlineColor, _textOutlineWidth);
  else
    bubbleSurface.drawStringWrappedAA(_paddingLeft, _paddingTop, textWidth, Game.SpeechFont, _textAlign, message, _textTransparency);
 
  bubbleSurface.Release();
  return bubbleSprite;
}


I can include more functions; I've altered like 10 lines of code in this module, but the above *looks* okay...???
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Tue 21/04/2020 12:34:00
there's also this:
https://bluekeystudios.com/filez/speechbubble.zip (https://bluekeystudios.com/filez/speechbubble.zip)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 21/04/2020 13:08:06
It's because of one of the lines you've added to SayAtBubble():

Code (ags) Select
    x = this.x - GetViewportX() - bubbleSprite.Width/2;

Why have you changed the module code?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 22/04/2020 02:24:22
I don't know... :/
I'll test it.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Wed 22/04/2020 03:26:19
Solved.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Wed 10/06/2020 16:41:16
Hello! Experimenting with this module and really digging it so far!

I naturally have a question about something. In my (1080 x 1920 resolution) game, the player character is communicating with someone by radio, and I wanted to give the radio guy his own bubble. I created a function that sets the radio guy's bubble position 300 pixels behind where the player is standing. Here are the results.

at player.x-300:
(http://www.wadjeteyegames.com/temp/bubbleleft.png)

at player.x+300:
(http://www.wadjeteyegames.com/temp/bubbleright.png)

As you can see, the second speech bubble is significantly further away than the first. Any idea what is causing that?

Also, while I'm here, is there any way to temporarily get rid of the bubble's tail?

Thanks much!

-Dave
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Wed 10/06/2020 17:07:59
Woo. I managed to find a work around. I created an invisible character for the radio guy that changes it's position just before it speaks, and used the regular "SayBubble" command instead of "SayAtBubble." The positioning is much more consistent now.

Also I discovered the Screen2Gif software:

(http://www.wadjeteyegames.com/temp/wordbubble.gif)

That said, I still would like to remove the bubble tail whenever the radio guy speaks!  Any clues on how to do that?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 10/06/2020 17:23:12
Hmm. The way it's intended to work is that you supply a new TalkTail array:

Code (ags) Select
  String tail[] = new String[5];
  tail[0] = " OOOO";
  tail[1] = "  OOO";
  tail[2] = "   OO";
  tail[3] = "    O";
  tail[4] = null;

  SpeechBubble.TalkTail = tail;


If you set it to an array with just one entry, null, that would disable the tail completely. However, this feature is broken (https://www.adventuregamestudio.co.uk/forums/index.php?topic=55687.msg636579286#msg636579286), because AGS doesn't actually allow you to set arrays via attributes. :~(

To address this and other limitations, I did a complete rewrite of the module a couple of years ago, to make it easier to customize the appearance (it would allow you to set the tail as an array or as a sprite), but never published it because I didn't get around to reimplementing 100% of the old functionality. There's also a longstanding issue with the module causing momentary freezes unless you supply an invisible font.

There are currently various branches and hacked versions floating around the forums. I really should clean it all up and post a new release. Which AGS engine version are you targeting?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Wed 10/06/2020 17:34:25
I'm using the latest version of AGS. I'm still at the early stages of my project so I still update it when ever a new version comes out.

edit: Wait, so you can change the shape of the tail using those arrays? I was wondering what those were for. I'm curious how that works. Is there any documentation on how that is done?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Wed 10/06/2020 17:53:25
Aha! Figured it out and found a workaround! I just set the tail to this shape:

Code (AGS) Select

function setNozzoTail()
{
  _nozzoTalkTail = new String[10];
  _nozzoTalkTail[0] = "XXXXXXXX";
  _nozzoTalkTail[1] = "        ";
  _nozzoTalkTail[2] = "        ";
  _nozzoTalkTail[3] = "        ";
  _nozzoTalkTail[4] = "        ";
  _nozzoTalkTail[5] = "        ";
  _nozzoTalkTail[6] = "        ";
  _nozzoTalkTail[7] = "        ";
  _nozzoTalkTail[8] = "        ";
  _nozzoTalkTail[9] = null;
  SpeechBubble.set_TalkTail(_nozzoTalkTail);   
}


And that did the job!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Tue 16/06/2020 21:14:38
Hello! I have encountered another issue, although I am not sure what causes it. I notice that when I click through dialog, occasionally the game registers an extra click and either clicks through the next piece of dialog or (if it's the end of the dialog) activates a click where-ever the mouse cursor happens to be. This happens only very sporadically, but consistently (at least once every five minutes or so) and there's no common cause that I can see.

When I de-activate the bubbles and go back to regular speech, the problem goes away. So I am pretty sure it involves the bubbles in some way. Do you have any idea what might cause this to happen?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 16/06/2020 23:32:04
 :-\

My guess is that it's to do with the Wait() logic that emulates speech blocking. There have been a number of reported bugs linked back to this part of the code (I think I've even heard something like this reported before). Crimson Wizard and the other AGS devs are currently working on extending the Wait() API so it will support the same behavior as speech blocking (e.g. block indefinitely until there's a mouse or keyboard press) without complicated workarounds.

Meanwhile, if you haven't already done so, I would strongly suggest setting and activating an invisible font, which will bypass all this logic and instead just use the built-in AGS speech blocking. There's a link to download one on the GitHub page for the module: http://www.angelfire.com/pr/pgpf/if.html
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: eri0o on Tue 16/06/2020 23:44:05
AGS has a time for which things are ignored after the end of a speech, the unforgettable Game.IgnoreUserInputAfterTextTimeoutMs (https://adventuregamestudio.github.io/ags-manual/Game.html#gameignoreuserinputaftertexttimeoutms). This prevents spurious clicks after ending the speech, by blocking input for some milliseconds every time text is skipped or ends by timeout. Maybe there's a way to implement it in SpeechBubble?

Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 16/06/2020 23:59:30
Yup, I'm aware ;) (I believe I was actually the one who suggested that feature originally â€" Edit: indeed (https://www.adventuregamestudio.co.uk/forums/index.php?topic=36495.msg478730#msg478730)), but it would not have any effect in this case, since it's not happening after a timeout, but when the user actively clicks away the dialog.

It's something that would probably be worth adding (though it couldn't be 100% the same, since I can't control what happens once the dialog is over), but only if and when this and related bugs are fixed.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: eri0o on Thu 18/06/2020 17:16:53
Here's how the thing you asked got implemented: https://github.com/adventuregamestudio/ags/blob/760635024c547face5ee423d62ccbf9abc7976f8/Engine/ac/display.cpp#L311

Maybe it helps to figure out how to add this in the module. :/
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Fri 09/04/2021 06:56:05
Snarky, I have two things and wondering if they’re possible:
1. Turn off speechbubble easily (so they never display) by setting one option.
2. Not allow a speech bubble to be written off the right edge of the screen (at the moment it must start at x=0, but if a character is standing too far to the right, they’re speech bubble may be cut off). Is there a way to make their right edge or both edges impossible to be drawn off screen?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 09/04/2021 14:15:47
Quote from: bx83 on Fri 09/04/2021 06:56:05
Snarky, I have two things and wondering if they’re possible:
1. Turn off speechbubble easily (so they never display) by setting one option.

I'm not sure what this means, exactly. The speech bubble is shown when you explicitly tell it to be shown, by a command such as cCharlie.SayBubble("Blah, blah");. If you don't want it to be shown, you should not call this method. If you want to be able to switch between displaying text in a speech bubble or with built-in speech, you would need to write a custom function for that which would check the variable and call the appropriate function.

Quote from: bx83 on Fri 09/04/2021 06:56:05
2. Not allow a speech bubble to be written off the right edge of the screen (at the moment it must start at x=0, but if a character is standing too far to the right, they’re speech bubble may be cut off). Is there a way to make their right edge or both edges impossible to be drawn off screen?

Looking over the module code, I don't see how it could position the bubble to be cut off on the right by more than 1 pixels:

Code (ags) Select
// SpeechBubble.asc

int _clampInt(int value, int minRange, int maxRange) // line 347
{
  if(value<minRange) return minRange;
  if(value>maxRange) return maxRange;
  return value;
}

// ...
  x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width); // line 1314
  // ...
    bubbleOverlay = Overlay.CreateGraphical(x, y, bubbleSprite.Graphic, true); // line 1320


The position is constrained so that the sprite x-position is not above System.ViewportWidth - bubbleSprite.Width, and therefore it should only be cut off by 1 pixel at most (that's a small bug, but it sounds like you're talking about something bigger).

So unless you've modified the code, I don't see how this is possible.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Sat 10/04/2021 00:41:46
I've just found out this only happens to Julius (main character), as he has a separate talking function (to accout for Z-axis alteration). I "reverse engineered" (ie hacked together unknowingly) the speech bubble function, which looks like this:

function cJulius_spk(String msg)
{
  // Calculate text dimensions
  int textWidth = -1;

  int w = System.ViewportWidth * 2/3;
  if(cJulius.x - GetViewportX() <= System.ViewportWidth/4 || cJulius.x - GetViewportX() >= System.ViewportWidth * 3/4) {
    w -= System.ViewportWidth/5;
  }
  textWidth=w;

  if(textWidth < (System.ViewportWidth - 40)) {
    textWidth=textWidth;
  } else {
    textWidth=System.ViewportWidth - 40;
  }
 
  int textHeight = GetTextHeight(msg, 1, textWidth);
 
  int cut = textWidth;
  int height = textHeight;
  while(cut>1) {
    cut = (cut+1) >> 1; // Subtract half as much as we tried last time, rounding up
    height = GetTextHeight(msg, 1, textWidth - cut);
    if(height == textHeight) {
      textWidth -= cut;
    }
  }
  height = GetTextHeight(msg, 1, textWidth-1);
  if(height == textHeight) {
    textWidth=textWidth-1;
  } else {
    textWidth=textWidth;
  }

  int totalWidth = textWidth + 20 + 20;
  int bubbleHeight = textHeight + 10 + 10;
  int totalHeight;
  totalHeight = bubbleHeight + 9;

  SpeechBubbleHeight_blr=totalHeight;

  int headHeight=355;     //constant
  int spaceAboveHead=8;  //constant

  float h=IntToFloat( SpeechBubbleHeight_blr ); //constant
  float f=( (IntToFloat(headHeight+spaceAboveHead)/100.0)*IntToFloat(cJulius.Scaling) ) + h;

  cJulius.SayAtBubble(cJulius.x, cJulius.y - FloatToInt(f), msg);
}


Would you be able to help me insert the viewport code? I can work it out but it'll take a long time.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Sat 10/04/2021 21:27:12
Solved it. Had the problem in the code, for SayAtBubble().

Had
x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width/2);
instead of
x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);

Not that it matters, but all good now :)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Thu 15/04/2021 04:08:17
How can I display a Speechbubble so that it is on top of all GUIs? ie. Make it's ZOrder=1000 -- despite the fact it has no ZOrder and no obvious way of doing this... :/
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 15/04/2021 05:48:14
By default, speech bubbles are drawn on overlays, which I think always appear below GUIs? Anyway, you cannot control their Z-order (though I believe this will be available in an upcoming AGS version). However, you can make it appear on a GUI by passing a bubbleGui argument to the SayBubble function, or setting the SpeechBubble.DefaultGui property. With a GUI you can control the Z-order through the property GUI.ZOrder.

(Only one character's speech can be displayed on a single GUI at a time, so if you have overlapping dialog through SayBackgroundBubble, you will need to set different GUIs for the different speakers.)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Thu 15/04/2021 10:40:21
To myself, it's good to have a plan, but I don't think I could implement this in 6months. Basically all I'll trying to do is display a speech bubble at x=20, y=30, and have it appear above the Inventory GUI (which has a solid background) for all speech connected to i[something]_look() functions.

But anyway - when do you think this feature will be coming out re ZOrder? Is in the next version or 5 months of bug-fixing away? Just trying to get an idea.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 15/04/2021 10:56:59
I guess I wasn't explicit enough in my last reply. If you add a GUI gSpeechBubble to your project, then this code should display the speech on top:

Code (ags) Select
gSpeechBubble.ZOrder = 1000; // Any number higher than the inventory GUI's z-order
cBob.SayBubble("Blah Blah Blah", gSpeechBubble);


Alternatively, you can put this in game start, and it will always use the GUI:

Code (ags) Select
SpeechBubble.DefaultGui = gSpeechBubble;
gSpeechBubble.ZOrder = 1000;


However, as I tried to explain, this could potentially lead to trouble if you have overlapping speech using SayBackgroundBubble.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Thu 15/04/2021 11:12:14
fir creating a bubble - you mean initialised with SpeechBubble *gInvBubble = SpeechBubble.Create(....  or..?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Thu 15/04/2021 11:26:42
Okay, ignore that, made no sense.

I've made some progress...

void SayAtBubble(this Character*, int x, int y, String message, GUI* bubbleGui)
{
  if(message == null) return;
  if(!game.bgspeech_stay_on_display)
    _stopAllBackgroundBubbles();
  if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...") {
    this.SB_sayImpl(message);
  } else {
    DynamicSprite* bubbleSprite = this.renderBubble32(message, true);

.....
} else {
x = this.x - GetViewportX() - bubbleSprite.Width/2; //BLR
}

x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);   // /2);

    if (DescribeItemInv) {
      cJulius.realSayAtBubble(1, 1, message, gInventory, null);
    } else {
      this.realSayAtBubble(x, y, message, bubbleGui, null);
    }
  }
}


DescribeItemInv is a switch I set up to say 'the inventory is showing'. Don't ask me why, I'll clean it up later.

Anyway - it now:
1. Instantly removes the gInventory GUI
2. Does the speech bubble
3. Prevents you from ever bringing the gInventory GUI up again

:/


ps. I have BTN_SB as a blank element in the gInventory GUI as a button. Should I leave it in?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Thu 15/04/2021 11:43:45
....Aaaand I'm a moron. It was replacing the GUI not attaching to it. I created a new one with ZOrder=999, and it worked :)

Now - is there a way to get rid of the tail?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 15/04/2021 12:30:50
I wish you would stop modifying the module code, and instead build helper functions on top of the module for stuff like this. It's very hard to support when the code you're using is not the code I wrote.

As for the tail, it should be a matter of setting SpeechBubble.TalkTail = null;
I seem to recall that there was some AGS bug/quirk that kept this from working correctly, but if so you can add the line import void set_TalkTail(static SpeechBubble, String value[]); and call SpeechBubble.set_TalkTail(null); instead.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Thu 29/04/2021 22:27:59
Hello! Quick question. I would like to have my speech bubbles display when a GUI is up on the screen. Right now they display behind the GUIs. Is there a way to set the zorder of the bubble?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 30/04/2021 00:38:06
Hey Dave, this issue is discussed a few posts up in the thread, here (https://www.adventuregamestudio.co.uk/forums/index.php?topic=55542.msg636634971#msg636634971).
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Fri 30/04/2021 22:13:55
Thanks! This worked! :D
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Fri 21/05/2021 10:35:26
I have a problem that when I set a bubble with SayAtBubble(), it's x/y coords are totally static. If the speech bubble is placed directly above the head of a character, and it turns out it's 5 lines long, it will continue to go down the screen and obscure the character's head.

How would I alter things? eg:

SayAtBubble(talk_x, talk_y-(bubbleSprite.GetNumberOfLines*8), "&777 line");   //will push the speech bubble up by number of lines used in speechbubble * 8 pixels for each

Basically, I am wondering how I would alter SayAtBubble so that the bubble's tail, *NOT* the upper-left corner, is used to position it; though obviously this is very difficult, I just want to know where I would get the variable controlling number of text lines so I can do it sort-of automatically.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 21/05/2021 11:12:06
That is not supported because SayAtBubble() doesn't have any positioning logic. If you want to position the speech bubble to align the tail with the character, use SayBubble().

I would suggest you go back to the official version of the SpeechBubble module and use it as intended. If there's anything it won't allow you to do, or you have any bug reports or feature requests, let me know and I'll see how to address it. I am not going to continue supporting a hacked version.

Edit: At the same time, I know I have been neglecting this module for a long time, and it does need an update. PM me and let's figure out how I can best support your development and get the module to version 1.0.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: eri0o on Fri 21/05/2021 11:56:37
Hey Snarky, when you update the module, if you can please add the border support that was here : https://www.adventuregamestudio.co.uk/forums/index.php?topic=56121.msg636587529#msg636587529 (I don't think they made into the latest release).
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: bx83 on Fri 21/05/2021 12:08:21
Snarky, okay no worries. I'll keep in touch, atm just hacking-away all last known errors before release.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 21/05/2021 12:23:25
Quote from: eri0o on Fri 21/05/2021 11:56:37
Hey Snarky, when you update the module, if you can please add the border support that was here : https://www.adventuregamestudio.co.uk/forums/index.php?topic=56121.msg636587529#msg636587529 (I don't think they made into the latest release).

Absolutely. I have a half-completed internal build that merges those additions. IIRC, the main outstanding issues that remain to be addressed are:

-Logic to handle speech repositioning (in cases of scrolling rooms or character movement)
-Support for integration with lipsync module (which turned out to be more complicated than expected; may drop this for the next version)
-Weird bugs related to the custom blocking functions (redundant as of upcoming 3.5.x version with Wait() extensions)
-Streamline the code: in particular related to not allowing pointers inside managed structs and the AGS compiler bug about static structs/attributes (https://www.adventuregamestudio.co.uk/forums/index.php?topic=55308.0) (I don't suppose that has been fixed yet?)

I seem to recall I abandoned it last time around because I found it so tedious to work around the AGS limitations. Providing a nice API required literally thousands of lines of boilerplate.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Fri 21/05/2021 19:39:46
Quote from: Snarky on Fri 21/05/2021 12:23:25
-Weird bugs related to the custom blocking functions (redundant as of upcoming 3.5.x version with Wait() extensions)

I need to clarify, these Wait extensions are no longer in 3.5.x, they were moved to ags4 development, as well as many other recently implemented script functions. I made a decision to only keep perfomance/backend updates in 3.* branch from now on and only add new script API if there's a critical gap in functionality due to recent changes or something (like happened with GUI.Visible and "popup at y" guis).
All the new API is going to ags4 now.

ags4 branch already features a new script compiler written by fernewelten that has many things fixed and new good things like array.Length property. We were also discussing what's required for pointers in pointers, but that was not implemented just yet.

In theory this compiler could be backported to ags3 branch too, as it does not change any data formats and not reliant on anything else in the editor or engine (except for array.Length)... maybe we could see to it when 3.6.0 comes close to completion. Or maybe we should just focus on releasing a preliminary ags4 version sooner.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 21/05/2021 19:59:44
Ah, that's a shame, since the lack of this Wait() API is the cause of a lot of the issues with this module. As it stands, it's not possible to fully replicate the AGS .Say() advance-to-next-line behavior in script (there's no WaitMouse(), and you cannot reliably tell whether a WaitKey()/WaitMouseKey() ended because of a click or because it timed out, much less which particular keyboard key was pressed).
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Fri 21/05/2021 20:17:16
Actually I am no longer sure if that's was a right thing to do. I keep making so many bad planning decisions and this development became an endless mess.
I worried that will end up working on several versions in parallel again (and it happened anyway). Some changes we had were rather risky (like new font outlines could produce new font errors and require further optimization and I did not have time to work on that), but others were relatively minor. I also did not know how much time will it take to complete 3.5.1, and in the end everything takes much more time than expected. And I wanted to move to ags4 development completely and stop working on ags3, but with ags4 it's not clear when the first version will be ready. We still do not have a proper milestone for it and because of that it's impossible to tell when to not begin coding new functionality there. For example, now I think that it might be a good idea to try having first 4.0 version with Unicode support, as that can be a breaking change.

So now I'll probably will have to begin porting certain changes back to 3.5.1 or next minor 3.5 or 3.6 update. Need to review what was in the dropped branch again to see what may be worth pulling over.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Fri 21/05/2021 20:59:31
I didn't mean to talk you out of the decision. I think putting the focus on AGS 4 (and, critically, dropping the requirement for backwards compatibility) is the right strategy. Whether that means no further development (apart for bug fixes and critical issues) on the 3.x branch, or if less radical changes can be ported there without complicating the work too much, you will have to decide.

And I want this module to be compatible with 3.4 and earlier versions, so I would not actually be able to rely on the new API in any case.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Fri 21/05/2021 21:22:00
Okay, I will probably begin pulling minor changes back into 3.5.*/3.6.0. There was a number of small but useful additions.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Wed 02/06/2021 00:41:41
Hiya! So I encountered a problem. Hopefully it's easy to workaround.

I've been using the SayBackgroundBubble() command to display non-blocking conversations. It works fine, unless I leave the room while the bubble is still on the screen.

If I do that, I get the error ""ScriptOverlay::Remove: overlay is not there!"

It feels like the game automatically removed the bubble from the screen when I left the room, but the command to remove it is still queued up.

I have tested this by waiting for the conversation to be finished (with no bubbles on the screen) before changing rooms. The game did not crash.

Any light shedding appreciated!

Thanks,

-Dave
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: eri0o on Wed 02/06/2021 01:18:23
This error can be prevented changing SpeechBubble.asc, Line 726 (https://github.com/messengerbag/SpeechBubble/blob/1c0d6df7c4968f24665b05b9c4e53f4df3e72376/SpeechBubble.asc#L726) from
Code (ags) Select
    if(_bubbleOverlays[id] != null)
      _bubbleOverlays[id].Remove();

to
Code (ags) Select
    if(_bubbleOverlays[id] != null && _bubbleOverlays[id].Valid )
      _bubbleOverlays[id].Remove();

(minimal project: TestOverlaySpeechBubble.zip (https://github.com/ericoporto/ags/files/6581273/TestOverlaySpeechBubble.zip))
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Wed 02/06/2021 02:02:56
Worked like a CHARM! Thank you.  :=
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 02/06/2021 09:29:18
Yeah, that looks right. Thanks eeri0o, and Dave for reporting the bug. (I think I've heard it reported before, but don't remember when/where.) I'll incorporate this fix into the next update.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Wed 02/06/2021 12:44:52
I think this Overlay.Remove is a good candidate for replacing error with a warning though...
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Mon 14/06/2021 23:15:09
I upgraded to AGS v3.5.1.7, and when I compiled I got the error:

"SpeechBubble_0.8.0.asc(1132): Error (line 1132): '.ViewportWidth' is not a public member of 'System'. Are you sure you spelt it correctly (remember, capital letters are important)?"

Setting script compatibility to 3.5.0 Alpha allows the game to compile properly.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Tue 15/06/2021 10:04:32
The module predates the new Viewport/Camera API that was introduced in AGS 3.5.0, and those API changes break it, as they do many other modules. Not sure why 3.5.0 Alpha is compatible. I'll ensure it is compatible in the next update.

Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Tue 15/06/2021 14:11:39
Cool! Thanks.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Tue 15/06/2021 21:30:17
Quote from: Snarky on Tue 15/06/2021 10:04:32Not sure why 3.5.0 Alpha is compatible.

Camera API was added in a later alpha version.

The correct #ifdef for these functions is SCRIPT_API_v3507.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Thu 15/07/2021 01:13:15
Quote from: Snarky on Fri 21/05/2021 19:59:44
Ah, that's a shame, since the lack of this Wait() API is the cause of a lot of the issues with this module. As it stands, it's not possible to fully replicate the AGS .Say() advance-to-next-line behavior in script (there's no WaitMouse(), and you cannot reliably tell whether a WaitKey()/WaitMouseKey() ended because of a click or because it timed out, much less which particular keyboard key was pressed).

Now these are added to 3.6.0, could be already tried out if necessary:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=58976.msg636637973#msg636637973
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Mehrdad on Mon 11/10/2021 16:55:18
Hi,  Can we use this module for animation or pictures in ballon (No any text)?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Mon 11/10/2021 20:21:25
Hi. I recompiled in the latest version of 3.6, and I still get this error:

QuoteSpeechBubble_0.8.0.asc(1149): Error (line 1149): '.ViewportWidth' is not a public member of 'System'. Are you sure you spelt it correctly (remember, capital letters are important)?

But again, when I set "script compatibility" to 3.5.0 Alpha  it compiles fine.

Is there a way to workaround this or should I continue using the script compatibility setting?


EDIT:

OK this was pretty simple to fix. Just do a mass search and replace for the following instances

Replace System.ViewportWidth with Screen.Width
Replace System.ViewportHeight with Screen.Height
Replace GetViewportX() with Game.Camera.X
Replace GetViewportY() with Game.Camera.Y

Once you replace all those, it compiles perfectly with Script Compatibility set to "latest version".
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: lorenzo on Wed 18/05/2022 17:43:16
I'm having some trouble with this module and translations.

I've made a translation for my game, but the translated text won't show when using character.SayBubble. Instead, the bubble shows the original, untranslated line.

Basically, if I use the regular Say command, or Display, the translated text is shown correctly. But with SayBubbles, it shows the original text instead.

Is there a way to fix it? I'm using version 0.8.0 of the module.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 18/05/2022 20:31:35
I haven't tested it, but I assume adding message = GetTranslation(message); to the top of SayBubble(), SayAtBubble() and SayBackgroundBubble() would do the trick. (Or if not right at the top, right under if(message==null) return;.)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: lorenzo on Wed 18/05/2022 22:09:00
Just tried it and it seems to work fine! Thank you, Snarky!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: CCrane on Wed 16/11/2022 16:17:34
Hi,
great module you have here. Some questions I'd like to ask. First, if ...

  SpeechBubble.MaxTextWidth = 250;

... is determined by screen/native game resolution size, i.e. are these relative or absolute values? I would generally prefer dialog in at least two lines for a more proportionate appearance of the bubble but setting some value up for text width won't make much sense with absolute values if the target system has a greatly differing resolution.

Secondly, is it possible to change border width/line thickness of the bubble? I found no variable for that so I suspect it's kinda similar to automatic text outline which can't be adusted, either. My test game is 640x400 right now and I might go even higher but the border can barely be seen already.
If line thickness is hard-coded would it be possible to create two overlaying bubbles, eg. one smaller white and a bigger black one in the background? This won't really work with transparency obviously but some of us might be okay with that. Just a thought ... :)


Finally, you mentioned planning a think bubble. Will this only work for Sierra-style speech, like player.think seems to do currently, or also for LucasArts-style games? That would be great.


Thank you
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Wed 16/11/2022 17:41:46
Hi CCrane. I'm happy if the module is of use to you.

Quote from: CCrane on Wed 16/11/2022 16:17:34Some questions I'd like to ask. First, if ...

  SpeechBubble.MaxTextWidth = 250;

... is determined by screen/native game resolution size, i.e. are these relative or absolute values? I would generally prefer dialog in at least two lines for a more proportionate appearance of the bubble but setting some value up for text width won't make much sense with absolute values if the target system has a greatly differing resolution.

The values are in pixels, as are practically all AGS graphics functions. AGS games have a fixed (though customizable) game resolution that (almost) everything is rendered in, and if the screen or window resolution differs from that, the final image is simply scaled up or down. So the screen resolution it's played on should not make a difference to the layout logic: If your game is natively 640x400, then a width of 250 represents slightly less than 40% of the screen/window width.

Quote from: CCrane on Wed 16/11/2022 16:17:34Secondly, is it possible to change border width/line thickness of the bubble? I found no variable for that so I suspect it's kinda similar to automatic text outline which can't be adusted, either. My test game is 640x400 right now and I might go even higher but the border can barely be seen already.

No, this is not currently supported, because it would significantly complicate the logic for drawing rounded corners. However, there is an unofficial version (https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/speech-bubble-extensions/msg636585590/#msg636585590) of the module that allows you to assign sprites for the outline and background of the speech bubble. This would allow you to set a thicker outline.

Quote from: CCrane on Wed 16/11/2022 16:17:34If line thickness is hard-coded would it be possible to create two overlaying bubbles, eg. one smaller white and a bigger black one in the background? This won't really work with transparency obviously but some of us might be okay with that. Just a thought ... :)

It's an interesting idea for a workaround, but I think it would be quite complicated to make it work consistently, and that the outline would not look very nice. (Again, the rounded corners, which I think would get "blobby" and uneven.)

Quote from: CCrane on Wed 16/11/2022 16:17:34Finally, you mentioned planning a think bubble. Will this only work for Sierra-style speech, like player.think seems to do currently, or also for LucasArts-style games? That would be great.

Off the top of my head I see no reason why it shouldn't work for LucasArts speech too. However, from my side further development of the module is currently on hold, since I don't have the time or energy to devote to it.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: CCrane on Wed 16/11/2022 19:49:18
Quote from: Snarky on Wed 16/11/2022 17:41:46If your game is natively 640x400, then a width of 250 represents slightly less than 40% of the screen/window width.
Cool, just what I wanted to hear.

Quote from: Snarky on Wed 16/11/2022 17:41:46This would allow you to set a thicker outline.
So the outline could be made from sprites, eg. a 3px black dot. I'll check that out if I have my other stuff sorted.

Quote from: Snarky on Wed 16/11/2022 17:41:46the outline would not look very nice.
Oh, I see. It was just an idea. Two bubbles on top of each other with both having AGS's automatic black outlines might work to polish the edges somewhat but I'm not gonna pestering you with that. :grin:

Quote from: Snarky on Wed 16/11/2022 17:41:46Off the top of my head I see no reason why it shouldn't work for LucasArts speech too. However, from my side further development of the module is currently on hold, since I don't have the time or energy to devote to it.
Too bad but I know that. The reason I was asking is player.think doesn't work for me either so thought it was Sierra only.
Thanks for the explanations
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: CCrane on Thu 17/11/2022 09:36:20
Hello there (again  :) ),

Sorry for being a nuisance but I get an error when I replace this
player.Say("Looks like ... %s.", passphraseA_Word);with that piece of code
player.SayBubble("Looks like ... %s.", passphraseA_Word);
Failed to save room room1.crm; details below
room1.asc(310): Error (line 310): Type mismatch: cannot convert 'String*' to 'GUI*'


Another thing is the option text in dialog. While it's no problem to change the lines in dialog script to command style the options stay as they are. I don't even know where to look for them, actually. Is it possible to change them as well? That would be great.


There's also this little issue I have, a string named lookat in abstauber's tumbleweed module

    // PICKUP and make object invisible
    else if(Verbs.UsedAction(eGA_PickUp)) {
      Verbs.AnyClickWalkLookPick(160, 285, eDirectionLeft, "I'm a string named lookat ... anyway", oHandgun.ID, iHandgun);
      GiveScore(5);


I tried to change Say to SayBubble in abstauber's script, there seem to be only two places of player.Say(lookat) in VerbGui.asc actually, but then it just gave me this message.

SayBubble is not a public member of character

I asked him in his thread but maybe you have an idea too
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 17/11/2022 11:33:03
Quote from: CCrane on Thu 17/11/2022 09:36:20Hello there (again  :) ),

Sorry for being a nuisance

No worries.  ;-D

Quote from: CCrane on Thu 17/11/2022 09:36:20but I get an error when I replace this
player.Say("Looks like ... %s.", passphraseA_Word);with that piece of code
player.SayBubble("Looks like ... %s.", passphraseA_Word);
Failed to save room room1.crm; details below
room1.asc(310): Error (line 310): Type mismatch: cannot convert 'String*' to 'GUI*'

SayBubble() doesn't support the string formatting capability that Say() does. When you want to insert dynamic variables in the string, what you'll have to do is to wrap the message argument in a String.Format() call, like so:

player.SayBubble(String.Format("Looks like ... %s.", passphraseA_Word));
Quote from: CCrane on Thu 17/11/2022 09:36:20Another thing is the option text in dialog. While it's no problem to change the lines in dialog script to command style the options stay as they are. I don't even know where to look for them, actually. Is it possible to change them as well? That would be great.

I'm not sure I understand what you mean. How do you want the dialog options to be displayed? In general, to change the look and feel of dialog options, you would have to write your own custom dialog options rendering (https://adventuregamestudio.github.io/ags-manual/CustomDialogOptions.html). (Except for very simple things like the font and the background/text color, for which there are probably some property.)

Quote from: CCrane on Thu 17/11/2022 09:36:20I tried to change Say to SayBubble in abstauber's script, there seem to be only two places of player.Say(lookat) in VerbGui.asc actually, but then it just gave me this message.

SayBubble is not a public member of character

I asked him in his thread but maybe you have an idea too

This is probably an issue of module ordering. In the current AGS version, you can only call functions from modules higher up in the module list. So you would have to place SayBubble above the Tumbleweed module in order to use this function from Tumbleweed. (I don't remember if the module list lets you drag and drop to reorder, or if you have to right-click and choose move up/down.) This restriction will be removed in an upcoming AGS version—not sure whether it's 3.6 or 4.0.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: CCrane on Thu 17/11/2022 14:12:54
Quote from: Snarky on Thu 17/11/2022 11:33:03wrap the message argument in a String.Format() call,
Worked like a charm!

Quote from: Snarky on Thu 17/11/2022 11:33:03m not sure I understand what you mean.
Badly worded on my part. I don't mean to change the list box (or whatever it is called) where you choose a line. My issue is that after selection that line is repeated/said on screen, which is done using .Say command. (Pic 1a).
In the dialog editor I can only change character replies from .Say to .SayBubble, like this:

  Torres: I was in a plane and now I ...
  cTorres.SayBubble("I was in a plane and now I ...");

(https://iili.io/H9jdjrN.md.jpg) (https://freeimage.host/i/H9jdjrN)
Quote from: Snarky on Thu 17/11/2022 11:33:03obably an issue of module ordering
Ohh, I see. I was already wondering why the scripts weren't sorted alphabetically. Tumbleweed is at the top because its scripts are in a folder while the other scripts are not (Pic 1b).
  Maybe ordering would work if I put all scripts in an own folder. Would that break something?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 17/11/2022 15:02:35
Quote from: CCrane on Thu 17/11/2022 14:12:54My issue is that after selection that line is repeated/said on screen, which is done using .Say command. (Pic 1a).
In the dialog editor I can only change character replies from .Say to .SayBubble, like this:

  Torres: I was in a plane and now I ...
  cTorres.SayBubble("I was in a plane and now I ...");

Ah. No, I'm afraid that is hardcoded to use .Say() (see the release notes for v3.5.0.P3 (https://www.adventuregamestudio.co.uk/forums/ags-engine-editor-releases/ags-3-5-0-patch-3/msg636624082/#msg636624082), under Added "Custom Say/Narrate function in dialog scripts"). The workaround is to uncheck the "Say" checkbox and put a copy of the line in the dialog script instead.

However, that "Custom Say/Narrate function in dialog scripts" could probably save you from having to change the lines in the dialog script, if you can set the function that dialog lines are converted to to .SayBubble(). (I haven't actually tried it, but it ought to work.)

Quote from: CCrane on Thu 17/11/2022 14:12:54Maybe ordering would work if I put all scripts in an own folder. Would that break something?

The folders are merely for keeping things tidy. When compiled it's flattened into a simple list, from top-down. So you can make a folder and put whatever scripts you want in it (except the GlobalScript, which can't be moved) without trouble. You could have one folder just for SpeechBubble, or for any other modules.

In general, it's probably a good idea to keep third-party modules at the top of the list, and put any custom scripts you create below them, whether in a folder or not.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: glurex on Fri 18/11/2022 18:52:56
Hi, Snarky.

I use your module and modified it a bit to "erase" the tail of the speech bubble for a game i'm developing.

(https://i.ibb.co/C9rSLC7/Speech-Bubble-WOT.png)


Is it ok? Of course I'll credite you and the module.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sat 19/11/2022 06:50:40
Sure. It's open source; feel free to make changes. (Just note that I can't really offer support for code that has been heavily modified.)
Title: Feature request
Post by: CCrane on Sun 26/02/2023 18:04:47
Hi Snarky,
I've gotten along quite nicely with my game. SpeechBubble will now be part of it and I think it suits the classic comic style I'm roughly going for just fine.
I had to sacrifice the generic interaction replies from abstauber's Tumbleweed module because I just couldn't get them to be rendered in SayBubble but that's just a minor issue in the bigger scheme of things.

One thing I found a little inconvenient was placement of the bubbles. I had some instances where I used Character.SayAtBubble(), eg. for a radio and a character talking through a spyhole (see image). Getting the bubble in the right position took me quite some time and I would suggest that, if possible, the position of the bubble would rather be defined by the end of the tail.
I think also the module would profit from an offset function for the regular SayBubble function.

(https://lh3.googleusercontent.com/pw/AMWts8CXB2ymXmgsgNRoae3ZacKfA73p2xF4XYO_Z2K_B7UcCS4kvPncTwY-m7zYU5etrGIy9Ms64zA5iq9fhm8v5UBmVEFDf9Mr7l051ympaoqYZFclmJ-NEUmJ5sCqEPn5mFO_XRFN8KlwklUHcXU71sBc=w952-h536-no?authuser=0)

Yeah, so this is more of a feature request but don't get me wrong. I like your module very much. It's great! :smiley:

best regards
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: glurex on Fri 21/04/2023 22:39:06
Hi, @Snarky!

I've found a strange behaviour with the module (I just realize). With the default language it works perfect, but when I use the translation AGS system, the lines with .SayBubble don't get translated, but they are generated in the 'English.trs' file. (other things like labels, characters names... works well. The problem is only with the .SayBubble lines). I'm using AGS 3.5.1.22.

Alternatively I could write, in each SayBubble, something like:

if (Game.TranslationFilename=="")
{
player.SayBubble("Me pregunto si habrá algún poblado cerca...");
}
else if (Game.TranslationFilename=="English")
{
player.SayBubble("I wonder if there's a town nearby...");
}

but that would be tedious compared with the AGS translation System.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Fri 21/04/2023 23:05:31
@glurex: you can use GetTranslation instead, that automatically returns the line in the current language:

Code (ags) Select
player.SayBubble(GetTranslation("original text goes here"));

I think, this call to GetTranslation could be done right inside SayBubble. The problem here is that the message could be made using String.Format, and therefore not translatable. So it's a question of how to design the module...

Maybe there could be separate functions for automatically translated messages and not.

EDIT: you may write a helper function yourself:
Code (ags) Select
void SayBubbleTra(this Character*, String message, GUI* bubbleGui)
{
  this.SayBubble(GetTranslation(message), bubbleGui);
}
and then use it like
Code (ags) Select
player.SayBubbleTra("original text goes here");
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: glurex on Sat 22/04/2023 01:25:40
Wow, many thanks @Crimson Wizard! That saves me a lot of time!

In my case I declare this function in the SpeechBubble script (obviously under void SayBubble):

void SayBubbleTra(this Character*, String message)
{
  this.SayBubble(GetTranslation(message));
}


without "GUI* bubbleGui" and "bubbleGui", and later Import it in the Header (of SpeechBubble script):

import void SayBubbleTra(this Character*, String message);
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Tue 25/07/2023 16:04:16
Hello! Apologies if this was answered in the thread already, but I was wondering if there was a way to make the bubble always appear over the character's head? Specifically, in the following situations:

1 - the character is walking and I want them to talk using the sayBackgroundBubble command. I'd like the bubble to move with the character. Right now, it stays in place where it is drawn.
2 - the character is on a scrolling background and I want to move the "camera" left or right while they are talking. The bubble stays in the same screen position while the rest of the graphics move.

Also, is there a way to have TWO bubbles on screen at the same time? My game has a number of background conversations (using background bubbles), and if my player character says anything it stops the background bubbles from playing.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sun 30/07/2023 11:05:00
Quote from: Dave Gilbert on Tue 25/07/2023 16:04:16Hello! Apologies if this was answered in the thread already, but I was wondering if there was a way to make the bubble always appear over the character's head? Specifically, in the following situations:

1 - the character is walking and I want them to talk using the sayBackgroundBubble command. I'd like the bubble to move with the character. Right now, it stays in place where it is drawn.
2 - the character is on a scrolling background and I want to move the "camera" left or right while they are talking. The bubble stays in the same screen position while the rest of the graphics move.

The short answer is no, not at the moment.
I started a major rewrite of the module that would include this, but I got bogged down in a lot of complications, and it's not currently in progress, and nowhere near finished.

Quote from: Dave Gilbert on Tue 25/07/2023 16:04:16Also, is there a way to have TWO bubbles on screen at the same time? My game has a number of background conversations (using background bubbles), and if my player character says anything it stops the background bubbles from playing.

Also no, though @Grundislav has made a version that supports background conversation, so perhaps you can ask hem. But I'm not sure that AGS allows SayBackground calls while Say is running in the first place?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Sun 30/07/2023 11:46:59
Quote from: Snarky on Sun 30/07/2023 11:05:00Also no, though @Grundislav has made a version that supports background conversation, so perhaps you can ask hem. But I'm not sure that AGS allows SayBackground calls while Say is running in the first place?

I don't remember details about SayBackground, but I believe that you should be able to create textual overlays during blocking commands from rep-exec-always, because the game update and redraw is still run during blocking actions.

Note I said "from rep-exec-always", as that's the only callback that runs during blocking commands; this is also something to keep in mind.

Overall, I've never researched how SpeechBubble works, but I imagine that in ideal world it should support running multiple non-blocking bubbles, and optionally running one at a time as blocking.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sun 30/07/2023 12:26:18
Quote from: Crimson Wizard on Sun 30/07/2023 11:46:59Overall, I've never researched how SpeechBubble works, but I imagine that in ideal world it should support running multiple non-blocking bubbles, and optionally running one at a time as blocking.

It was designed to work as much like Character.Say() as possible. From the feedback from actual users, it turns out that it would be useful to further decompose the different parts (sizing, bubble/frame formatting and rendering, text formatting and rendering, layout/positioning, display, repositioning, use with Say/SayBackground) to be able to use it more flexibly. This is a lot more work, though (especially as everything interacts in interesting ways, particularly if you have more than one bubble visible at a time).
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Grundislav on Mon 31/07/2023 03:46:31
I'm not using this module, I just coded my own dialogue display UI. And I do have a SayBackground, but I don't ever display more than one "bubble" at a time.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Thu 03/08/2023 17:30:56
I used to cheat this by having a .Say and a .SayBackground running at the same time, but that doesn't work with the bubble. Ah well. I can probably cheat by making a bubble image GUI and place it where I need, just for the few instances where I need it. No big! Thanks anyway.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Fri 15/09/2023 18:12:08
Hello! Sorry for the double post. Is there a way to manually change the X position of the tail? Specifically for situations like this where my character is close to the edge of the screen:

(https://www.wadjeteyegames.com/temp/tailPosition.png)

I'd like the tail to be on top of the character, as opposed to just the center of the bubble. I looked through the script and found variables for the height and width, but not position.

Thanks in advance!

-Dave
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Sat 16/09/2023 19:11:33
Quote from: Dave Gilbert on Fri 15/09/2023 18:12:08Hello! Sorry for the double post. Is there a way to manually change the X position of the tail?

Sorry no, not in the released version of the module. I really have to complete and release v2, which has this setting.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Tue 19/09/2023 02:12:47
Oh! Good to know it exists at the very least. Ping this thread when ready! Thanks.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: blaholtzen on Thu 30/11/2023 15:51:02
Decided to try this out today but apparently:

SpeechBubble_0.8.0.asc(797): Error (line 797): undefined symbol 'eAlignCentre'

Couldn't find anyone else having this issue when I searched so not sure how to solve it
???
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: eri0o on Thu 30/11/2023 15:57:42
You can replace it with eAlignCenter. I thought we had dropped the UK English only in ags4, not sure which ags version you are using.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: blaholtzen on Thu 30/11/2023 16:10:42
Ah, I assumed that since the activity in this thread was so recent that the module would still work with more recent versions of AGS but it seems I was mistaken. I'm seeing more things now that are no longer supported like System.ViewportWidth and GetViewportX

Unless someone happens to have a patched version to share I will simply join the que of folks patiently waiting for v2 :)

Edit:
OH! Just went back and saw Daves notes on what to swap out, will try that, thank you Dave and also eri0o :)

Edit 2:
It works! Woo! :D
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Crimson Wizard on Thu 30/11/2023 23:05:22
I shall note this again, 3.6.* versions are fully backwards compatible, and ALL the old commands may be enabled again by changing the "Script compatibility level" in General Settings -> Backwards Compatibility; as well as few other settings, as explained here:
https://adventuregamestudio.github.io/ags-manual/GeneralSettings.html#backwards-compatibility


Alternatively, here's the list of deprecated commands and their new equivalents:
https://adventuregamestudio.github.io/ags-manual/ObsoleteScriptAPI.html
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Thu 21/12/2023 19:35:54
Hello! I am sort of cross-posting from this thread (https://www.adventuregamestudio.co.uk/forums/index.php?msg=636659783). The latest update to AGS doesn't seem to be compatible with this module. It crashes with this error when anyone speaks. Any idea why this may be happening?

(http://www.wadjeteyegames.com/temp/bubble-error.png)
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on Thu 21/12/2023 20:30:46
@Dave Gilbert

Hmm... Looking over the code (without tracing the logic precisely), I get the impression that this might happen if a character is already background-speaking when asked to speak. I don't see why the latest patch would change the behavior of the module, though.
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Dave Gilbert on Fri 22/12/2023 17:27:42
Thanks! CW over on the other thread managed to sort out what was wrong.