S9ilent's Vocal Control *29/03/2015*

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

S9ilent's Vocal Control *29/03/2015*

Post by s9ilent » Thu, 11. Dec 08, 08:01

S9ilent's Vocal Control (SVC)
Log file, PageID 7742
tfile 7742, 7743


What: Voice Recognition Software (For windows), that interface with X3TC

Recent Changes
Completely re-written
Hotkey able
No more excel sheet


Files

SVC Download Link:
Last Updated: 29/03/2015
https://drive.google.com/uc?export=down ... lMzOXotRzg


Setup Procedure
1. Make sure your Microsoft voice recognition is enabled (Comes with Microsoft Word/Office or Windows Vista, is also downloadable for free)
http://www.microsoft.com/windowsxp/usin ... ber23.mspx See here for instructions to do so (XP)
For vista, just run through their very boring tutorial once.. You have to do it.. there is no shorter way...

If it's bringing up the Set up Voice recognition/microphone wizard, you haven't set it up yet and you can not continue till you've set it up.

1a. If you have Vista, then in that little bubble pop up menu, make sure its set to ON-always listening (right click on it to bring up the menu)
1b. If XP, make sure that in the language bar thing, that the microphone is clicked.
(Note the above menu's pop up when you open the SVC program, or similar)

2. Unzip the files to a directory (any will work, but NOT!!! in the x3 directory!!!)
3. Run the application
4. Press Start Recognition
5. Start X3
5a. Turn on subtitles to see order confirmation
6. Say stuff

Note, you "may" or may not need some DLL's as well, if so, just download this zip, and unzip it to the same directory that the SVC program is in.
http://www.4shared.com/file/95871698/21 ... _dlls.html
This happens if you have not installed ,Net 3.5 framework

Turn off procedure
1. Go into X3 (into your current game)
2. Press escape, go to gameplay options, go to Artificial Life Settings
3. Select S9ilent's Vocal Controller, and switch it to no



Uninstall Procedure
Either:
1a. Start X3 (with SVC enabled)
Go in to your game, say "computer remove and uninstall S V C"
---or---
1b. run the script plugin.svc.remove

2a. 2b. Then delete the script files (and the program too)
The scripts are in the gamefolder\scripts\ folder
And the ones you HAVE to remove are:
al.plugin.svc
al.plugin.svc.add
My other script files shouldn't run. But you can delete them if you wish




To Do list
-Consider changing from an AL loop script, back to a global loop script (to get more control of the timing)



And lastly, Ideas? Comments? Suggestions? Post away
Please post ideas on what you would like to control with your voice?
Please provide link to script, and an example of what "phrase" should set off the script




29/03/2015 Update


Improved other language support:
x3tc.xml has the langid removed from the grammar as it only seems to increase the number of errors. (By default with no langid specified, it would use the default of the system; where as if you specified one and the system used the other it would bring up an error e.g. english UK is not the same as engllish US)

Improved error feed back:
Replaced the generic error with one that actually specified the underlying error that can be looked up here: https://msdn.microsoft.com/en-us/librar ... s.85).aspx
(If you do get an error either reply in this thread of message me and Ill decipher what it means)

Improved newer window version support (i.e. versions after xp, e.g. vista, 7, 8 etc):
Replaced the "shared" context with an inproc one. This means that it will no longer conflict with windows vista/7 (/later versions?). (Originally I made this in windows xp that didn't use the shared context, but in later windows voice recognition can be used to control windows it self and would make my program/windows fight each other for control and cause input lag)

Changed upload location to google drive
Last edited by s9ilent on Sat, 28. Mar 15, 22:59, edited 86 times in total.

ragod
Posts: 266
Joined: Fri, 28. Nov 08, 08:10

Post by ragod » Thu, 11. Dec 08, 08:19

I would vote for CyCrows easy marine script for compatability

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Thu, 11. Dec 08, 08:25

Current WORKING script list
06/01/2009

1. Designate target (defines the player target as alpha-epsilon/echo ##)
2. Basic commands. Orders previously designated target to :
-attack xxx
-attack all enemies
-protect xxx
-dock xxx
-follow xxx
-fly to home base
-attack all fighters
-attack all big ships
-attack my targets shields
3. Basic Wing commands. Same as above, but for wings specifically
4. All xxx commands. eg Order all fighters to xxx:
4. Fire missile yyy
5. Uninstall svc


Current WIP script list
06/01/2009

5. Equip weapons load out
I will have to either search for a script, or make my own. tatakau has a script for it, although, given the simplicity of the script, and the fact that tata's script is pre-set to 3 load outs, I might just make a new one. I'll take a look at it first thou

9. Add in more carrier orientated commands.

11. note to self, P: x attack the shields of y

12. Ordering the player ship

13. X fire missile (y) at z. (After considerations, it will not use LV's script as this isn't really an M7M command, but rather a general combat command for non-missile spamming ships)

14. X load missile y

15. Flight manoeuvres

Remove the scripts AL ness, and switch to a standard hotkey + global timer


Current Problematic List
A though just occurred to me... SETA... will make it run 10x faster.. (which is undesired). I will have to do something about it.. and I might consider speeding up time to 0.5s refreshes, instead of 1s refreshes
Possible solution- Use textid 1 as a interval counter. If interval is == old interval, wait n + 1 seconds. (Where n is a count up and count down timer of the number of repeated ticks, n counts down at 1, and counts up at two, and maxes out at 10)
Give the option to turn this off - Or give a hotkey to run last voice command now
Last edited by s9ilent on Tue, 21. Apr 09, 07:04, edited 35 times in total.

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Thu, 11. Dec 08, 08:49

nice very nice s9ilent ;) I can help you with the XML file if you need any help ;)
-Get/record confirmation audio samples. eg. "Delta execute" r:"Delta on the bounce"/"Delta Executing" (although.. I'd prefer not to use the triggering words in the confirmation phrase, cos I know some mics do feed back, and nobody likes infinite loops)
You could use the text-to-speech interface that's also in windows, it should be on your pc by default but also in SAPI. Maybe to prevent IL's from microphone feedback you might want to stop "listening" while the computer is speaking, I don't speak when my computer does anyway, it only confuses me with what I really wanted to say. I don't know if that's possible or if it's useful, but it's how I would solve it :roll::shock:

Anyway, good luck with the to do list ;)

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Thu, 11. Dec 08, 08:56

Another of my on going projects is to bring a more personal touch to X3, as all of your stuff is AI controlled, and the other races AI, well they are AI, and rather robotic (a little less in tc then in X3r in my opinion, but I haven't played it much)


And I think something as simple as order confirmation (by a human voice) will add wonders. Think of any rts, when you give an order, they always say something back. Also voice control can be ... finicky at times, so giving feedback that it did work, and what exactly did it do is a must.

DarthGeddes
Posts: 2
Joined: Thu, 11. Dec 08, 08:26
x3tc

Post by DarthGeddes » Thu, 11. Dec 08, 08:58

/signed.

I think this is a great idea! I myself have shoot working with X3 TC but it sometimes delays keystrokes (30s+). I can confirm it has no noticeable impact on performance with a mid range computer.

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Thu, 11. Dec 08, 09:06

Just one more comment s9ilent, you know that TC also confirms some commands, so are you going to replace those as well, or just exclude them from your program? Just thought I'd remind you of that ;)

O yeah some more good luck :P (I have plenty of that stuff over here :lol:)

Edit: You'd might want to add sectors to the common list as well ;) btw, do you still want me to post the script I made for that? (I kinda had forgotten about it :shock:)
Last edited by (----____JEFF____----) on Thu, 11. Dec 08, 09:48, edited 1 time in total.

User avatar
enenra
Posts: 7150
Joined: Fri, 8. Apr 05, 19:09
x4

Post by enenra » Thu, 11. Dec 08, 09:47

Make sure to make it translation-friendly. :)

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Thu, 11. Dec 08, 09:50

That might be a problem, SAPI is only released in English, Japanese and one other language I can't remember. At least that's what I read somewhere, I don't know if that was old information though.

Edit: Simplified Chinese was the third language :shock:, but you don't really have to worry about accents I think, I mean I don't have a English accent and it understands me just fine ;)

