Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!

Join the forum, it's quick and easy

Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com

Make your computer talk:

2 posters

Go down

Make your computer talk: Empty Make your computer talk:

Post by Vivi_IX Tue Jul 28, 2009 5:57 pm

This script will make your computer "say" whatever you want it to. There are two scripts for this: comp_talk() and comp_talk_ext().

Just push "Open" when you click on the link to the script to open in the browser.


comp_talk(str) This function has one argument: "str". The "str" is the string of text that you want the computer to say.
/*
** Usage: comp_talk(str)
**
** Argument: str - The words you want your computer to say.
**
** Returns: 1 if successfull. 0 if unsuccessfull.
**
** Details: This script creates a VBS file that will make your computer talk
** in the local game folder and will then execute it.
**
** Creator/Contact: Vivi_IX Email: bradford_d@ymail.com
*/

//Initialize Variables

talk_text = argument0;
fname = temp_directory+"\comp_talk";
ext = ".vbs";
//This sets up the codes for the .vbs file
vbscode1_1 = string('strText = (" ');
vbscode1_2 = string(' ")');
vbscode2=string('Set objvoice = CreateObject("SAPI.SpVoice")');
vbscode3=string("ObjVoice.Speak strText");
//Write code and text to .vbs file
file = file_text_open_write(fname+ext);
file_text_write_string(file,vbscode1_1+talk_text+vbscode1_2);
file_text_writeln(file);
file_text_write_string(file,vbscode2);
file_text_writeln(file);
file_text_write_string(file,vbscode3);
file_text_close(file);

if file_exists(fname+ext) = true
{execute_shell(fname+ext,"");
return(1);}
else
{return(0);}



comp_talk_ext(str,fname,talk) This function has two new arguments ("fname" and "talk"). The "fname" is the path in which you want the .vbs file (the file that makes your computer talk) to be created in. You dont need an extension for this. Example: "C:\Documents and Settings\All Users\Desktop\FILENAME". If you want the user to pick where the file is saved at you can use the get_save_filename() funciton. The "talk" argument will allow the computer to "talk". It should either be true or false. [true = talk; false = dont talk]. (The .vbs file is still created for later reference.)
/*
** Usage:
** comp_talk_ext(str,fname,talk)
**
** Arguments(3):
** str: ------------ The text you want your computer to speak.
**
** fname: ---------- The filname and path you want the file to have.
** Example: C:\Folder\Filename or leave blank to create
** the file in the folder of the game.
**
** talk: ----------- Whether or not to actually make the coputer talk.
** True = Do talk. False = Don't talk.
**
** Returns:
** The filepath of the .vbs file created. You may use this to later reference
** the .vbs file (such as to delete, copy, execute, etc....)
**
** Details:
** This script creates a VBS file based on what you want you computer to say,
** and then executes that file in order to make the computer talk.
** (this file will NOT be automatically deleted)
**
** Creator/Contact: Vivi_IX Email: bradford_d@ymail.com
*/

//Initialize Variables

talk_text = argument0;
fname = argument1;
talk = argument2;
ext = string(".vbs");
//This sets up the codes for the .vbs file

vbscode1_1 = string('strText = (" ');
vbscode1_2 = string(' ")');
vbscode2=string('Set objvoice = CreateObject("SAPI.SpVoice")');
vbscode3=string("ObjVoice.Speak strText");

//Write code and text to .vbs file

file2 = file_text_open_write(string(fname)+string(ext));
file_text_write_string(file2,vbscode1_1+talk_text+vbscode1_2);
file_text_writeln(file2);
file_text_write_string(file2,string(vbscode2));
file_text_writeln(file2);
file_text_write_string(file2,string(vbscode3));
file_text_close(file2);

if talk = true
{execute_shell(fname+ext,"");}

return(string(fname+ext))


Here is an example of how/what you could use this for (.gmk):
Play Now (1.19 MB) or Download Here


Last edited by Vivi_IX on Sun Aug 09, 2009 11:24 pm; edited 11 times in total
Vivi_IX
Vivi_IX
Tres GameML Ninja
Tres GameML Ninja

Posts : 164
Points : 54368
GameML Reputation : 14
Join date : 2009-07-09
Age : 34
Location : USA: Painesville, Ohio

http://www.yoyogames.com/members/Vivi_IX

Back to top Go down

Make your computer talk: Empty Re: Make your computer talk:

Post by -js1210- Tue Jul 28, 2009 7:34 pm

Can you put the pieces of code in code format?

Code:
Like This

It would make it less confusing.
-js1210-
-js1210-
Super 500 GML
Super 500 GML

Posts : 1298
Points : 56622
GameML Reputation : 27
Join date : 2009-06-02
Age : 29
Location : United States

http://www.yoyogames.com/members/js1210

Back to top Go down

Make your computer talk: Empty Re: Make your computer talk:

Post by Vivi_IX Tue Jul 28, 2009 10:04 pm

I dont like using that. Sometimes it unformats my text. To see it all at once, just click on the link to the script and select "Open" instead of saving it.

[Edit]: well I put it in a spoiler for you(the hide wasn't working). I just dont like this forum's [code]. The line aren't supossed to be limited.
Vivi_IX
Vivi_IX
Tres GameML Ninja
Tres GameML Ninja

Posts : 164
Points : 54368
GameML Reputation : 14
Join date : 2009-07-09
Age : 34
Location : USA: Painesville, Ohio

http://www.yoyogames.com/members/Vivi_IX

Back to top Go down

Make your computer talk: Empty Re: Make your computer talk:

Post by Vivi_IX Sat Aug 08, 2009 11:28 am

Problem solved. I made my own "code" box. I also swiched my file hoster becuase the other one would only let you download a file if I had signed in that day. [I still need to find a direct file hoster for "Instant Play"]
Vivi_IX
Vivi_IX
Tres GameML Ninja
Tres GameML Ninja

Posts : 164
Points : 54368
GameML Reputation : 14
Join date : 2009-07-09
Age : 34
Location : USA: Painesville, Ohio

http://www.yoyogames.com/members/Vivi_IX

Back to top Go down

Make your computer talk: Empty Re: Make your computer talk:

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum