* Integerate Your Site With Talking Characters - MS Agents *

Status
Not open for further replies.

krishnansurya

Broken In
Hello All :D

*img157.imageshack.us/img157/3735/agentcharacter6fx.gif

Have You ever seen the above MS Agents in any of the websites ? They Demonstrate things,Explain,Greet your visitor,
Give Information about the user and above all they give a pretty cool cool to your website! Want them on your site?

This tutorial will explain on how to Integerate MS Agents in your website!

For those who cannot understand what I am talking about or want to see a sample check them on my sample page! ->->->
*www.technik.co.in/docs/agent_sample.htm

This tutorial may feel every long but beleieve me I have made it easy as much as possible :) Advanced users may just take a time upto 10 Mins.

Some of you might not be able to see this Agent in the above link there are plenty of reasons ->

1) You donot have required componenets to view them. ( Check More for the solution)
2) You donot have ActiveX controls enabled in your browser
3) Your firewall might be blocking the (agentsvr32.exe) file , if your firewall propmts for a permisiion to agentsvr32.exe allow it!
4) There could be many more reasons but users with Windows will have a cool stay!

What it is?
Actually this thing is nothing but calling off the Microsoft Agent(s) with most of them in Mircrosoft Office to your webpage with certain actions and speeches.This really gives a great look to your website.

What you require?
Actually there are 4 components required to see these/this agent(s),your visitor may too need this component(s) to view your cool website.Donot worry all the components donot exceed 2MB size! and THE MOST important is it only works in Interent Explorer as far as i know, I donnot know abt Firefox.

Now how to know whether you or the user has or hasn`t the required components?

Visit this page, this page will automatically detect the required components and make a checklist and will give you the download link too if you have missed some!

If you already have all the required components youm will be perfectlly able to see the sample page.

Check Components Here ->> *** Components Check & Download Here ***

Ohh! Now done with the every components! Lets start the work.

What you need to do?
Just costumize the full HTML code inbetween your BODY tags.

The main Script!This is the main script : ( THIS IS THE SCRIPT PROGRAMMED FOR THE AGENT : MERLIN ) Soon I will post of remaining 3 agents.


Code:
<OBJECT ID="Rainbow" width="0" height="0"
CLASSID="CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F"
CODEBASE="#VERSION=2,0,0,0">
</OBJECT> 
<OBJECT ID="TruVoice" width="0" height="0"
CLASSID="CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575"
CODEBASE="#VERSION=6,0,0,0">
</OBJECT>

<script language="JavaScript" type="text/javascript">
// Script By Technik.Co.In CopyRight 2006 You can copy this script but you MUST leave the source " Technik.co.in ". 
<!--//
var Char;
var UsedChars;
var CharID;
var CharACS;
var CharLoaded;
var LoadReq;
var HideReq;

UsedChars = "Char";

CharID = "Char";
CharACS = "";
CharLoaded = false;

Window_OnLoad();

function Window_OnLoad() {
Rainbow.Connected = true;

CharLoaded = LoadLocalChar(CharID, CharACS);

if (!CharLoaded) {
CharLoaded = LoadLocalChar(CharID, "");
}

if (CharLoaded) {
SetCharObj();
}
CheckLoadStatus();
}

function LoadLocalChar(CharID, CharACS) {
Rainbow.RaiseRequestErrors = false;
if (CharACS == "") {

LoadReq = Rainbow.Characters.Load(CharID);
}
else {
LoadReq = Rainbow.Characters.Load(CharID, CharACS);
}
Rainbow.RaiseRequestErrors = true;

if (LoadReq.Status != 1) {
return(true);
}
return(false);
}

function SetCharObj() {
Char = Rainbow.Characters.Character(CharID);
Char.LanguageID = 0x409;
}

function CheckLoadStatus() {
if (!CharLoaded) {
LoadError();
return(false);
}

window.status = "";
AgentIntro();
return(true);
}
// *** ERROR MESSAGE DISPLAYED WHEN REQUIRED COMPONENTS ARE MISSING - Technik.Co.In ***
function LoadError() {
var strMsg;
window.status = "";
strMsg = "Error Loading Character: " + CharID + "\n";
strMsg = strMsg + "This Microsoft Agent Script requires the character(s):\n";
strMsg = strMsg + UsedChars;
alert(strMsg);
}
// *** !!! ERROR MESSAGE END !!! - Technik.Co.In ***
function InitAgentCommands() {
Char.Commands.RemoveAll();
}

function AgentIntro() {
InitAgentCommands();

// *** CAREFUL : AGENT SCRIPT BEGINS HERE - Technik.Co.In ***

 

// *** CAREFUL : AGENT SCRIPT ENDS HERE - Technik.Co.In ***
}
//-->
</script>

<script language="JavaScript" type="text/javascript" for="Rainbow" event="Click(CharacterID, Button, Shift, X, Y)">
<!-- 
// This event is a exaple on how to agent will react on single click! - Technik.Co.In

Char.StopAll();
Char.Play ("Alert");
Char.Speak ("Hey, watch it with that shitty mouse!|Oh that tickles!|ROFL!");
Char.Play ("Blink");
Char.Play ("RestPose");
// -->
</script>

<script language="JavaScript" type="text/javascript" for="Rainbow" event="DblClick(CharacterID, Button, Shift, X, Y)">
<!--
// This event is a exaple on how to agent will react on double click! - Technik.Co.In

Char.StopAll();
Char.Play ("Alert");
Char.Speak ("Hey, watch it with that pointer! OK i'll go.|Oh you double clicked me it tickles more. Goodbye!|OK Bye!");
Char.Hide();
//-->
</script>

Find """ AGENT SCRIPT BEGINS HERE """" and insert CHAR script there!These things may feel though isn`t it? But read the whole tut i have just expanded it :))

