Advertisement
integer aoenabled = TRUE;
integer OCchannel;
integer OClistener;

set_channel()
{
    OCchannel = (integer)("0x"+
                llGetSubString(llGetOwner(),30,-1));
    if (OCchannel > 0)
    {
         OCchannel = -OCchannel;
    }
}

default
{
    state_entry()
    {
        llSetText("OpenCollar test AO interface\nTouch me to toggle\nTouch and hold to reset",<1,1,1>,1.0);
        set_channel();
        OClistener = llListen(OCchannel,"",NULL_KEY,"");
        llSay(OCchannel,"OpenCollar=Yes");
    }
    
    on_rez(integer parm)
    {
        llResetScript();
    }

    touch_start(integer total_number)
    {
        llSetTimerEvent(3.0);
    }
    
    touch_end(integer total_number)
    {
        llSetTimerEvent(0.0);
        if (aoenabled)
        {
            llSay(OCchannel,"499|ZHAO_AOOFF");
            llSetText("OpenCollar test AO interface\nAO disabled",<1,0,0>,1.0);
        }
        else
        {
            llSay(OCchannel,"499|ZHAO_AOON");
            llSetText("OpenCollar test AO interface\nAO enabled",<0,1,0>,1.0);
        }
        aoenabled = !aoenabled;
    }
    
    timer()
    {
        llSay(OCchannel,"OpenCollar=No");
        llDie();
    }
    
    listen(integer channel,string name,key from,string msg)
    {
        if ((channel == OCchannel) &&
            (msg == "OpenCollar?"))
        {
            llSay(OCchannel,"OpenCollar=Yes");
        }
    }
}
  • fs_opencollar_ao_test.txt
  • Last modified: 2012/07/06 22:55
  • by miro.collas