Adventure Game Studio | Forums

AGS Support => Modules & Plugins => Topic started by: Snarky on 03 Dec 2017, 11:28

Title: MODULE: SpeechBubble v0.8.0
Post by: Snarky on 03 Dec 2017, 11:28
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: Adventure Game Studio
  1.   player.SayBubble("This line will be said in a speech bubble.");

To configure, you set the SpeechBubble properties:

Code: Adventure Game Studio
  1.   SpeechBubble.BorderColor = Game.GetColorFromRGB(0,128,0);
  2.   SpeechBubble.BackgroundColor = Game.GetColorFromRGB(128,255,128);
  3.   SpeechBubble.BackgroundTransparency = 33;
  4.   SpeechBubble.PaddingTop = 5;
  5.   SpeechBubble.PaddingBottom = 5;
  6.   SpeechBubble.PaddingLeft = 15;
  7.   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 03 Dec 2017, 14:26
Thanks Snarky!

Definitely think I will be using this at some point.
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Bavolis on 03 Dec 2017, 14:31
Awesome! Definitely going to play with this one. Thank you! :)
Title: Re: Speech Bubble Module (v0.7.5)
Post by: Crimson Wizard on 03 Dec 2017, 15:38
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 03 Dec 2017, 18:41
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 04 Dec 2017, 00:28
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: Adventure Game Studio
  1. function room_AfterFadeIn()
  2. {
  3. cWinfillowFace.SayBubble("&1 You'll have a much bigger name than that.");
  4. cSnipShadow.SayBubble("&10 Gah! Spooky voice has a spooky face. Perfect.");
  5. cWinfillowFace.SayBubble("&2 We have much to discuss.");
  6. cSnipShadow.SayBubble("&11 Who are you? Are you me?");
  7. cWinfillowFace.SayBubble("&3 No. You are me. Now listen...");
  8. cWinfillowFace.SayBubble("&4 You must meet me at the peak of the Knobbly Crook.");
  9. cSnipShadow.SayBubble("&12 Right. Sure.");
  10. cSnipShadow.SayBubble("&13 Um. I'm just going to head back home now.");
  11. cWinfillowFace.SayBubble("&5 O'Sirus the Could Have Been...");
  12. cWinfillowFace.SayBubble("&6 O'Sirus the Never-Was...");
  13. 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 04 Dec 2017, 07:15
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)?

Quote
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.

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 04 Dec 2017, 21:00
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.

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.

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 04 Dec 2017, 23:36
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: Adventure Game Studio
  1.   SpeechBubble.BorderColor = Game.GetColorFromRGB(255,255,255);
  2.   SpeechBubble.BackgroundColor = Game.GetColorFromRGB(0,0,0);
  3.   SpeechBubble.BackgroundTransparency = 20;
  4.   SpeechBubble.PaddingTop = 8;
  5.   SpeechBubble.PaddingBottom = 5;
  6.   SpeechBubble.PaddingLeft = 15;
  7.   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: Adventure Game Studio
  1. cWinfillowFace.SayBubble("&1 You'll have a much bigger name than that."); <--BOTTOM
  2. cWinfillowFace.SayBubble("&2 We have much to discuss.");<--TOP
  3. cWinfillowFace.SayBubble("&3 No. You are me. Now listen..."); <--TOP
  4. cWinfillowFace.SayBubble("&4 You must meet me at the peak of the Knobbly Crook."); <--BOTTOM
  5. cWinfillowFace.SayBubble("&5 O'Sirus the Could Have Been...");<--TOP
  6. cWinfillowFace.SayBubble("&6 O'Sirus the Never-Was..."); <--BOTTOM
  7. cWinfillowFace.SayBubble("&7 Both are apt names."); <--BOTTOM
  8. cWinfillowFace.SayBubble("&8 Horse."); <--TOP
  9.  


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 05 Dec 2017, 15:21
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 05 Dec 2017, 15:39
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 06 Dec 2017, 02:11
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 06 Dec 2017, 20:15
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 09 Dec 2017, 05:41
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 09 Dec 2017, 08:02
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: Adventure Game Studio
  1.   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 09 Dec 2017, 13:49
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 09 Dec 2017, 14:29
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: Adventure Game Studio
  1.   cRoger.Say("It's a blue cup.");

You write this:

Code: Adventure Game Studio
  1.   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: Adventure Game Studio
  1. player: What we have here is a failure to communicate.
  2. Davy: What was that?

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

