Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ VBscript
➜ Speaking MUD text
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Thu 25 May 2006 02:24 AM (UTC) |
Message
| if you are a Windows XP user, or have installed Office XP or later, you have something called TTS (text to speech), and VBScript allows you to control the COM object for such a thing.
Below is a copied trigger i made, that SPEAKS everything said that it matches.
I do NOT recommend using this on a spammed channel, or something that occurs VERY often, as it will delay the program until it is done speaking whatever it has matched, which 1-2 seconds is not bad, but CAN be disasterous!
I am probably going to use this knowledge to make something that watches for blindness, failed blindness, and other successful and unsucessful status changes, then speaks a short phrase accordingly, as in the heat of battle seeing the text scroll by in the blink of an eye it can be missed, and then be difficult to continue the battle, while wondering why you cannot land an attack ... haha.
<triggers>
<trigger
expand_variables="y"
ignore_case="y"
keep_evaluating="y"
match="^(.*?) gossips \'(.*?)\'$"
name="gossip_speak"
regexp="y"
repeat="y"
send_to="12"
sequence="1"
>
<send>dim talk
set talk = createobject ("SAPI.SpVoice")
talk.Speak("%0")
talk = 0</send>
</trigger>
</triggers>
Enjoy...
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 27 May 2006 09:55 PM (UTC) Amended on Thu 01 Mar 2007 08:40 PM (UTC) by Nick Gammon
|
Message
| This is great! I thought getting speech to work was harder than that. I have done a similar thing in Lua too:
assert (loadlib ("luacom.dll","luaopen_luacom")) ()
-- Instantiate a SAPI voice object
talk = assert (luacom.CreateObject ("SAPI.SpVoice"), "cannot open SAPI")
-- Method call
talk:Speak ("hi there")
The link I used to download the luacom.dll was:
http://luaforge.net/frs/download.php/922/luacom-1.3-luabinaries-bin.zip
My only comment on your code is, it would be better to create SAPI once (eg. in a script on World startup) rather than for every trigger. Your method is going to be much slower as the SAPI object is created, and then destroyed, every time the trigger fires. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Ked
Russia (524 posts) Bio
|
Date
| Reply #2 on Sat 27 May 2006 10:13 PM (UTC) Amended on Sat 27 May 2006 10:23 PM (UTC) by Ked
|
Message
| This is indeed great, but I wanted to comment on the "pausing the program" part. In order to avoid Mushclient locking up while the text is being spoken you can make Speak() run asynchronously by passing it the SPF_ASYNC flag, which is equal to 1:
tts.Speak("Hello world!", 1)
or
tts:Speak("Hello world!", 1)
in Lua.
The full SAPI 5.1 reference is at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesapi/html/ceconSAPIReference.asp
The reference for the ISpeak interface (which is what the Speak() methods represents) is at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesapi/html/cerefISpVoiceSpeak.asp
And the listing of all SPEAKFLAGS that Speak() recognizes is at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesapi/html/ceconSAPIEnumerations.asp
Also, if you wanted to "interrupt the current programme" in order to speak some emergency message, you can OR together the SPF_ASYNC (1) and SPF_PURGEBEFORESPEAK (2) flags (producing 3):
tts:Speak("Behind you!", 3)
That will discard the entire queue of pending messages and speak that one immediately.
P.S. I am confused - doesn't asynchronous mean "do in order", as opposed to "do in parallel"? In other words, doesn't async in this context mean exactly the opposite of what it really means? | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sat 27 May 2006 10:45 PM (UTC) |
Message
| Thanks for all that. The asynchronous stuff is a great idea.
I have done another thread to do a bigger example in Lua:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6593
This speaks a warning when your health is low. The warning says the actual health level, which is probably more useful than simply playing a sound, as you will notice it, even with lots of messages scrolling by.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #4 on Thu 01 Jun 2006 01:02 PM (UTC) |
Message
| The method for async speaking does not work via the trigger method i posted, perhaps via a single object created in a plugin, and then spoken to only that single object.
Just thought I'd put that up there for anyone that was planning on using the simple trigger..
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #5 on Thu 01 Jun 2006 09:29 PM (UTC) |
Message
| Yes, destroying the object with "talk = 0" probably makes it hard for it to do asynchronous speaking.
The method I used in the other post, using Lua, shows how you just create the object the first time you need it.
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6593
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #6 on Fri 09 Jun 2006 05:38 AM (UTC) |
Message
|
Quote:
P.S. I am confused - doesn't asynchronous mean "do in order", as opposed to "do in parallel"? In other words, doesn't async in this context mean exactly the opposite of what it really means?
It means "not synchronized" - that is, the speech (in this case) is not synchronized to waiting for the command to end.
I looked up the definition in Google, and this was part of the answer:
Refers to events that are not synchronized, or coordinated, in time. ... Starting the next operation before the current one is completed.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #7 on Wed 28 Feb 2007 12:52 PM (UTC) |
Message
| I am in the process of making a plugin in VBScript, that will allow altering of speed of the text, and also possibly some customization of the voice used.
I am making it in VBScript cause I am unsure if version 3.74 of mushclient will cooperate with the LUA com interface, and if someone can tell me that it positively does, then I will consider converting it into an LUA plugin then.
I will post results when more developed, so probably later tonight :)
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #8 on Wed 28 Feb 2007 08:43 PM (UTC) Amended on Thu 01 Mar 2007 08:40 PM (UTC) by Nick Gammon
|
Message
| Do you mean 3.84? The latest version?
I have positively tested it to work OK under 3.84, using this slightly revised script (changed loadlib to package.loadlib, and the entry point name in the DLL has changed):
assert (package.loadlib ("luacom.dll","luacom_open")) ()
-- Instantiate a SAPI voice object
talk = assert (luacom.CreateObject ("SAPI.SpVoice"), "cannot open SAPI")
-- Method call
talk:Speak ("hi there")
You also need the luacom.dll designed to work with Lua 5.1. That is available in this directory:
http://www.gammon.com.au/files/mushclient/lua5.1_extras/
See the readme.txt file for more details. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #9 on Thu 01 Mar 2007 11:23 PM (UTC) |
Message
| No I mean 3.74, which is the version I use regularly, and I do so, so that I can guarantee that my plugins will be several versions backwards compatible, as MANY people that use my plugins are still using version between 3.74 and 3.78.
From my understanding from the posts about LUACOM the entry point had been moved between versions 5.0 and 5.1 of LUA, and in that having happened that will require 2 different versions of my plugin then. And that is something I have been able to avoid, even with the slight differences between 5.0 and 5.1 of LUA.
Thanks,
Onoitsu2 | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #10 on Fri 02 Mar 2007 04:42 AM (UTC) |
Message
| You can detect the Lua version from the _VERSION variable, and modify the behaviour of your script slightly accordingly. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #11 on Sun 04 Mar 2007 10:22 AM (UTC) Amended on Sun 04 Mar 2007 10:23 AM (UTC) by Onoitsu2
|
Message
| I do believe that I have made a VERY simple TTS plugin, that can be implemented into virtually ANY scripting scheme, it uses CallPlugin to set the options for a TTS message, and has 2 queues, normal and alert, which will interrupt a normal item and will then replay the interrupted normal item from the beginning. EACH Message can have a different voice and rate, that is set just PRIOR to the actual message to be spoken. So 3 CallPlugin commands in a row in any 1 trigger or alias can mean... Rate Voice Message, Voice Rate Message, Rate Message, Voice Message, or just Message (which will run at default rate 0, and whatever the default voice is set to within the plugin via an alias).
I also have a sub in it that will "Reformat" some symbolic words/meanings and neologisms that are now quite common.
the url is: www.torasin.com/~venificius/MUSHclient_ttsVB.xml
I tried posting it but is 8471 Chars long says SciTE.
You can also get it via my Zip or Installer Versions of my Plugins...
ZIP'd Plugins - www.torasin.com/~venificius/AardwolfMC_Plugins.zip
Installer Version - www.torasin.com/~venificius/Aardwolf_MC_Plugins.exe
THE SERVER IS SADLY VERY CASE SENSITIVE!!!! So please copy the links EXACTLY as I have posted them
Laterzzz,
Onoitsu2
| Top |
|
Posted by
| Thellasian
(9 posts) Bio
|
Date
| Reply #12 on Thu 16 Apr 2009 01:53 AM (UTC) Amended on Thu 16 Apr 2009 04:26 AM (UTC) by Thellasian
|
Message
| Hmm...Ok im usin what im findin here but im a idiot when it comes to this stuff...For the MUSH can somone make a script that only reads lines after "(Web): #######" where anything after the (WEB): is spoken? Just wanted to try this for fun and after 5 hours im tired and dun wanna mess with it if I dont ahve to. Thanks.
Edit: ohh and im usin Vista if that matters.
2nd edit: I am using the program from http://mushclient.com/mushclient/plugins/sapi.xml To attempt to get it to work. But I cannot seem to figure out how to tell the sub command to only activate on (WEB): promts and repeat what comes after the prompt when recieved from the World. Any ideas?
Example
wt but my triggers arent working.
(Web): You say, "But my triggers arent working."
H:2113 M:1385 B:100% [c eb]
Want reading to start after (Web): and end on ." at the end of the line.......but it likes to start reading at the prompt of H: and end on the end of the line above it.
| Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #13 on Thu 16 Apr 2009 07:53 AM (UTC) |
Message
| I would install SAPI at some stage (eg. in your script file) like this:
set sapiobject = CreateObject("SAPI.SpVoice")
Then make a trigger that does "send to script", which matches the things you want to speak, and in the script:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Thellasian
(9 posts) Bio
|
Date
| Reply #14 on Thu 16 Apr 2009 05:10 PM (UTC) |
Message
| Heh, there in lies the problem. No idea bout triggers in general. I tried to set it using a general <Triggers> <trigger/> command but it refused to apply to that trigger only. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
85,045 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top