Author Topic: MODULE: SpeechBubble v0.8.0  (Read 3685 times)

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    •  
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: Speech Bubble Module (v0.7.6)
« Reply #20 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.

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: Speech Bubble Module (v0.7.6)
« Reply #21 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!

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #22 on: 23 Dec 2017, 12:06 »
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

  • been programming computers since 1981
    • I can help with AGS tutoring
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #23 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.
« Last Edit: 10 Jan 2018, 15:13 by dayowlron »
Pro is the opposite of Con
This fact can clearly be seen,
If progress means to move forward
Then what does congress mean?  --Nipsey Russell

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #24 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!

Dave Gilbert

  • Mittens Vassal
  • AGS Baker
  • Hi. Our names are FRIGGING ADORABLE.
    • Lifetime Achievement Award Winner
    •  
    • Dave Gilbert worked on a game that was nominated for an AGS Award!
      Dave Gilbert worked on a game that won an AGS Award!
Re: MODULE: SpeechBubble v0.8.0
« Reply #25 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.
« Last Edit: 14 Jan 2018, 22:43 by Dave Gilbert »

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #26 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.

Re: MODULE: SpeechBubble v0.8.0
« Reply #27 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

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: MODULE: SpeechBubble v0.8.0
« Reply #28 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.

Re: MODULE: SpeechBubble v0.8.0
« Reply #29 on: 14 Feb 2018, 06:54 »
Sometimes I'm embarrassed by my problems :D
Thanks Wizard!

Re: MODULE: SpeechBubble v0.8.0
« Reply #30 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

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #31 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. 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.

Re: MODULE: SpeechBubble v0.8.0
« Reply #32 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

Re: MODULE: SpeechBubble v0.8.0
« Reply #33 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

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #34 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));

Re: MODULE: SpeechBubble v0.8.0
« Reply #35 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

Snarky

  • Global Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: MODULE: SpeechBubble v0.8.0
« Reply #36 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 (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.

Re: MODULE: SpeechBubble v0.8.0
« Reply #37 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!

Re: MODULE: SpeechBubble v0.8.0
« Reply #38 on: 21 Feb 2018, 01:55 »
Ill try that plugin, hopefully theres some kind of way to hack the colors

Re: MODULE: SpeechBubble v0.8.0
« Reply #39 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