Forum rules - please read before posting.

Get SpeechOrder by script

In Speech Manager export text function, there is an option to include the SpeechOrder. Is there a way to get such SpeechOrder by script?

Comments

  • This can be accessed via the SpeechLine class's OrderIdentifier property:

    int myLineID = 10; // For example
    SpeechLine mySpeechLine = KickStarter.speechManager.GetLine (myLineID);
    string myLineOrder = mySpeechLine.OrderIdentifier;
    
  • edited May 6

    Actually what I am trying to do is, on top of this script:
    https://gist.github.com/zsoi/e928e9790409c37ce181#file-speechactionmasseditor-cs

    I wish to add the OrderIdentifier as a column in the editor, as well as sort the speechlines according to the OrderIdentifier. But it seems the above script get the speechlines by looping through all the actions in all the actionlists in the scene. In this case, is there a way to find the OrderIdentifier of the SpeechLine from the SpeechActions?

    I think having an editor window that diaplay OrderIdentifier, LineID, Speaker, and Original Text (and being able to modify the Original Text) would be very convenient. This feature kind of serve similar purpose to my another question of:
    https://www.adventurecreator.org/forum/discussion/10079/importing-speech-dialog-modified-in-a-csv-file (Thanks for considering adding such feature)

    I think the difference between the 2 features is that: an editor window is good for changing a few speechlines on the fly; while a csv file is good for editing the entire script.

    I understand it takes time to update AC with features. Would there be a quick hack for the above Github script so that I can use it at the moment?

    Thanks a lot

  • The update and feature will be out soon, pending approval from Unity. But it will require a CSV import.

    is there a way to find the OrderIdentifier of the SpeechLine from the SpeechActions?

    You could extract the speech Action's lineID and use it to locate it's associated SpeechLine, i.e.:

    KickStarter.speechManager.GetLine (speechAction.lineID).OrderIdentifier
    
  • edited May 7

    Good news that the new feature is on the way :)

    But for the script:
    KickStarter.speechManager.GetLine (speechAction.lineID).OrderIdentifier

    I always get lineID = -1, even though the Action is certainly an ActionSpeech and the dialog can be retrieved. The script I used is:
    (actionlist.actions [n] as ActionSpeech).lineID and it always return -1.

  • -1 is an unset value. Have the Actions been gathered up by the Speech Manager? The line's ID should be displayed in the Action's UI if not -1.

  • Ah got it! I haven't gather the text before using that.

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.
Do NOT follow this link or you will be banned from the site!