recording speech
Moderator: Event DM
- Neve
- Prince of Bloated Discourse
- Posts: 192
- Joined: Mon Apr 14, 2003 4:09 pm
- Location: The Netherlands
- Contact:
About the floaty name over a null human issue : you can apply EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY) on it to make it totally invisible, even for the mouse pointer 

- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
- NoneOf Seven
- Knight of Useless Drivel
- Posts: 50
- Joined: Mon May 26, 2003 8:19 am
- Location: in your shadow
- Neve
- Prince of Bloated Discourse
- Posts: 192
- Joined: Mon Apr 14, 2003 4:09 pm
- Location: The Netherlands
- Contact:
Sorry, I only just found that =p
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
It's simply a matter of parsing the spoken text into words using FindSubString. Add this to the OnSpawn of the creature listening:
And then use this script for the UserDefined script to detect speech and parse the words...
For now all this does is listen to all things spoken near the NPC and repeat the words back to the speaker, parsing them out. It also stores them in an array of Local strings for other uses. You should be able to modify this to pick any number of words out, and do anything with them that you wish to, like send them to another PC or have another invisible object speak them aloud using SpeakString. It will strip extra spaces out without counting them as words as well.
Myk D'Vor
Code: Select all
SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004
SetListenPattern(OBJECT_SELF,"**",777);
SetListening(OBJECT_SELF,TRUE);
Code: Select all
#include "nw_i0_tool"
#include "nw_i0_generic"
void main()
{
int nCalledBy = GetUserDefinedEventNumber();
if(nCalledBy==1004)
{
if (GetListenPatternNumber() == 777)
{
object oPC = GetLastSpeaker();
string sText = GetMatchedSubstring(0);
object oSelf = OBJECT_SELF;
int iSpace = FindSubString(sText," ");
int iRight = GetStringLength(sText) - iSpace - 1;
int iWordCnt = 0;
string sWord = GetStringLeft(sText,iSpace);
string sRemaining = sText;
if(sText=="") return;
while(iSpace>=0)
{
if(iSpace>0)
{
SendMessageToPC(oPC,"Word "+IntToString(iWordCnt)+": "+sWord);
SetLocalString(oSelf,"Heard word"+IntToString(iWordCnt),sWord);
iWordCnt++;
}
sRemaining = GetStringRight(sText,iRight);
iSpace = FindSubString(sRemaining," ");
iRight -= (iSpace+1);
sWord = GetStringLeft(sRemaining,iSpace);
}
sWord = sRemaining;
SendMessageToPC(oPC,"Word "+IntToString(iWordCnt)+": "+sWord);
SetLocalString(oSelf,"Heard word"+IntToString(iWordCnt),sWord);
SetLocalInt(oSelf,"Heard word count",iWordCnt);
}
else return;
}
return;
}
Myk D'Vor