var Merlin; var UsedChars; var MerlinID; var MerlinACS; var MerlinLoaded; var LoadReq; var HideReq; UsedChars = "Merlin"; MerlinID = "Merlin"; MerlinACS = "Merlin.acs"; MerlinLoaded = false; var MerlinLeftX, MerlinCenterX, MerlinRightX; var MerlinTopY, MerlinCenterY, MerlinBottomY; 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 tbfunction_WinLoad() { document.sys126.Connected = true; MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS); if (MerlinLoaded) { SetCharObj(); } CheckLoadStatus(); } function LoadLocalAgent(CharID, CharACS) { document.sys126.RaiseRequestErrors = false; LoadReq = document.sys126.Characters.Load(CharID, CharACS); document.sys126.RaiseRequestErrors = true; if (LoadReq.Status != 1) { return(true); } return(false); } function SetCharObj() { Merlin = document.sys126.Characters.Character(MerlinID); Merlin.LanguageID = 0x409; } function CheckLoadStatus() { if (!MerlinLoaded) { LoadError(); return(false); } window.status = ""; 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 InitAgentCommands() { Merlin.Commands.RemoveAll(); Merlin.Commands.Caption = "My Menu Name"; Merlin.Commands.Add("ACO", "Advanced Character Options", "Advanced Character Options"); } // ---------------------------------------------------------------------------------------------------------------------------------- // All the above are produced by MASH // All below is written originally by Dr. med. Cecil Cheah and edited by me. // ----------------------------------------------------------------------------------------------------------------------------------- function tbfunction_showAgent(){ InitAgentCommands(); Merlin.MoveTo(0, 0); Merlin.Show(); Merlin.Speak("Hello, my name is Merlin."); } function tbfunction_moveToAgent(){ GetScreenPositions(); InitAgentCommands(); Merlin.Show(); Merlin.MoveTo(MerlinCenterX , MerlinCenterY ); Merlin.Speak("Did you see me move?"); } function tbfunction_ReadInput(readme){ var texttoread=readme GetScreenPositions(); InitAgentCommands(); Merlin.Show(); Merlin.Speak(texttoread); } function tbfunction_agentdomagic() { InitAgentCommands(); Merlin.Show(); Merlin.Play("DoMagic2"); } function tbfunction_agenthide() { InitAgentCommands(); Merlin.Hide(); }