User avatar
enenra
Posts: 7150
Joined: Fri, 8. Apr 05, 19:09
x4

Post by enenra » Thu, 11. Dec 08, 10:08

(----____JEFF____----) wrote:That might be a problem, SAPI is only released in English, Japanese and one other language I can't remember. At least that's what I read somewhere, I don't know if that was old information though.

Edit: Simplified Chinese was the third language :shock:, but you don't really have to worry about accents I think, I mean I don't have a English accent and it understands me just fine ;)
Sounds good. I might have to print out a command list, tho. ^^

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Thu, 11. Dec 08, 11:40

Thanks for the offer to help jeff :)
I'll take any help where I can take it


But, I dont really need help in actually xml-ing it, but if your willing to create the actual vocal commands (eg the {Cname} load {missiles}, in excel?
Pretty much, just create a table in excel, where you put each item in its on column. (And if its a list, put each list item, in the next row)
Hm... and optional... I dont know.. maybe put a xxx at the front of the itemhm.. or maybe a slash.. or those square brackets...

I still need to make the excel-> xml thing, but Ill have to do it tommorow. I was just tidying up the actual app today

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Thu, 11. Dec 08, 13:30

Alright I'll try to make the excel file ;)
Pretty much, just create a table in excel, where you put each item in its on column. (And if its a list, put each list item, in the next row)
Hm... and optional... I dont know.. maybe put a xxx at the front of the itemhm.. or maybe a slash.. or those square brackets...
Can I also put things in columns? I think it's easier to read a large list in a column then in a row. Actually do you want me to make a list of wares and sectors and stuff? No problem if you do mean that, I just don't quite understand ;)
And about the xxx or slash or square brackets, I don't really understand where to add one of those. Should I put them before all objects and stuff or around or just the variables and not the objects?

