Forum rules - please read before posting.

Edit active text & subtitles stuff

edited June 2018 in Technical Q&A
Hi,

i've decided that in the subtitles menu i want to have the name label not above the text but in front of the text.
With layouts this is basically imposible to get the positioning right though.
The next lines are supposed to be centered to the whole width not just to the line text width.

So probably the best way to achieve this would be making the label part of the text itself. But how do i do it?

I know there's the OnSpeech event & i can access the label with AC.PlayerMenus.GetElementWithName("Subtitles", "SubsLineLabel") but how do i edit the label's text?

The idea is something like this:

void OnSpeech(AC.Char speakingCharacter, string speechText, int lineID) {
    AC.PlayerMenus.GetElementWithName("Subtitles", "SubsLineLabel").Text = speakingCharacter.name + ": " + speechText;
}

I would like to update the label's text not the line itself. So when the line is called again i wouldn't have the name label inserted multiple times.

Could anyone please explain me please what does really the Subtitles off option do?
If i set it to off the subtitles menu is still visible when the character speaks. If i check the Ignore subtitles options the subtitles menu and text is still visible.

Thanks

Comments

  • Without a mockup screenshots, I'm not clear on what layout you're actually after, but know that the "Adventure Creator" menu Source option is relatively basic - and is best used for rapid-prototyping and testing.  For "final" UI design, you really want to switch to Unity UI - which AC supports fully, see this tutorial.

    In order to set the text of a label element, you first need to cast the element variable:

    MenuElement myElement; = PlayerMenus.GetElementWithName ("Subtitles", "SubsLineLabel");
    MenuLabel myLabel = (MenuLabel) myElement;
    myLabel.label = speakingCharacter.name + ": " + speechText;

    This is covered in the Manual's "Menu scripting" chapter.

    You'd also need to set the Label type to Normal so that it doesn't get overwritten by the "true" speech text, and be sure to also include "using AC;" at the top of your script.

    The Settings Manager's Show subtitles? option will be ignored if no speech audio is associated with the current speech line.  If a line has audio, and Show subtitles? is unchecked, then the Subtitles menu will not show (unless its own Ignore 'Subtitles' option? is checked).  You can prevent your Subtitles Menu from showing at any time by checking Start game locked off? in its own list of properties.
  • edited June 2018
    Here is more info then:





    In a way i was trying to recreate the CSS float property, but that still really only works with text aligned to left.
    https://codepen.io/emilychews/pen/GmdZOb

    Yeah i know i was trying to do it with Unity UI.

    There's the main container and inside i want to display the speech text. I'm not sure it's possible to have the name label and speech text as two separate objects and achieve the desired positioning.

    1. The should't be a blank space between the name and speech text.
    2. The text should be centered to the whole container width not just to the speech text.

    And thus that's i want to make the label part of the text itself.

    So the goal is whenever a speach text is displayed insert a character's name into the text that the label holds.

    I've tried the thing you've suggested but it doesn't seem to be affecting the displayed text.

    Thanks for clarifying the subtitles off / on thing.
  • EDIT: I forgot to set the type to normal. I don't know why i thought i had to edit the dialogue line label directly when i can edit any label when i have both the text and character's name avaiable in the OnSpeech event. And skipping still works. So simple. Thanks & sorry for the long post. For some reason i can't delete or edit the post anymore.
  • No problem.  And don't worry about deleting the post - it'll be useful for anyone in future with a similar issue.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.