Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

[WIP|C#] Speech Recognition Mod


Rugz007
 Share

Recommended Posts

let me throw some ideas ^^:

 

Add a optinal hotkey that would be hold to enable the voice commands, if no hotkey is set you dont need to hold, works like actual one

 

Add commands like:

Fix car
Fix tyres
End car fire

Extra X (where x is a number between 1 and 9, this will toggle this vehicle extra on/off)

Heal me (increase player health)
I need help (spawn body guard)
Flip car

just some ideas :)

*edit: Oh yeah, make the reading of Jarvis.txt more "dynamic", dont make user put specific in "c:\program files\", you probably can use ".\Scripts\Jarvis mod\jarvis.txt" as path when reading and tell user to just paste all files in gta Scripts folder

Edited by julionib
  • Like 1
Link to comment
Share on other sites

LordOfTheBongs

i like the idea of having to hold down a hotkey, kinda like talking on a walkie talkie (i dont think they use these anymore)

Link to comment
Share on other sites

i didnt read your source code but, its possible to you recognize a model name? like if i say "Spawn sabregt", it spawn a sabregt? that would be very cool, the problem is that my english is not that good and i would fail spawning some models ^^

It is possible to a certain extent. I've used the Speech SDK a long ago (XP Days), and let's say it wasn't the best Microsoft feature I've seen.

 

Microsoft provided U.S. English and Chinese recognition, but you could get other languages from third parties.

Link to comment
Share on other sites

basically what it does is "hear" microfone and return a string?

Edited by julionib
Link to comment
Share on other sites

basically what it does is "hear" microfone and return a string?