Also can I use empty columns/rows to make it easier to read? And what about tabs, can I use multiple or is it easier for you if everything is on one tab?

Also if you have any other things to do and I can help with, I'm willing to do so ;) I kinda came up with the idea, so I really want to help with realizing this ;)

Edit: s9ilent I added a link to this topic with my video on youtube ;)

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Fri, 12. Dec 08, 04:33

Cheers for the link to this post Jeff,

I've put up the excel file that I will be working off. It doesn't do anything yet (i.e. the button doesn't work)

http://members.optuszoo.com.au/whyistha ... ontrol.xls

But I have noticed, the speech recognition is actually fairly good at recognising words. For instances.. I had to be saying incendiary as in-sin-din-airy instead of in-sin-dairy.

Hm... yep thats all I can think of saying now
Oh and did you know, Visual studio actually has a 30 day expiry :P
So.. in 1 months time (I'll be finished long before then) I wont get able to upgrade the program.

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Fri, 12. Dec 08, 09:15

That's kinda buggers that you have only one month, but it's good to hear you'll get it done before that :D We can still update the XML/excel after that, right?
I'll start adding some stuff to the excel when I get home tonight or sometime after the weekend. I have to do a important presentation on Tuesday so I need my weekend to prepare, but after the presentation I have vacation :D
I still need to post that damn script though *smacks head on table*

Edit: alright s9ilent I did some work on the excel file and I'd like you to take a look at it to see if I didn't make any structural mistakes. I just looked at what commands you made and the examples so I think I got it, but I just want to be certain. If this is all good I'll continue with more commands ;)

click here

Edit2:

This is the script I promised, it's supposed to be a kind of library.

Code: Select all

* This part is for sectors

$max.sector.x = get max sectors in x direction
$max.sector.y = get max sectors in y direction
while $max.sector.x > 0 
  dec $max.sector.x =
  while $max.sector.y > 0 
    dec $max.sector.y =
    $sector.at.xy = get sector from universe index: x=$max.sector.x, y=$max.sector.y
    $input.compare = sprintf: fmt='%s', $sector.at.xy, null, null, null, null
    if $input == $input.compare 
      $output = $sector.at.xy 
    end
  end
  $max.sector.y = get max sectors in y direction
end
return null

* This is for wares, the $input.type is mainly to speed up the process of searching, instead of all wares, just the subtypes of one maintype

$amount.subtypes = get number of subtypes of maintype $input.type
while $amount.subtypes > 0 
  dec $amount.subtypes =
  $object = get ware from maintype $input.type and subtype $amount.subtypes
  $input.compare = sprintf: fmt='%s', $object, null, null, null, null
  if $input == $input.compare 
    $output = $object 
  end
end
return null

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sat, 13. Dec 08, 22:13

Firstly, thanks for the scripts Jeff (atn: Good news)

I've just finished decipering 99% of the xml now! (Woo!)
I have good news and bad news


Firstly Good news
I've found a way to get the speech reco to return both the actual recognised text, AND ... I think they call it.. semantic properties?? Any way, return variables defined in the xml.
Eg so instead of having to compare "bala gi" with the sector "Bala gi" (I will need to fix up capitol letters later)
I could simply return the variable x = # y = #
(I still need to test on returning two vales for a single phrase thou, otherwise I might use just one long number to represent them both, eg x=100 y = 42 ret = 100042, but then a max of 999 would be applied to each digit, and I think it may be restricted to the integer data type

Bad News
I'm still not to sure why some returns can use strings, whilst most can only use integers...
Having learnt about the returns.. my excel sheet to make the xml.. is going to become much more complicated.. (Currently it works 100%, but doesn't use returns at all)

And a final note on the excel sheet. I found that I wasted about 3 hours trying to figure out what was wrong with it, until I realised it was because I made a typo. If you reference, another phrase (or a list of phrases) make sure the phrase actually exists.
(Eg. say for example you where trying to reference a phrase named "ship", but it didn't exist, it wouldn't work... grrrr sif I forgot that I called it "shipSSSS")
Short story, the excel sheet is not typo friendly
(And I'm not going to write a compile checker in the near future)


*Edit* *sigh* I can not return two from a single phrase, only 1. So you will have to con-ac?-atate? join the two numbers, and un join them.
And return variables come in the form of variable name (string) and var value (integer), so that should work well. (And you don't need both, you can use just one or the other, in which case you will get (nothing) for string, and 0, for the integer

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Sun, 14. Dec 08, 11:25

So I understand you figured out how to return a variable or integer and control which one? But you can only return one thing, right?

I have to say that I like comparing names better, it'll make the system more user friendly because you don't have to give all the sectors their coordinates. And there is less work to modify it for universe map mods. The only down side is that you can't know the difference between the unknown sectors (or any others with the same name), the script can identify those sectors via some sort of id number, but the voice recognition can't (unless you make something for that :roll:).

Anyway did you look at the excel sheet I made? Did I do everything properly?

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 14. Dec 08, 12:30

Yes I looked at the xls, and I've copied over all the additions to my sheet :)
(My new sheet has some new changes that I'm still thawing out atm, will upload soon)

As for the ret variables, strictly speaking, it should return both a string and a number, for every single phrase (if the phrases has one). (Note that a single phrase can be comprised of other phrases, but that doesn't really help with sector co-ordinates- as it only returns 1 string, and 1 integer per phrase)
If you don't include a string, the ret string is "" (Null), and if you don't include an integer, the ret integer is 0.

That is a good point you bring up thou, for custom galaxies, using the name would be a better way of doing it. \



And a final comment on the user friendly-ness, to be honest, I need it to be user friendly enough for scripters to be able to use interface their scripts with it, and for users to be able to add their scripts to it (e.g., copy in their phrase(s) to the xls, bam working)



*Last edit for tonight*
Well.. I'm spent.. For today at least. I've hammered out the return variables on both the XML and the actual program it self. There is one thing left I want to do on the XLS, and that is ... wait two things
1) Write up documentation on using it
2) Make it print out the phrase ID's (Right now it just prints "something"), as they are assigned earlier on, and VBA can't really have an "append to array" so I can't effectively save an array of varying size. That, and I can't think of a situation when knowing the list number (which is automatically generated, i.e. random, is more important then its name)

Any way, I'm uploading my prototype voice recognition program, and the mk3 excel sheet. The prototype doesn't do anything with x3 at the moment. All it does is recognise your phrase, and display return all variables.
(Links will be in the original post, 5 minutes from when I last edited this message)

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Sun, 14. Dec 08, 14:42

Sweet, s9ilent ;) It works really good, though I have trained my voice recognition quite a bit now :D

I'll start adding some more commands and report back to you soon :D

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 16. Dec 08, 09:09

Tada!!!

Debug version, 100% completed
It is now super user friendly.. welll I've made the window bigger (And thats pretty much the limit of the user friendly ness)

I've taken out the obsolete check box and label.

And most importantly, it now interfaces with the 7742 tfile and log file (07742 log file)

It auto updates every ... 10 seconds on this version (I'm calling this the testing version) simply because, it keeps auto replacing the tfile, so putting it to 3 seconds would make it very hard to "see" it working. (As most phrases are probably 2.5 seconds long, which gives me enough time to see it flash for half a second then Vwoosh gone)

Any way, this is more of a rant post, I'll put the main details in the OP


[I'm updating the main post right now, I'll take this down when its done]

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Tue, 16. Dec 08, 10:05

that's good news s9ilent, I'll try it as soon as I can ;)

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”