Now The Character Script !
You may have already visited our Sample Page
I will take the Sample page as the example for the purpose of the character script!

This is the agent script as there in the Sample Page.



Code:
Char.MoveTo(0, 0);
Char.Show();
Char.MoveTo(900, 500);
Char.Play("Greet");
Char.Speak("Hello and welcome to Technik.CO.IN");
Char.Play("Pleased");
Char.Speak("My name is Merlin! Its Nice to Meet u!");
Char.Play("Think");
Char.Speak("Now I am here for testing purposes, but soon I will appear at many places!");
Char.Play("Process");
Char.Speak("My reports show that u have comehere to test me");
Char.Play("Search");
Char.Play("GetAttentionContinued");
Char.MoveTo(584, 321);
Char.Play("Suggest");
Char.Speak("\\Chr=\"Whisper\"\\Take Me With You!.");
Char.Play("Sad");
Char.Speak("I know u would not dissappoint me");
Char.Play("Think");
Char.Play("Pleased");
Char.Speak("do u desire to take me with you?");
Char.MoveTo(10, 200);
Char.Speak("Click at the link named Take this agent, to take me with you.");
Char.Play("Pleased");
Char.Speak("\\Chr=\"Whisper\"\\I think the webmaster is coming, time to go bye!.");
Char.Hide();



Now many of u might ask whats that?

The Commands which are present ONLY in the sample script. ( There are lot fo more commands refer below) ::::

**** List Of all Commands and actions can be found below ****

Char.Show(); ---> Displays or enables the Agent for which the cript is configured.

Char.MoveTo(x, y); ---> Move the character to desired place ( X= Width ,, Y=Height)

Char.Play("ACTION"); ---> Plays the desired Action ( Action needs to be replaced with the desired action see below for the action(s) list )

Char.Speak("U R Message"); ---> The Message that you want your character to talk! ( Replace Your Message)

Char.Speak("\\Chr=\"Whisper\"\\U r Message Here"); ---> " Whisper Command " the character talks in a whispering way.

Char.Think("U r Message"); ---> Only the white message box appears with your message in it. It displays as the agent is thinking.

*************************************************************
>>>>>Breaking up the commands<<<<<

The Commands ->>>>

1) * Char.Speak ("Welcome To Technik.Co.In); *

This Command indicated your character to speak the test inside the brackets and quotes.
This works through the TTS Engine which is one of the four componenets.

2) * Char.Show/Hide(); *

