GlovePIE script - Command your troops with the microphone

正在查看此主题的用户

shokkueibu

Knight
Hi there :smile:

Today I suddenly got this urge to command my troops with the microphone and I knew I had seen something about this on the forum in some topic.
Me and Shoot didn't get along well so I tried GlovePIE (also mentioned in that same topic).

So far it's been great :grin:
Windows 7's speech recognition seems quite good. I've trained it a bit so it even picks up my bad English :razz:

I made this script that should cover all of the orders. Also, this makes use of the game's F1 key feature(What's it called again?): if you say "go" a flag appears under the crosshair (holds F1). You can then look at a place and say "there" to tell the selected troops to stay in that place (releases F1).


To get GlovePIE go here.

Just paste the following code in GlovePIE's and save it somewhere if you plan to reuse it later. Don' t forget to click Run :grin:
Be sure to change the key you want to activate Push-to-Talk if you don' t like it (default is CapsLock, it's right on the beginning of the script).

插入代码块:
/*
        Mount & Blade Warband - Troop orders script
        May 28 2010
        by shokkueibu
*/



/*
  Delay between pressing and releasing a key and between keypresses.
  20 miliseconds works fine.
*/
var.delay = 20ms

/*
  Push-to-talk key (Microphone.PushToTalk doesn't work, this is the way to go)
*/
Microphone.Enabled = CapsLock

/*
  Teamspeak Push-to-talk button
  (just a precaution since you already have a P2T key above)
  This might become useful if you disable Push-to-talk
*/
Microphone.PushToNotTalk = Mouse.Button4

/*
        SELECTION
*/
if said("everyone") or said("soldiers") then
   Press zero
   wait(var.delay)
   release zero
endif

if said("infantry") or said("footmen") then
   Press One
   wait(var.delay)
   Release One
endif

if said("archers") or said("crossbowmen") then
   Press Two
   wait(var.delay)
   Release Two
endif

if said("cavalry") or said("horsemen") then
   Press Three
   wait(var.delay)
   Release Three
endif

if said("others") or ("everyone else") then
   Press Key.Equals
   wait(var.delay)
   release Key.Equals
endif

/*
  Nearby soldiers
         Doesn' t seem to be working on multiplayer
         (game problem?, not GlovePIE as far as I know)
*/
if said("you there") then
   press minus
   wait(var.delay)
   release minus
endif

// Custom groups here

if said("left flank") then
   press Four
   wait(var.delay)
   release Four
endif

if said("right flank") then
   press Five
   wait(var.delay)
   release Five
endif

if said("rear section") then
   press Six
   wait(var.delay)
   release Six
endif

/*
           MOVEMENT ORDERS (F1)
*/

// Hold this position
if said("hold this position") or said("stay here") then
   press F1
   wait(var.delay)
   release F1

   wait(var.delay)

   press F1
   wait(var.delay)
   release F1
endif

//Follow me
if said("come")or said("follow me") or said("with me") then
   press F1
   wait(var.delay)
   release F1

   wait(var.delay)

   press F2
   wait(var.delay)
   release F2
endif

//Charge!
if said("charge") or said("attack") or said("onwards to glory") then
   press F1
   wait(var.delay)
   release F1

   wait(var.delay)

   press F3
   wait(var.delay)
   release F3
endif

//Stand ground
if said("stand ground") or said("stop") then
   press F1
   wait(var.delay)
   release F1

   wait(var.delay)

   press F4
   wait(var.delay)
   release F4
endif


//Retreat
if said("retreat") or said("run away") then
   press F1
   wait(var.delay)
   release F1

   wait(var.delay)

   press F5
   wait(var.delay)
   release F5
endif

/*
           TACTICAL ORDERS (F2)
*/

//Advance ten paces
if said("advance a bit") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F1
   wait(var.delay)
   release F1
endif

//Advance twenty paces
if said("advance") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F1
   wait(var.delay)
   release F1

   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F1
   wait(var.delay)
   release F1
endif

// Fall back ten paces
if said("fall back") or said("fall back a bit") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F2
   wait(var.delay)
   release F2
endif

// Spread out
if said("spread") or said("spread out") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F3
   wait(var.delay)
   release F3
endif

//Stand closer
if said("closer") or said("stand closer") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F4
   wait(var.delay)
   release F4
endif

//Mount horses
if said("mount horses") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F5
   wait(var.delay)
   release F5
endif

//Dismount horses
if said("dismount horses") or said("dismount") then
   press F2
   wait(var.delay)
   release F2

   wait(var.delay)

   press F6
   wait(var.delay)
   release F6
