EDITOR PLUGIN: Speech Center - Version 2.2.0

Started by SpeechCenter, Thu 22/03/2012 14:50:32

Previous topic - Next topic

m0ds

QuoteThis version fixes the automatic numbering with translation problem

Ooh. Is that a fix on the issue I was having with it or someone elses?

monkey0506

Quote from: Crimson Wizard on Thu 10/10/2013 08:16:17PS. To clarify: this "Scripts" class is used not only to keep user scripts, it may be used for some internal purposes too.

Are you sure about that? Because I'm terribly worried you're just making this all up as you go. (roll) AGS.Editor.AGSEditor.GetInternalScriptModules: These are never added to CurrentGame.Scripts. Nor are any of the Dialog.Script objects. Nor are the UnloadedRoom.Script objects. The Scripts class is used for collections of scripts, but the exposed Scripts object never contains anything except the scripts shown in the ScriptsComponent. To clarify. :P

Crimson Wizard

Quote from: monkey_05_06 on Thu 10/10/2013 09:12:31
Quote from: Crimson Wizard on Thu 10/10/2013 08:16:17PS. To clarify: this "Scripts" class is used not only to keep user scripts, it may be used for some internal purposes too.

Are you sure about that? Because I'm terribly worried you're just making this all up as you go. (roll) AGS.Editor.AGSEditor.GetInternalScriptModules: These are never added to CurrentGame.Scripts. Nor are any of the Dialog.Script objects. Nor are the UnloadedRoom.Script objects. The Scripts class is used for collections of scripts, but the exposed Scripts object never contains anything except the scripts shown in the ScriptsComponent. To clarify. :P

Find Game.ScriptsToCompile. It is of "AGS.Types.Scripts" type.
Before game is compiled this collection is filled by all other scripts:
Code: csharp

foreach (Script script in GetInternalScriptModules())
{
    CompileScript(script, headers, errors, false);
    _game.ScriptsToCompile.Add(script);
}

foreach (ScriptAndHeader scripts in _game.RootScriptFolder.AllItemsFlat)
{
    headers.Add(scripts.Header);
    CompileScript(scripts.Script, headers, errors, false);
    _game.ScriptsToCompile.Add(scripts.Script);					
}

CompileScript(dialogScripts, headers, errors, false);
_game.ScriptsToCompile.Add(dialogScripts);


Well, maybe except room scripts, frankly I could be mistaken in regards to them. E: right, I am wrong, because rooms are compiled separately from anything else.

monkey0506

I wasn't contending that the Scripts type is never used for non-public scripts. I was asserting that the CurrentGame.Scripts object (which is of the Scripts type) is never populated with non-public data, or anything other than what shows up under the "Scripts" pane in the editor.

Edit: As to modifying the Scripts type to operate as a collection of ScriptAndHeader objects, there's absolutely no reason that ScriptAndHeader.Header couldn't be null. The relevant functions should then be updated to handle such a case. Currently the Scripts collection is actually quite messy in that you can't "Add" a header without an associated script, but you can add a script with no header. Then Scripts.Count returns the number of ScriptAndHeader objects, but the indexer accesses items based on the underlying Script objects. This is bad design.

Crimson Wizard

Quote from: monkey_05_06 on Thu 10/10/2013 09:29:29
I wasn't contending that the Scripts type is never used for non-public scripts. I was asserting that the CurrentGame.Scripts object (which is of the Scripts type) is never populated with non-public data, or anything other than what shows up under the "Scripts" pane in the editor.
Err, well, I never said that CurrentGame.Scripts contains other stuff; in reply to Snarky's question I said that
Quote
"Scripts" class is used not only to keep user scripts

monkey0506

Fair enough. :P But Snarky's question really seemed to be referring to the Scripts component rather than internal scripts... but anyway.

P.S. I edited my last post a couple times, just in case you missed any of it.




Edit: I pushed a fix for the reported issue, by updating the interface of the Scripts collection. It now operates directly on ScriptAndHeader objects exclusively. For scripts without an associated header, the Header property returns null. This may break some of the functionality you were using, because I've removed/replaced some of the exposed functions.

SpeechCenter

Quote from: Mods on Thu 10/10/2013 08:39:30
QuoteThis version fixes the automatic numbering with translation problem

Ooh. Is that a fix on the issue I was having with it or someone elses?
Should fix the issue you reported. Let me know if it worked out :)

SpeechCenter

Quote from: monkey_05_06 on Thu 10/10/2013 09:37:31
Edit: I pushed a fix for the reported issue, by updating the interface of the Scripts collection. It now operates directly on ScriptAndHeader objects exclusively. For scripts without an associated header, the Header property returns null. This may break some of the functionality you were using, because I've removed/replaced some of the exposed functions.
I just looked at the class and it would certainly break any plugin that runs on the beta but compiled with the release version, including mine.
So I don't think it's a good fix because everything in AGS.Types is exposed to the plugin. How am I supposed to support those who decide to use the beta? And if I change it, then those would use AGS 3.2.1 will not be able to use the plugin.
I also believe you can still have a backwards compatible enumerators and items accessor for the Scripts class even if the internal implementation changed to ScriptAndHeader. Then at least you don't break those that access the class. It's not extremely complex, but it will require some attention to some details.

