Playing sounds via console command

Playing sounds via console command

Postby ZeroKnight » 16 Aug 2011, 23:41

So, writing my Extended Compass mod, I noticed that colored text doesn't get recognized as a valid string to play their associated player voice sounds. (like argh!, nice shot, sorry, etc.) I know why, it's because of the formatting that goes before the actual text, which causes it not to match the valid ones.

So, one of my ideas was to simply show the text, AND play the voice manually with a command, but after an hour of looking through commands and referencing vanilla RE files, I can't figure out how it's done. Is there a command, or a set of commands I can use? Other than including a modified voices.cfg file with my mod, I'm really not sure how else to go about this. I'd rather not do that, but I will if there's no other way.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Playing sounds via console command

Postby srbs » 17 Aug 2011, 03:31

I would help, but I'm not entirely sure whats going on.. lol
How about an example?

srbs
Clarification: I don't actively play RE, but I am a cubescript expert.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Playing sounds via console command

Postby ZeroKnight » 17 Aug 2011, 23:11

Sorry. Let's see how well I can explain. In RE, when certain phrases are typed over chat, the game will play a sound, which is the player characters' voice. For example, saying "sorry" over chat will play a sound that all can hear, which will be in the PC's voice saying "sorry". Other ones include "damn", "nice shot", etc. Even though you don't play actively, I'm sure you've heard one of these at least once or twice.

However though, I think this is something more to RE code than Cubescript :/
Basically all I want to know is how to play a sound from the RE console, because adding color to the chat prevents the chat string from being recognized, and the voice isn't played.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Playing sounds via console command

Postby srbs » 19 Aug 2011, 07:50

Hmm, I would say that the only way would be the modified voices.cfg or a source fix. You can always change the on_text command in your script instead.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Playing sounds via console command

Postby ZeroKnight » 19 Aug 2011, 23:00

Does anyone know the syntax for REGISTERSOUND? In my script, I could just have the phrase said, AND using registersound to play a sound. It has to be registersound because that way all players will hear it. Since I'm only going to be utilizing a few of the default RE player voices, this wont be a problem. But what's the syntax?

[EDIT] Well, I made a function that gets the sound's index number and plays it:
{l Code}: {l Select All Code}
playvoice = [
    voiceindex = (registersound $arg1)
    sound $voiceindex
]


However, this only works locally, and no one else can hear the sound. My question still remains: how is it done in voices.cfg? It's really obfuscated, so it's hard to tell exactly how it plays sound...and for everyone to hear, nonetheless.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Playing sounds via console command

Postby qreeves » 20 Aug 2011, 01:26

No matter what you do it will be local only. voices.cfg processes the on_text event fired by the engine when someone says something, it then tries to match the text to one of the phrases, if it finds a match it returns the sound index (which is stored by the script from the result of registersound) so the engine can play it with positional audio effects for that player. Changing it for one person won't make it work for everyone, it only works now because voices.cfg (and the associated sound files) is distributed with the game :P

I've modified the on_text event in voices.cfg in SVN to filter out colour codes, if that helps.
Quinton "quin" Reeves | Lead Developer, Red Eclipse | http://redeclipse.net/ | http://www.facebook.com/redeclipse.net
User avatar
qreeves
 
Posts: 1294
Joined: 17 Mar 2011, 03:46
Location: Queensland, Australia

Re: Playing sounds via console command

Postby ZeroKnight » 20 Aug 2011, 01:36

qreeves {l Wrote}:No matter what you do it will be local only ... Changing it for one person won't make it work for everyone, it only works now because voices.cfg (and the associated sound files) is distributed with the game :P


I came to that conclusion a moment ago, haha. I'm checking out the modification now, will post back in a minute.

[EDIT]
Nice! I'm glad the voice will trigger on color text now. I tried mutlicolored letters and it still worked. Thanks, quin. Can you clear up something for me, though?
I'm not familiar with the engine's on_text command, so what does $arg4 link to? And why does filtering it make the colored chat recognizable? Just curious :)

[EDIT 2]
RE: The post after this one: Ah! Now that you added that little fix I could do that! Testing now.
[EDIT 2.1] Oh wow, quin, thanks! Now I can play "gogogo" with my "Capture the Flag!" phrase! :D
Thanks a lot for that update quin. I can't wait until that goes final :D
Last edited by ZeroKnight on 20 Aug 2011, 01:55, edited 3 times in total.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Playing sounds via console command

Postby qreeves » 20 Aug 2011, 01:39

All you *should* need to do is load a script with "addvoice" commands in it, theoretically.
Quinton "quin" Reeves | Lead Developer, Red Eclipse | http://redeclipse.net/ | http://www.facebook.com/redeclipse.net
User avatar
qreeves
 
Posts: 1294
Joined: 17 Mar 2011, 03:46
Location: Queensland, Australia

Who is online

Users browsing this forum: No registered users and 1 guest