<?xml version="1.0" encoding="UTF-16"?>
<lboxes>
  <lbox>
    <id>102</id>
    <name><![CDATA[Greeting]]></name>
    <desc><![CDATA[The butler will say a greeting to an approaching visitor.]]></desc>
    <script><![CDATA[-- You can customize the butler's greeting to match every visitor.
-- Enter the character name in the table below, along with the greeting for the character's visit.

helloTable =  
                   [kvalue:Name1;CharacterName1;str] : [ "[kvalue:Greeting1;, Hello;str]",    [kvalue:Greet Sound1;H.Percussion.fx2;fx] ],
                   [kvalue:Name2;CharacterName2;str] : [ "[kvalue:Greeting2;, Hi;str]",    [kvalue:Greet Sound2;H.Percussion.fx11;fx] ],
                   [kvalue:Name3;CharacterName3;str] : [ "[kvalue:Greeting3;, Come on in;str]",  [kvalue:Greet Sound3;H.Percussion.fx6;fx] ],
                 

function GetHelloString(desc)

    if (helloTable[desc] == null)
        return desc + "[kvalue:Default Greet;, Hello.;str]";
    else
        return helloTable[desc][0];


function GetHelloSound(desc)

    if (helloTable[desc] == null)
        return [kvalue:Default SFX;H.Percussion.fx9;fx];
    else
        return helloTable[desc][1];


-- It will be called when the script becomes initialized.
function OnInit()

    -- With the SetSensor command, you can customize the distance the butler recognizes a user.
    -- When a user enters in the first variable, the butler recognizes him/her.
    -- When a user steps out of the second variable, the butler does not respond.
    -- Do as follows and the butler recognizes a user when he/she is within a 3m radius.
    -- Again, the butler does not respond when a user steps past a 30m radius.
    H.SetSensor(3, 30);



-- Called when a user enters a distance range that the butler can recognize.
function OnUserEntered(desc)

    -- With the PlaySound command, options for music play or label can be set.
    -- The first variable is to set channels and the second one for music score.
    -- Do as follows and 2 labels will be set for channel no. 0.
    H.PlaySound(0, "r[1]r[2]");

    -- Plays the effect sound for the respective visitors.
    if (GetHelloSound(desc) != null)

        -- The SetPercussion command is for customizing sounds.
        H.SetPercussion(1, GetHelloSound(desc));
        -- "x" refers to SetPercussion, enabling the preset sound.
        H.PlaySound(1, "x");
    

    -- The butler starts an animation.
    -- The first variable "0" refers to the butler.
    -- The second variable "1" refers to the label no. [1] in the PlaySound command.
    -- The third variable is an emote with a waving hand.
    H.StartAnimation(0, 1, [kvalue:Greet Motion;H.Emotion.wave;moti]);

    -- The butler speaks through a speech bubble.
    -- The first variable 2 refers to the label no. [2] in the PlaySound command.
    -- Enter the dialog message of the butler in the second variable.
    H.Say(2 , GetHelloString(desc));


-- Available Motions for Setup:
--    point, sleep, angry, blush, dance, clap, comfort, drink, eat, laugh, kneel, no, 
--    otl, pat, plead, ready, sad, slap, surprise, taunt, thanks, thunder,
--    useup, victory, yes, wave, boo, charge, dislike, panic, salute, smile,
--    sorry, think, blueflag, twoflag, whiteflag, sing, jump]]></script>
    <icon>4</icon>
  </lbox>
</lboxes>