So please don't leave this change as-is, it's going to be hell to maintain plugins if the interface breaks like that.

m0ds

Great! This time it worked, it's showing me it in English (the translation) and allowing me to export it like that. No need to use the workaround now it seems. Thanks a lot!! :D

m0ds

Hello again SpeechCenter :) I think I've run into an issue, or I'm doing something incorrectly.

The games default language is Italian and it has an English.trs (translation). Auto numbering works fine and it displays both the default language and the English translation all numbered fine, scripts generated okay. Now I compile the game and play it, and it's always showing Italian. Even with winsetup set to English.trs. Though it only appears to be dialog that's affected, as GUI elements are still translated, and the trs file is intact (with the English translation).

So I'm puzzled why this is happening. Any ideas? :)

SpeechCenter

Hey Mods,

AFAIK, AGS uses the full text with the &number as the key in order to determine the translation. If the original file does not contain the number in the original (Italian) line then it won't find the correct English line. So what needs to be done is to update the translation file (from AGS, not the plugin). I make sure to copy the translation with the new number into the translation data structure so when you update the translation it should be in there with the correct values. After that it should work.

You will actually see after updating that the translation file that it contains two sets, the original ones and the numbered ones (probably the original in the beginning and the numbered in the second half). This is an AGS behavior, it would be the same if you were to go to the script manually and change the line numbers on your own. It's not something major, it just means your translation file is bigger and has irrelevant lines. I think the right place to add cleanup is in the translation component since it's the one generating the file. It's probably possible to think of a script that removes the unnecessary lines in your specific case.

Still, it should work after you update the translation file, so it's best to start by verifying that.

m0ds

Thanks for the quick reply. I understand what you mean and have tried it.

What happens then is section two, the newly created & numbered lines in the trs file, only have the Italian version (default), and blank lines for where all the English lines would be, as usually happens when you "Update" the translation. How do I preserve the English lines and have the line numbers added to them in the trs file? Hopefully there's some way, because having to manually move all the translated lines from the first section into the second section would take me days if not weeks... Is there some method I can use or am I missing a step in AGS (or maybe speech center? though I think it's AGS like you say). Thank you :)

Edit. I've totally confused myself over this. If you can give me a step by step guide it would be useful, and now speech center won't display any of the English translation so I've either overwritten something...like I say, totally confused!!

SpeechCenter

The steps are:
1. open the project without the numbering and translation
2. Open Speech Center plugin
3. optionally filter out lines you don't want to number
4. Go to edit mode
5. Choose to number lines without numbering
6. Save game
7. Update translation file

Thinking about it a bit, if you have done all steps till 6 and closed the project then it's possible that when opening it again this new translation information was not saved because the file was not updated. Will have to check that.
If there's another reason it doesn't display the translation anymore need to understand what was done, it worked in my tests.

m0ds

Thank you for explaining :) Everything worked out this time and all is in working order.

m0ds

Hi again SpeechCenter. The script generation is very useful, however I've found that the index.html that gets created shows the number of ALL lines, including repeated ones. I'm wondering if there's any possibility of it being made to display actual number of lines (that need recording) and perhaps then total number of lines after that?

For example, 4 lines that all say "I don't need to do that." and get recorded once (ie all using EGO3.wav), get listed as 4 lines. Although this doesn't happen much with NPC's it's certainly a key factor in player lines, who often repeat what they say. The feature itself (of showing number of lines in the index.html) is very useful, I just don't think it's showing the most useful information. Does that make sense?

SpeechCenter

Yes, makes sense.
Currently the actual file per character does display the duplicate lines differently, but the index is just the total of all the lines.
It shouldn't be difficult to add to the index that since the information is already generated.

As a workaround you can filter duplicate lines in the plugin and export only the displayed line. It should generate the index file with the correct number of lines.
If you want to have the full scripts with the index file just copy the file to the same directory as the other scripts. The two options should generate the VO scripts in different folders so you don't need to rename things between the two actions.

Please see if the workaround gives you what you need.

m0ds

Thanks, so do not show duplicate lines via plugin and then export only displayed, created "Voice_Scripts_Partial" and THAT seems to be showing the actual number of lines that need recording in index.html. Thanks!

SpeechCenter

General note:
If you are using the AGS 3.3.0 beta and the plugin, please make sure to use beta 12 (build 3.3.0.1152) or above.
This release should fix any compatibility issues associated with editor plugins that existed in some earlier beta versions.
If you do find any problems with the plugin while testing the beta release then let me know.

If you are using the current release version (AGS 3.2.1), no action is required at this time.

SpeechCenter

Version 2.0.4 is out and available here.
Fixes a parsing error in some specific scenarios.

Nixxon

Can I just say that this is bloody amazing. Not sure where I would go from here without this plugin.

Top work.

SMF spam blocked by CleanTalk