IC381136.jpg

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Speech.Recognition;namespace WindowsFormsApplication1{  public partial class Form1 : Form  {    public Form1()    {      InitializeComponent();    }    private void Form1_Load(object sender, EventArgs e)    {      // Create a new SpeechRecognitionEngine instance.      SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();      // Create a simple grammar that recognizes "red", "green", or "blue".      Choices colors = new Choices();      colors.Add(new string[] { "red", "green", "blue" });      // Create a GrammarBuilder object and append the Choices object.      GrammarBuilder gb = new GrammarBuilder();      gb.Append(colors);      // Create the Grammar instance and load it into the speech recognition engine.      Grammar g = new Grammar(gb);      recognizer.LoadGrammar(g);      // use the system's default microphone, you can also dynamically      // select audio input from devices, files, or streams.      speechRecognitionEngine.SetInputToDefaultAudioDevice();      // Register a handler for the SpeechRecognized event.      recognizer.SpeechRecognized +=        new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);      // start listening in RecognizeMode.Multiple, that specifies      // that recognition does not terminate after completion.      speechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);    }    // Create a simple handler for the SpeechRecognized event.    void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)    {      MessageBox.Show("Speech recognized: " + e.Result.Text);    }  }}
Edited by hardsty1e
Link to comment
Share on other sites

Hey julio thanks for uploding ut on fb.... and teleporting thing i a gonna add..... thanks man.

Link to comment
Share on other sites

i didnt read your source code but, its possible to you recognize a model name? like if i say "Spawn sabregt", it spawn a sabregt? that would be very cool, the problem is that my english is not that good and i would fail spawning some models ^^

It seems to work ONLY when you add the words to a speech dictionary. Before I did that, it'd never properly hear me saying Domestobot, while after adding the word to a dictionary (even without recording a pronouncation) it was 100% accurate. Hopefully that'd be the case with car names too.

 

Now, it'd be even easier if it was possible to define a specific dictionary by script. Is it doable?

Link to comment
Share on other sites

mmm, well, at least for car names we could read the handling.dat or some file taht contains all car names (or obtain the car names list elsewhere) and add they as spawn commands with the word spawn + car name, im not sure about the result with cars like supergt, sultanrs

Link to comment
Share on other sites

mmm, well, at least for car names we could read the handling.dat or some file taht contains all car names (or obtain the car names list elsewhere) and add they as spawn commands with the word spawn + car name, im not sure about the result with cars like supergt, sultanrs

Wouldn't spawning by a GXT name be more reliable? Just obtain GXT keys and call CText::Get for those.

Edited by Silent
Link to comment
Share on other sites

You liar, there is no blogger with that username...

Link to comment
Share on other sites

You liar, there is no blogger with that username...

 

He made a typo, his site is www.gta4mm.blogspot.in

But he did not make this mod by himselfe, he just copy pasted someone else his code :/

Link to comment
Share on other sites

 

You liar, there is no blogger with that username...

 

He made a typo, his site is www.gta4mm.blogspot.in

But he did not make this mod by himselfe, he just copy pasted someone else his code :/

 

"System.Speech" has memory leaks anyways, i've tested your guys script and it does have issues as well. you can see for yourself with this code.

public void Helper(object sender, GraphicsEventArgs e)        {            if (gHud == true)            {                e.Graphics.Scaling = FontScaling.ScreenUnits;                e.Graphics.DrawText("Memory: " + (Process.GetCurrentProcess().PrivateMemorySize64 / 1024).ToString("0") + " KB", 0.63f, 0.8f);                e.Graphics.DrawText("Counter: ", 0.63f, 0.86f);                if (Game.FPS >= 31)                {                    e.Graphics.DrawText("FPS: " + Game.FPS.ToString(), 0.63f, 0.83f);                    Interval = 0;                }                else if (Game.FPS <= 30)                {                    e.Graphics.DrawText("FPS: " + Game.FPS.ToString(), 0.63f, 0.83f, System.Drawing.Color.Yellow);                    Interval = 40;                }                else if (Game.FPS < 11)                {                    e.Graphics.DrawText("FPS: " + Game.FPS.ToString(), 0.63f, 0.83f, System.Drawing.Color.Red);                    Interval = 200;                }            }        }
Edited by hardsty1e
Link to comment
Share on other sites

LordOfTheBongs

i dont think they understand what a memory leak is and why it is bad... instead of asking u to explain they just ignore, lol

Edited by LordOfTheBongs
Link to comment
Share on other sites

 

case "Sports Car":

Vector3 scpos = Player.Character.Position.Around(10.0f);
World.CreateVehicle(new Model("COMET"), scpos);
currentFunction = null;
break;

What's "scpos" mean ?

Link to comment
Share on other sites

gamerzworld

 

 

case "Sports Car":

Vector3 scpos = Player.Character.Position.Around(10.0f);
World.CreateVehicle(new Model("COMET"), scpos);
currentFunction = null;
break;

What's "scpos" mean ?

 

Sports Car Position.

Edited by gamerzworld
Link to comment
Share on other sites

 

 

  1. case "Jarvis":
  2. Game.DisplayText("JARVIS Engine On");
  3. currentFunction = null;
  4. break;
  5. case "Normal Car":
  6. Vector3 nmpos = Player.Character.Position.Around(10.0f);
  7. World.CreateVehicle(new Model("SULTAN"), nmpos);
  8. currentFunction = null;
  9. break;
  10. case "Boat":
  11. Vector3 mbpos = Player.Character.Position.Around(10.0f);
  12. World.CreateVehicle(new Model("DINGHY"), mbpos);
  13. currentFunction = null;
  14. break;
  15. case "Heal Me":
  16. Player.Character.Health = 1000;
  17. Player.Character.Armor = 1000;
  18. break;
  19. case "Fack You":
  20. Game.DisplayText("JARVIS Engine Off");
  21. Player.Character.Health = 50;
  22. Player.Character.Armor = 0;
  23. currentFunction = null;
  24. break;
  25. case "Fix Car":
  26. if (Player.Character.isInVehicle())
  27. Player.Character.CurrentVehicle.Repair(
  28. Player.Character.CurrentVehicle.Wash();
  29. break;
Link to comment
Share on other sites

 

 

 

  1. case "Jarvis":
  2. Game.DisplayText("JARVIS Engine On");
  3. currentFunction = null;
  4. break;
  5. case "Normal Car":
  6. Vector3 nmpos = Player.Character.Position.Around(10.0f);
  7. World.CreateVehicle(new Model("SULTAN"), nmpos);
  8. currentFunction = null;
  9. break;
  10. case "Boat":
  11. Vector3 mbpos = Player.Character.Position.Around(10.0f);
  12. World.CreateVehicle(new Model("DINGHY"), mbpos);
  13. currentFunction = null;
  14. break;
  15. case "Heal Me":
  16. Player.Character.Health = 1000;
  17. Player.Character.Armor = 1000;
  18. break;
  19. case "Fack You":
  20. Game.DisplayText("JARVIS Engine Off");
  21. Player.Character.Health = 50;
  22. Player.Character.Armor = 0;
  23. currentFunction = null;
  24. break;
  25. case "Fix Car":
  26. if (Player.Character.isInVehicle())
  27. Player.Character.CurrentVehicle.Repair(
  28. Player.Character.CurrentVehicle.Wash();
  29. break;

 

 

Why exactly did you post this?

Oh and there are 3 problems with this code. Well, actually just two problems, and another thing that should be changed. In the fack you case, you set the health as 50, but the problem is you could actually be giving health, if the player's health is below 50. So it should be this

Player.Character.Health -= 50;//Health = Health - 50

And then the two problems... both are in the fix car case.

1: You forgot to put the begin { and end } brackets for the if. The only time you DON'T put the brackets, is when there is only going to be one line of code in the if.

2: You forgot to put a " ); " at the end of the repair function.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.