endif


/*
           FIRING ORDERS (F3)
*/

//Hold your fire
if said("hold your fire") or said("do not fire") or said("hold fire") then
   press F3
   wait(var.delay)
   release F3

   wait(var.delay)

   press F1
   wait(var.delay)
   release F1
endif

//Fire at will
if said("fire at will") or said("fire") or said("weapons free") then
   press F3
   wait(var.delay)
   release F3

   wait(var.delay)

   press F2
   wait(var.delay)
   release F2
endif

//Use only blunt weapons
if said("use only blunt weapons") or said("capture them") or said("blunt weapons") then
   press F3
   wait(var.delay)
   release F3

   wait(var.delay)

   press F3
   wait(var.delay)
   release F3
endif

//Use weapons at will
if said("use weapons at will") or said("take no prisoners") or said("lethal weapons") then
   press F3
   wait(var.delay)
   release F3

   wait(var.delay)

   press F4
   wait(var.delay)
   release F4
endif

/*
     EXTRAS
*/

if said("go") then
   press F1
endif

if said("there") then
   release F1
endif

/* I think this is bugged, should be tested further
if said("go there") then
   press F1
   wait(500ms)
   release F1
endif
*/

If I made a mistake tell me so I can correct it, I might have missed something.
I'd like to see people's opinions and improvements to the script :grin:



 
Supposedly you just let go of the key. Seems to work for me.

I'm using Windows 7 Ultimate x64 and the C key for Push-to-Talk.
 
Thanks a lot!


I made version for TLD :grin:


插入代码块:
/*
        Mount & Blade Warband - Troop orders script
        May 28 2010
        by shokkueibu
*/



/*
  Delay between pressing and releasing a key and between keypresses.
  20 miliseconds works fine.
*/
var.delay = 20ms



/*
        SELECTION
*/
if said("everyone") or said("soldiers") then
   Press One
   wait(var.delay)
   release One
endif

if said("infantry") or said("footmen") then
   Press Two
   wait(var.delay)
   Release Two
endif

if said("archers") then
   Press Three
   wait(var.delay)
   Release Three
endif

if said("cavalry") or said("horsemen") then
   Press Four
   wait(var.delay)
   Release Four
endif

if said("others") or ("everyone else") then
   Press Five
   wait(var.delay)
   release Five
endif





/*
           MOVEMENT ORDERS (F1)
*/

// Hold this position
if said("hold this position") or said("stay here") or said("halt") or said("stand ground") or said("stop")then
   press F1
   wait(var.delay)
   release F1
endif

//Follow me
if said("come")or said("follow me") or said("with me") then
   press F2
   wait(var.delay)
   release F2
endif

//Charge!
if said("charge") or said("attack") or said("forward")then
   press F3
   wait(var.delay)
   release F3
endif




/*
           TACTICAL ORDERS (F2)
*/

//Advance ten paces
if said("advance a bit") then
   press F6
   wait(var.delay)
   release F6
endif

//Advance twenty paces
if said("advance") then
   press F6
   wait(var.delay)
   release F6

   wait(var.delay)

   press F6
   wait(var.delay)
   release F6
endif

// Fall back ten paces
if said("fall back") or said("fall back a bit") then
   press F7
   wait(var.delay)
   release F7
endif

// Spread out
if said("spread") or said("spread out") then
   press F9
   wait(var.delay)
   release F9

endif

//Stand closer
if said("closer") or said("stand closer") then
   press F8
   wait(var.delay)
   release F8
endif

//Mount horses
if said("mount horses") then
   press F4
   wait(var.delay)
   release F4
endif

//Dismount horses
if said("dismount horses") or said("dismount") then
   press F10
   wait(var.delay)
   release F10
endif


/*
           FIRING ORDERS (F3)
*/

//Hold your fire
if said("hold your fire") or said("do not fire") or said("hold fire") then
   press F5
   wait(var.delay)
   release F5
endif

//Fire at will
if said("fire at will") or said("fire") or said("knock") or said("streach")then

   press F5
   wait(var.delay)
   release F5
endif

//Use only blunt weapons
if said("use only blunt weapons") or said("capture them") or said("blunt weapons") then
   press F11
   wait(var.delay)
   release F11
endif

//Use weapons at will
if said("use weapons at will") or said("take no prisoners") or said("lethal weapons") then
   press F11
   wait(var.delay)
   release F11
endif

/*
     EXTRAS
*/


if said("save") then
   press F12
endif
 
Think it would be possible to make a version of this that lets you manual block/attack with your voice? That would be kickin.
 
后退
顶部 底部