Hey everyone I'm looking for a way to code a program/bot in VB that would read my chat, but only if a command is used
For example: "!tts Hello"
And It would read it using TTS and show it on screen
$USERNAME$ !tts: Hello
Now the thing I don't know how to set up is the program reading the chat, printing it on screen I believe is the easy part.
Also if it's possible to add an option to select to which audio output it will go.
You need to study more coding...
Im not a master at it myself. but i would make a boolean that could be true if the first letter in a chatline is a "!". And then a command that would add that line to a text-to-speech module
Related
How do I split a console into two parts? I'm trying to build a simple chat in C and I'd like to have the output on the top of the console and the input on one line at the bottom. I would assign the output handling to one thread and the input handling to another thread. For example:
Connected to server!
User1: Hello!
User2: How are you?
Write something here: simple TCP chat
User1: Hello!
User2: How are you?
You: simple TCP chat
Write something here:
Is it even possible to achieve something like this in plain C?
Thank you in advance!
PS: This question has already been asked some time ago, but the code is in C#, not C.
I am trying to code a little console chat-program in C on linux.
So far I coded it in a way that both chatting partners are only able to alternately send/recv, because these function calls are blocking by default.
Now I would like to modify that program, so that both are able to send and receive simultaneously.
The problem that I find is, that once you typed some input to the terminal, I don't know how to output received messages, without messing up the current input line of the terminal.
If there was a way to delete that current input line, you could temporarily save that line, print the new message and put the input line right back.
However, I was not able to find a solution for this problem on the internet.
Is it possible to delete the current input line, and if not, how else could I achieve what I want?
I think you should look into ncurses as Edd said in his comment.
It would allow you to easily manage contents in your terminal window, which sounds like a good idea for your chat program.
All you'd need to do is store your messages in 2 character arrays:
char incoming[MSG_MAX]
and
char outgoing[MSG_MAX]
Then you can output those messages wherever you want in your terminal window, since ncurses allows you to specify x,y coordinates on where to put your text.
Then a simple wrapper for one of ncurses erase() family functions would allow you to delete characters from specify x,y coordinates in your terminal window.
Edit: MSG_MAX is not an actual ncurses macro.
Here is a part of my current (working) chatbot code in Notepad so you can get an idea of how I am coding it:
dim n, q
n=inputbox("Hello, I'm a chatbot. What is your name?")
q=inputbox(""& n &" is a great name! Thank you for activating me, "& n &"! How are you?")
I want to be able to make "if and else" parts (for example, if "happy" is typed in after being asked "How are you feeling" it should say "great", if you type anything else it would say something differently.) How do I do this in Notepad?
Also, how do I get it to loop and say something based on keywords (like how Eliza the chatbot will keep talking for infinity just by looping and referring to a bank of keywords and responses) in Notepad?
I know these are really basic questions, but I have have searched the web multiple times; all searches ending up empty handed.
Unfortunately, you asked a very inspecific question making it hard to answer. That is why your post received a downvote and a close down request. However, you seem enthousiastic and I can only encourage that.
First of all, VBScript is not a very nice language. Oh, yes it seems simple, it nicely integrates with some standard windows components and you can run it out of the box. But it is ancient and does some things differently than more common languages. If you want to do more complex things faster, ultimately you'd switch to another (scripting) language.
With VBScript it is not (easily) possible to use notepad as input/output device. For your setup I'd prefer the command line (press your windows key and enter CMD+enter, there it is).
You can write output to the command line with
WScript.StdOut.Write "What is your name?"
You can retrieve output from the command line with
wscript.stdin.read(0)
name = wscript.stdIn.readline()
And to make your chatbot complete:
WScript.StdOut.Write "Hello " & name
Now you want to do some conditional branching. Well, I do not say W3Schools is a very good resource, but for now it is sufficient. Look at their if ... then ... else page (<- clickable link). If you are using IE, you can even try some things yourself.
Finally you can use Do While ... Loop's to make the code repeat itself.
A chatbot like Eliza is a prestigeous project. Don't be discouraged if you only can build a very simple version. The cake is in the coding, not the result.
I have to do a simple text editor using the c language. But I don't know how to get started. The program should begin with a blank screen, waiting for the user to write something. The user is also able to move the cursor using the arrow keys and the user is also able to load text files to the program from his hard drive and also make a text file of something the user has written in the program.
He can load something by pressing CTRL-O or he can press CTRL-S to save something followed by the name of the text file.
Our professor said that we have to use the library screenUtils to make the cursor move.
How should I start? I'm trying to make this work for 3 hours but nothing really works.
Our professor said that we have to use the library screenUtils to make the cursor move. How should I start?
I would start by reading the documentation for this library.
I have the following simulation in C for cars in a traffic circle
alt text http://dl.getdropbox.com/u/175564/cars.png
For example,
7 <space> <enter>
gives more cars to the simulation, while
s1 <enter>
puts a top sign to the incoming road #1.
I want to put the simulation to an internet page such that users can try it.
However, I do not know where I should start.
I know Joomla and little about Django. Perhaps, they can be useful.
How can you put a C program to a Webpage such that users can use it?
CGI is what you want; it will let you embed any program you want into a website, it was made for that purpose. Then perhaps embedding a few more options with PHP and HTML will let the user acutally input data into the program via the web. It should not be too hard.
Take a look here for more info: http://www.cs.tut.fi/~jkorpela/perl/cgi.html
I think that is a good pointer in the right direction. I hope that helps.
You could run the C code in a flash app using alchemy:
http://labs.adobe.com/technologies/alchemy/
Here's a good intro to writing CGIs in C: http://www.cs.tut.fi/~jkorpela/forms/cgic.html
However, since you're a beginner, I'd recommend porting your program to PHP. It's a very easy language to pick up, and it's a much easier route than writing a CGI in C.
I assume the C program needs input while it's running and not via command-line arguments? If I'm wrong, you can just use PHP and shell_exec() to run the program. The function returns anything printed to stdout.
Such a page might look like:
$sim = shell_exec("/path/to/binary -a 5 -b 6");
echo $sim;
Where the string passed to shell_exec is exactly what you'd type on the command line.
If you want a dynamic simulation, where the cars moves while you watch , you'll need an applet or flash.
A cgi program renders the page on each http GET/POST (on reload, submit etc)
and that is probably not what you want.
I would start with a flash or java applet wrapper. You can communicate with your application over a tcp connection and display the results in the flash or applet.
I would recommend going with sockets. If your C program could set up and listen on a local or internet socket, you could use the socket facilities in any language to send it arguments and get output.
If that's going to be too much of a pain, have php exec the program while directing the output to some file. Then, have php read that file.
Looking at the output of your program, I think trying to print the results of shell_exec() will result in clobbered output.
So, you could shell_exec("/bin/program -arguments > /tmp/prog-tmp.txt") , then read prog-tmp.txt.