Quote
<OBJECT id=AgentControl codeBase=#VERSION=2,0,0,0 height=0 width=0
classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F></OBJECT>
<SCRIPT language=JavaScript type=text/javascript>
<!--//
// * Character Objects
var Merlin;
// * Variables
var UsedChars;
var MerlinID;
var MerlinACS;
var MerlinLoaded;
var LoadReq;
var HideReq;
var MerlinLeftX, MerlinCenterX, MerlinRightX;
var MerlinTopY, MerlinCenterY, MerlinBottomY;
// * Initialize
UsedChars = "Merlin";
// * Merlin
MerlinID = "Merlin";
MerlinACS = "merlin.acs";
MerlinLoaded = false;
Window_OnLoad();
function Window_OnLoad() {
// Purpose: Runs automatically when page is loaded
// * INSERT ANY NON-AGENT RELATED SCRIPTING HERE
AgentControl.Connected = true;
MerlinLoaded = LoadLocalChar(MerlinID, MerlinACS);
if (!MerlinLoaded) {
// Attempt to load default character
MerlinLoaded = LoadLocalChar(MerlinID, "");
}
if (MerlinLoaded) {
SetCharObj();
}
CheckLoadStatus();
}
function LoadLocalChar(CharID, CharACS) {
AgentControl.RaiseRequestErrors = false;
if (CharACS == "") {
LoadReq = AgentControl.Characters.Load(CharID);
}
else {
LoadReq = AgentControl.Characters.Load(CharID, CharACS);
}
AgentControl.RaiseRequestErrors = true;
if (LoadReq.Status != 1) {
return(true);
}
return(false);
}
function SetCharObj() {
Merlin = AgentControl.Characters.Character(MerlinID);
Merlin.LanguageID = 0x409;
}
function CheckLoadStatus() {
if (!MerlinLoaded) {
LoadError();
return(false);
}
window.status = "";
AgentIntro();
return(true);
}
function LoadError() {
var strMsg;
window.status = "";
strMsg = "Error Loading Character: " + MerlinID + "\n";
strMsg = strMsg + "This Microsoft Agent Script requires the character(s):\n";
strMsg = strMsg + UsedChars;
alert(strMsg);
}
function GetScreenPositions() {
var ScreenWidth = window.screen.width;
var ScreenHeight = window.screen.height;
if ((ScreenWidth == 0) || (ScreenHeight == 0)) {
ScreenWidth = 800;
ScreenHeight = 600;
}
MerlinCenterX = (parseInt(ScreenWidth / 2) - parseInt(Merlin.Width / 2));
MerlinRightX = (ScreenWidth - Merlin.Width);
MerlinCenterY = (parseInt(ScreenHeight / 2) - parseInt(Merlin.Height / 2));
MerlinBottomY = (ScreenHeight - Merlin.Height);
}
function AgentIntro() {
GetScreenPositions();
// *** bat dau cac hanh dong ***
Merlin.Show();
Merlin.Play("Greet");
Merlin.Play("GetAttention");
Merlin.Play("GetAttentionContinued");
Merlin.Play("GetAttentionContinued");
Merlin.Play("GetAttentionContinued");
Merlin.MoveTo(MerlinCenterX, MerlinCenterY);
Merlin.Speak("this javascript will creative a wizard ,this is a helper of many microsoft programs " );
Merlin.MoveTo(MerlinRightX, MerlinCenterY);
Merlin.Play("Explain");
Merlin.MoveTo(MerlinCenterX, MerlinTopY);
Merlin.Play("GestureDown");
Merlin.Speak("with this this javasript , you can change the wizard's speech and his action ");
Merlin.Play("Search");
Merlin.Play("Surprised");
Merlin.Speak("but the restriction is the wizard can speech only english ");
Merlin.Play("GestureDown");
Merlin.MoveTo(MerlinLeftX, MerlinCenterY);
Merlin.MoveTo(MerlinCenterX, MerlinCenterY);
Merlin.Speak("by c9002");
Merlin.GestureAt(MerlinLeftX, MerlinCenterY);
Merlin.Speak("i will go at the moment");
Merlin.Play("Greet");
Merlin.Hide();
Merlin.Show();
Merlin.Play("Greet");
Merlin.Play("GetAttention");
Merlin.Play("GetAttentionContinued");
Merlin.Play("GetAttentionContinued");
Merlin.Play("GetAttentionContinued");
Merlin.MoveTo(MerlinCenterX, MerlinCenterY);
Merlin.Speak("bye bye..." );
Merlin.Play("Greet");
Merlin.Hide();
// ket thuc
}
//-->
</SCRIPT>
<!--by c9002 -->