MODULE: SpeechBubble v0.8.0

Started by Snarky, Sun 03/12/2017 11:28:04

Previous topic - Next topic

Dave Gilbert

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.

Snarky

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!

Snarky

Bump for latest update, v0.8.0:
-Implemented Character.SayBackgroundBubble() (as requested by Dave Gilbert)
-Added SpeechBubble.DefaultGui property (to address issue reported by Bavolis)
-Fixed crash with characters that don't have a speech view set (as reported by Loslem)

dayowlron

#23
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: ags


// 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.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Snarky

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!

Dave Gilbert

#25
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.

Snarky

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.

Loslem

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

Crimson Wizard

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.

Loslem

Sometimes I'm embarrassed by my problems :D
Thanks Wizard!

DarkMoe

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

Snarky

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

DarkMoe

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

Loslem

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

 // 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

    // 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

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

Snarky

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
player.SayBubble(String.Format("Nice %s", locationname));

DarkMoe

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

Snarky

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

Loslem

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
player.SayBubble(String.Format("Nice %s", locationname));



Thanks so much! I would habe never figured that out!

DarkMoe

Ill try that plugin, hopefully theres some kind of way to hack the colors

DarkMoe

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

SMF spam blocked by CleanTalk