Hi.
Thought I'd share this. It's a python script that generates a bikb file and empty sound samples, the length of which are adjusted to the length of the text. I use it in all my missions to make radio messages, since it will have several distinct advantages over sideChat:
- kbTell and associated methods run without "sleep" or any other such measures. They're event-based, so you only need to have kbTell once and the event handlers can create a whole conversation for you.
- You can make menus, like in the Harvest Red campaign when you can decide whether to free the hostages or not
- It will not automatically capitalize all text, like sideChat does
- You can make real audio samples
How to use the script:
You will need to have the Python system installed, download it from Python.org (3.0 or later required). You will also need oggenc2. I've added it to the archive.
genBIBK works from a text file. The general syntax of the text file is.
[sentenceidbase] Text
sentenceidbase is what you get as sentenceId in your event handlers or in kbtell. It will automatically add a number to this. Text is what is going to be said. Example:
[radio] Eagle 2-1, this is Eagle Actual. We have incoming fast movers from the north-east. Over.
[radio] Roger, Eagle. Keeping our heads down. Out.
Put this into a file speech.txt and run the script as:
python genBIKB.py speech.txt
to generate three files:
speech.bikb
radio1.ogg
radio2.ogg
speech.bikb is the file with the sentence definitions:
Once you kbAddTopic the file to a couple of units (say, Eagle21 and EagleHQ) you can just do an
EagleHQ kbTell [Eagle21, "speech", "radio1"];
to make EagleHQ radio Eagle21. You will need the appropriate script and/or FSM for Eagle21 to reply, I believe Varanon wanted to post his generic solution for this.
You'll notice there are two radio1 tokens, radio1 and radio1a. The script automatically generates an empty token with "a" appended. This can be used for "silent responses", for example, if you want EagleHQ to send more than one radio message, you can have Eagle21 reply with radio1a to make sure that EagleHQ can send the second line when it "hears" radio1a.
If you have any questions, just ask
Thought I'd share this. It's a python script that generates a bikb file and empty sound samples, the length of which are adjusted to the length of the text. I use it in all my missions to make radio messages, since it will have several distinct advantages over sideChat:
- kbTell and associated methods run without "sleep" or any other such measures. They're event-based, so you only need to have kbTell once and the event handlers can create a whole conversation for you.
- You can make menus, like in the Harvest Red campaign when you can decide whether to free the hostages or not
- It will not automatically capitalize all text, like sideChat does
- You can make real audio samples
How to use the script:
You will need to have the Python system installed, download it from Python.org (3.0 or later required). You will also need oggenc2. I've added it to the archive.
genBIBK works from a text file. The general syntax of the text file is.
[sentenceidbase] Text
sentenceidbase is what you get as sentenceId in your event handlers or in kbtell. It will automatically add a number to this. Text is what is going to be said. Example:
[radio] Eagle 2-1, this is Eagle Actual. We have incoming fast movers from the north-east. Over.
[radio] Roger, Eagle. Keeping our heads down. Out.
Put this into a file speech.txt and run the script as:
python genBIKB.py speech.txt
to generate three files:
speech.bikb
radio1.ogg
radio2.ogg
speech.bikb is the file with the sentence definitions:
Code:
// Autogenerated file.
class Sentences
{
 class radio1
 {
   /* Projected duration is 8 seconds */
   text = "Eagle 2-1, this is Eagle Actual. We have incoming fast movers from the north-east. Over.";
   speech[] = {"\kb\radio1.ogg"};
   class Arguments {};
 };
 class radio1a
 {
   /* Empty token */
   text = "";
   speech[] = {};
   class Arguments {};
 };
 class radio2
 {
   /* Projected duration is 4 seconds */
   text = "Roger, Eagle. Keeping our heads down. Out.";
   speech[] = {"\kb\radio2.ogg"};
   class Arguments {};
 };
 class radio2a
 {
   /* Empty token */
   text = "";
   speech[] = {};
   class Arguments {};
 };
};
class Arguments{};
class Special{};
startWithVocal[] = {hour};
startWithConsonant[] = {europe, university};
Once you kbAddTopic the file to a couple of units (say, Eagle21 and EagleHQ) you can just do an
EagleHQ kbTell [Eagle21, "speech", "radio1"];
to make EagleHQ radio Eagle21. You will need the appropriate script and/or FSM for Eagle21 to reply, I believe Varanon wanted to post his generic solution for this.
You'll notice there are two radio1 tokens, radio1 and radio1a. The script automatically generates an empty token with "a" appended. This can be used for "silent responses", for example, if you want EagleHQ to send more than one radio message, you can have Eagle21 reply with radio1a to make sure that EagleHQ can send the second line when it "hears" radio1a.
If you have any questions, just ask
I don't need luck, I have ammo.