This Command respectively shows or hides the agent.

3) * Char.MoveTo(XW, YL) *

This Command will move your character to the desired height and width.
As for Merlin he takes a flight to the desired place.

4 * Char.Play("Desired Action") *

This is the most important action of all the agents.This Command plays the animation u desire.
All you have to do is Pick the animation from the list given below and replace it in place of Desired Action.
Without this it wud be Bad! :(

Now almost we have reached at last.
And Below we are going to see list of animations !!!

Animations for the agents..........

Code:
("Acknowledge")
("Alert")
("Announce")
("Blink")
("Confused")
("Congratulate")
("Decline")
("DoMagic1")
("DoMagic2")
("DontRecognize")
("Explain")
("GestureDown")
("GestureLeft")
("GestureRight")
("GestureUp")
("GetAttention")
("GetAttentionContinued")
("GetAttentionReturn")
("Greet")
("Hide")
("Hearing_1")
("Hearing_2")
("Hearing_3")
("Idle1_1")
("Idle2_1")
("Idle1_4")
("Idle1_3")
("Idle1_2")
("Idle2_2")
("Idle3_1")
("Idle3_2")
("LookDown")
("LookDownBlink")
("LookDownReturn")
("LookDownLeft")
("LookDownLeftBlink")
("LookDownLeftReturn")
("LookRight")
("LookRightBlink")
("LookRightReturn")
("LookUp")
("LookUpBlink")
("LookUpReturn")
("LookUpLeft")
("LookUpLeftBlink")
("LookUpReturn")
("LookUpRight")
("LookUpRightBlink")
("LookUpRightReturn")
("MoveDown")
("MoveLeft")
("MoveRight")
("MoveUp")
("Pleased")
("Process")
("Processing")
("ReadContinued")
("Read")
("ReadReturn")
("Reading'")
("RestPose")
("Sad")
("Search")
("Show")
("Searching")
("StartListening")
("StopListening")
("Surprised")
("Suggest")
("Think")
("Thinking")
("Uncertain")
("Wave")
("Write")
("WriteReturn")
("WriteContinued")
("Writing")

^^^ So these are the actions ^^^

Now something for advanced users!
Figure out the scripts at last giving the Single/Double Click actions?


Again the handy links ->

Sample Page
Components check & downloads
Source

So at last thig BIG tutorial has ended!

If u have any probs/comments reply here

Was the tut good? :roll:
 

RCuber

The Mighty Unkel!!!
Staff member
Wow!!! I had done these things 6 years ago. I had done some standalone applications which included these MS agents. ne way thanks for reminding it. I will impliment it in my next project ;)
 

deepak.krishnan

In the zone
Well I tried wut u said.But it is not appearing in my site.I pasted the code you gave into the index page of my site in the body.But its not working.Is there anything to be changed in your code so that it will work in my site?
Also when I tried to open the merlin file that I downloaded,a dialog box appears and then closes by itself. What all are there in the downloaded thing?Is it necessary to uploade the downloaded file to my site so that it will work?
 
OP
K

krishnansurya

Broken In
hmm.. I think You donot have the required components
GO here -> Components Check

^^ This Page will automatically check whehter u have the required componenets or not.
If you Have any of the components absent , the download link(s) to the respective components are available on the same page.

If u still face problems PM me.
 

ferrarif50

Journeyman
Hmm...

I would not advise to have any Active X objects to be used in the websites, as it is a very critical security issue and the best practices suggests that, it should be avoided.

Even, the upcoming IE7, has Active X disabled by default. Using them, will narrow down your audiences very much.

In these days of Web 2.0, AJAX, Rich Flash and other buzzwords whose mantra is to provide rich interactive content that can be delivered in the web sites, without much hassle and by using common techniques, compromising on compatibility for look and feel will be a costly mistake.

A good tutorial for playing around though!
 

FatBeing

Administratus Rotundus
krishnansurya, this doesn't seem to be an original. Please post a source (or prove originality)ASAP. You have 24 hours.
 
Status
Not open for further replies.
Top Bottom