Code: Adventure Game Studio
  1.   player.SayBubble("What we have here is a failure to communicate");
  2.   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 09 Dec 2017, 15:19
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 09 Dec 2017, 16:00
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 09 Dec 2017, 23:15

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 12 Dec 2017, 18: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 12 Dec 2017, 19:19
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 23 Dec 2017, 12:06
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 10 Jan 2018, 14:53
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.
Code: Adventure Game Studio
  1.  
  2. // TODO
  3. void ThinkBubble(this Character*, String message, GUI* bubbleGui)
  4. {
  5.   if(message == null) return;
  6.   if(!game.bgspeech_stay_on_display)
  7.     _stopAllBackgroundBubbles();
  8.   if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...")
  9.     this.SB_sayImpl(message);
  10.   else
  11.   {
  12.     DynamicSprite* bubbleSprite = this.renderBubble32(message, false);
  13.     // Position bubble over character head
  14.     int x = this.x - GetViewportX() - bubbleSprite.Width/2;
  15.     x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
  16.     int y = this.y - GetViewportY() - bubbleSprite.Height - this.GetHeight() - (_heightOverHead - _talkTailHeight + 1);
  17.     y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);
  18.  
  19.     this.realSayAtBubble(x, y, message, bubbleGui, bubbleSprite);
  20.   }
  21.  
  22. }
  23.  
  24.  

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 10 Jan 2018, 21:12
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().

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 14 Jan 2018, 22:31
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 15 Jan 2018, 05:40
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.

Quote
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.

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 13 Feb 2018, 23:51
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: Adventure Game Studio
  1.   if (AGSCursorMode != eModeUsermode2 && type != 0) {
  2.     if (type==2 || type==6) player.FaceCharacter(character[location_id], eBlock);
  3.  
  4.     // unhandled USE
  5.     if (Verbs.UsedAction(eGA_Use)) {
  6.       // use inv on inv
  7.       if (type >= 5) player.Say("That won't do any good.");
  8.       // use
  9.       else player.SayBubble("I can't use that.");
  10.     }

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 14 Feb 2018, 00:14
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 14 Feb 2018, 06:54
Sometimes I'm embarrassed by my problems :D
Thanks Wizard!
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on 17 Feb 2018, 20:41
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 17 Feb 2018, 21:20
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.

Quote
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 ?

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 17 Feb 2018, 21:49
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 19 Feb 2018, 22:13
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: Adventure Game Studio
  1.  // unhandled LOOK AT  
  2.     else if (Verbs.UsedAction(eGA_LookAt)) {
  3.       // look at hotspots, objects etc.
  4.       if (type!=2) player.Say("Nice %s", locationname);
  5.       // look at characters
  6.       else player.Say("It's %s",locationname);
  7.     }

So, I tried to alter that to this:

Code: Adventure Game Studio
  1.     // unhandled LOOK AT  
  2.     else if (Verbs.UsedAction(eGA_LookAt)) {
  3.       // look at hotspots, objects etc.
  4.       if (type!=2) player.SayBubble("Nice %s", locationname);
  5.       // look at characters
  6.       else player.Say("It's %s",locationname);
  7.     }

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: Adventure Game Studio
  1. if (door_script == 1) player.SayBubble("It is already open.");
  2.  // THIS WILL WORK
  3.  else if (type ==2) player.SayBubble("%s would not like it.",locationname);
  4.  // THIS WON'T
  5.  

You think there's a solution for this?

Thanks for reading,

Loslem
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on 19 Feb 2018, 22:31
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: Adventure Game Studio
  1. player.SayBubble(String.Format("Nice %s", locationname));
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: DarkMoe on 20 Feb 2018, 01:36
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 20 Feb 2018, 05:46
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 20 Feb 2018, 07:03
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: Adventure Game Studio
  1. 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 21 Feb 2018, 01:55
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 23 Feb 2018, 01:27
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 23 Feb 2018, 06:44
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 07 Mar 2018, 19:04
How i can to set a custom background?
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on 08 Mar 2018, 21:45
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 01 Apr 2018, 19:07
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 01 Apr 2018, 22:58
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 27 Jun 2018, 08:13
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 27 Jun 2018, 08:26
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:
Code: Adventure Game Studio
  1. void ThinkBubble(this Character*, String message, GUI* bubbleGui)
  2. {
  3.   if(message == null) return;
  4.   if(!game.bgspeech_stay_on_display)
  5.     _stopAllBackgroundBubbles();
  6.   if((Speech.VoiceMode == eSpeechVoiceOnly && hasVoiceClip(message)) || message == "...")
  7.     this.SB_sayImpl(message);
  8.   else
  9.   {
  10.     DynamicSprite* bubbleSprite = this.renderBubble32(message, false);  //<--- SETTING THIS TO FALSE WAS ALL I HAD TO DO
  11.     // Position bubble over character head
  12.     int x = this.x - GetViewportX() - bubbleSprite.Width/2;
  13.     x = _clampInt(x, 0, System.ViewportWidth - bubbleSprite.Width);
  14.     int y = this.y - GetViewportY() - bubbleSprite.Height - this.GetHeight() - (_heightOverHead - _talkTailHeight + 1);
  15.     y = _clampInt(y, 0, System.ViewportHeight - bubbleSprite.Height);
  16.  
  17.     this.realSayAtBubble(x, y, message, bubbleGui, bubbleSprite);
  18.   }    
  19. }
Title: Re: MODULE: SpeechBubble v0.8.0
Post by: Snarky on 27 Jun 2018, 09:20
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.

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 27 Jun 2018, 11:20
My code works, but perhaps not in all situations.
All good, I'm happy with it so far, take your time :)