Jump to content

Gagged chat copy/redirect Scripting


You are about to reply to a thread that has been inactive for 74 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Greetings, hopefully this is going in the right forums.

I have am old script I'm using for my gag. (For the curious, it's the free "Open Pony Play" bit. It serves my needs pretty darn well actually.) My new owner uses a chanspy attachment that allows her to see chat on channels 1 and 3, but my gag doesn't broadcast on those channels.

I was wondering if there might be a way to tweak the script so that it will do so, either as a redirect or a copy or whatever it takes for the gagged speak to appear in local, but for her chanspy thing to see the un-altered chat. I've done some VERY basic scripting, so I can edit it some, but this is far beyond my skills at the moment. I still have SO much to learn about all of this, so I'll take any ideas you can throw at me.

Thank you for your time.

Link to comment
Share on other sites

Well here is the full script. Hopefully that works.

Quote

//start_unprocessed_text
/*integer Flags=4; /|/== Boolean flags; 1 - RLV active, 2 - Items locked, 4 - Gag shown, 8 - Reins active, 16 - runtime perms granted, 32 - will query main HUD on next timer, 64 - Item disabled (likely due to be rezzed vs attached), 128 - Long emotes blocked

integer Cchan; /|/== Communications channel
integer Chandle; /|/== Communications channel listener handle

integer LMhandle; /|/== Lockmeister listen

integer Gchan; /|/== Gag/Bit channel
integer GListen; /|/== Gag/Bit listener
integer Gsev=1; /|/== Gag severity

list primlist;

integer lastchanneltime;
integer replytime; /|/== How soon we must get a response from whatever we're trying to query (Coffle/Post)

key target; /|/== Where the leash textures are going to

key posstarget; /|/== Possible target for coffle
list cofflelist; /|/== List of available attachment points for coffle target

key poster; /|/== Person who is posting us

key grabtarget; /|/== Person who has our leash

string texture = "1ea3a87f-75ae-996e-d7f7-98400ba6c58b"; /|/== Current leash texture

string deftexture = "1ea3a87f-75ae-996e-d7f7-98400ba6c58b"; /|/== Default leash texture

string ANIM = "Express_Open_Mouth";

integer openMouth;

string oName;

Init()
{
        if(llGetAttached() <= 0)
        {
            Flags = Flags | 64;
            return;   
        }
        
        Flags = (Flags | 64) ^ 64;
    
        /|/== Initialize name, check for changes since last wear
        if(oName == "" || (oName != llGetDisplayName(llGetOwner()) && llGetDisplayName(llGetOwner()) != "???"))
            oName = llGetDisplayName(llGetOwner());
        if(oName == "" || oName == "???") /|/== llGetDisplayName failed, fallback to login
        {
            oName = llKey2Name(llGetOwner());
            if(~llSubStringIndex(oName, "Resident")) /|/== No "Resident"; that looks retarded
                oName = llGetSubString(oName, 0, -10);
        }
    
        Flags = (Flags | 16) ^ 16;
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        
        /|/== Clear RLV flag and wait for the main gear to reply
        Flags = (Flags | 1) ^ 1;
        
        llListenRemove(Chandle);
        Cchan = ((integer)("0x"+ llGetSubString(llGetOwner(), 9, 12)) + (integer)("0x"+ llGetSubString(llGetOwner(), 13, 16)));
        Chandle = llListen(Cchan, "", NULL_KEY, "");
        
        llListenRemove(LMhandle);
        LMhandle = llListen(-8888, "", NULL_KEY, "");

        /|/== If that somehow gets set that quickly, sure, why not
        if(Flags & 1)
        {
            lastchanneltime = llGetUnixTime();
            Gchan = (integer)llFrand(100000) + 1234;
            if(Flags & 4 && Gsev > 0)
                llOwnerSay("@sendchat=n,redirchat:"+(string)Gchan+"=n");
        }
        else
        {
            Gchan = 3;
            llOwnerSay("");
        }

        llListenRemove(GListen);        
        GListen = llListen(Gchan, "", llGetOwner(), "");
        
        llSetTimerEvent(1.0);
        
        /|/== Reset the reins texture to default
        texture = deftexture;
        
        /|/== Re-make our prim list
        integer tnum = llGetNumberOfPrims();
        integer i;
        integer j;
        integer tnum2;
        string tstring;
        list tlist;
        primlist = [];
        
        tlist = llGetLinkPrimitiveParams(1,[PRIM_DESC]);
        primlist += tlist + ["1"];
        
        for(i = 2; i <= tnum; i++)
        {
            tlist = llGetLinkPrimitiveParams(i, [PRIM_NAME, PRIM_DESC]);
            
            for(j=0; j<llGetListLength(tlist); j++)
            {
                if(llList2String(tlist,j) != "")
                {
                    tnum2 = llListFindList(primlist,llList2List(tlist,j,j));
                    if(tnum2 != -1) /|/== Entry found, append to existing list of prims
                    {
                        tnum2++;
                        tstring = llList2String(primlist,tnum2) + ","+(string)i;
                        primlist = llListReplaceList(primlist, [tstring], tnum2, tnum2);
                    }
                    else /|/== Entry not found, make a new sub-list
                        primlist = primlist + llList2List(tlist,j,j) + [(string)i];   
                }
            }
        }
        
        /|/== Set up to query the main HUD for status the next time the timer triggers
        Flags = Flags | 32;
}

RLVRefresh()
{
    if(Flags & 1 && !(Flags & 64))
    {
        if(Flags & 2)
            llOwnerSay("@detach=n");
        else
            llOwnerSay("@detach=y");
        
        if(Flags & 4 && Gsev > 0)
            llOwnerSay("@sendchat=n,redirchat:"+(string)Gchan+"=n");
        else
            llOwnerSay("@sendchat=y,@clear=redirchat");

        if(!(Flags & 128))
            llOwnerSay("@emote=add");
        else
            llOwnerSay("@emote=rem");
    }

    animateMouth();
}

/|/== Hide/shows prims based on their tag
HideShow(string tag, float show)
{
    list tlist;
    integer tnum = llListFindList(primlist, [tag]);
    
    if(tnum != -1)
    {
        tnum++;
        tlist = llCSV2List(llList2String(primlist, tnum));
        tnum = llGetListLength(tlist);
        
        integer i;
        
        for(i = 0; i < tnum; i++)
        {
            llSetLinkAlpha(llList2Integer(tlist,i), show, ALL_SIDES);
        }
    }
}

Particles(string tag, integer on, key targ)
{
    list tlist;
    integer tnum = llListFindList(primlist, [tag]);
    
    target = targ;
    
    if(tnum != -1)
    {
        tnum++;
        tlist = llCSV2List(llList2String(primlist, tnum));
        tnum = llGetListLength(tlist);
        
        integer i;
        
        for(i = 0; i < tnum; i++)
        {
            if(on)
            {
                Flags = Flags | 8;
                llLinkParticleSystem(llList2Integer(tlist,i),[
                PSYS_PART_FLAGS,            PSYS_PART_FOLLOW_SRC_MASK|PSYS_PART_FOLLOW_VELOCITY_MASK|PSYS_PART_TARGET_POS_MASK,
                PSYS_SRC_PATTERN,           PSYS_SRC_PATTERN_DROP,
                PSYS_PART_START_SCALE,      <0.07, 0.07, 0.07>,
                PSYS_PART_END_SCALE,        <0.07, 0.07, 0.07>,    
                PSYS_PART_MAX_AGE,          5.0, /|/length,
                PSYS_SRC_ACCEL,             <0.0, 0.0, -0.5>,
                PSYS_SRC_TEXTURE,           texture,
                PSYS_SRC_BURST_RATE,        0.02,
                PSYS_SRC_TARGET_KEY,        target,
                PSYS_SRC_OMEGA,             <0.0, 0.0, 0.2> ]);
            }
            else
            {
                Flags = (Flags | 😎 ^ 8;
                llLinkParticleSystem(llList2Integer(tlist,i), []);
            }
        }
    }      
}

string mumble(string mes)
{
    /|/ Iterate through the speech, mushing up the wearer's diction.
    integer i;
    
    list garbrep = []; /|/==Garble replacement table
    
    if(Gsev == 0 || Flags & 64)
        return mes;
    else if(Gsev == 1) /|/== Light
        garbrep = ["l", "w", "r", "w", "s", "f", "t", "g"];
        
    else if(Gsev == 2) /|/== Moderate
        garbrep = ["r", "w", "l", "w", "y", "w", "q", "w", "j", "w", "d", "s", "f", "b", "g", "t", "g"];
        
    else if(Gsev == 3) /|/== Severe
        garbrep = ["a", "r", "b", "r", "j", "r", "s", "r", "v", "r", "z", "r", "d", "f", "k", "f", "l", "f", "w", "f", "g", "n", "x", "n","h", "d", "i", "d", "m", "d", "u", "d", "q", "m"];
    
    else if(Gsev == 4)
    {
        string ponymessage;
        string ponysound;
        
        /|/== Logic goes here
        if(~llSubStringIndex(mes,"!!") || ~llSubStringIndex(mes,"O_O") || ~llSubStringIndex(mes,"O.O"))
        {
            ponymessage = " neighs!!";
            ponysound = "a79f0ef4-e7e1-1213-14b2-55ee970fc11f";
        }
        else if(~llSubStringIndex(llToLower(mes),"yes"))
        {
            ponymessage = " stomps once";
            ponysound = "c584d463-bff6-2b1c-7174-26f54147f70b";
        }
        else if(~llSubStringIndex(llToLower(mes),"no"))
        {
            ponymessage = " stomps twice";
            ponysound = "b4dea94f-8125-31b5-083a-afe340c8a919";
        }
        else if(~llSubStringIndex(mes,"!") || ~llSubStringIndex(mes,":P") || ~llSubStringIndex(mes,">.<"))
        {
            ponymessage = " snorts!";
            ponysound = "b66a31ec-eb53-a422-1f38-36e5e865d44b";
        }
        else if(~llSubStringIndex(mes,"?") || ~llSubStringIndex(llToLower(mes),"o.o") || ~llSubStringIndex(llToLower(mes),"o_o"))
        {
            ponymessage = " whinnys?";
            ponysound = "e22a27df-8819-a670-738d-13b5db6e63a4";   
        }
        else if(~llSubStringIndex(mes,">:(") || ~llSubStringIndex(mes,">:|"))
        {
            ponymessage = " snorts!!";
            ponysound = "04b340a7-cbf4-57cb-6260-4247433e2f18";   
        }
        else if(~llSubStringIndex(mes,":(") || ~llSubStringIndex(mes,";_;") || ~llSubStringIndex(mes,"T_T"))
        {
            ponymessage = " sighs...";
            ponysound = "b6cdb19b-7a03-77e2-63fb-2f6d1d0d7935";   
        }
        else if(llStringLength(mes) > 20 || ~llSubStringIndex(mes,":)") || ~llSubStringIndex(mes,":D") || ~llSubStringIndex(mes,"^_^"))
        {
            ponymessage = " whinnys!";   
            ponysound = "00abbf24-b1d4-570c-f7fd-d69a3d16819a";
        }
        else
        {
            ponymessage = " nickers";
            ponysound = "f91cfcfb-b79b-e1a6-f867-19c1846b36eb";   
        }
        
        if(ponysound != "")
            llPlaySound(ponysound,1.0);
            
        if(ponymessage != "")
            return ponymessage;   
    }
    else if(Gsev == 5)
        return "";
    
    if(garbrep != [] && llGetSubString(mes,0,3) != "/me " && llGetSubString(mes,0,5) != "/me's")
    {
        for(i = 0; i < llGetListLength(garbrep) - 1; i += 2)
        {
            if(~llSubStringIndex(mes, llList2String(garbrep, i)))
                mes = llDumpList2String(llParseStringKeepNulls((mes = "") + mes, [llList2String(garbrep, i)], []), llList2String(garbrep, i+1));

            if(~llSubStringIndex(mes, llToUpper(llList2String(garbrep, i))))
                mes = llDumpList2String(llParseStringKeepNulls((mes = "") + mes, [llToUpper(llList2String(garbrep, i))], []), llToUpper(llList2String(garbrep, i+1)));
        }
        
        mes = (mes = "") + ": " + mes;
    }
    
    return mes;
}

animateMouth()
{
    if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
    {
        if(openMouth)
        {
            llStartAnimation("bento_open_mouth");
        }
        else
        {
            llStopAnimation("bento_open_mouth");
            llStartAnimation("bento_close_mouth");
        }
    }
    else
    {
        /|/ in case we start to loop
        llSleep(1.0);

        llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
    }
}

default
{
    state_entry()
    {
        Init();
    }
    
    on_rez(integer param)
    {
        Init();   
    }
    
    attach(key id)
    {
        if(id != NULL_KEY)
        {
            llStartAnimation("bento_close_mouth");
            return;
        }

        if(Flags & 1)
            llOwnerSay("@clear");
    }

    listen(integer channel, string name, key id, string message)
    {
        if(Flags & 64)
            jump lbreak;
        
        if(id != llGetOwnerKey(id)) /|/== Accept object communication only
        {
            if(channel == Cchan && llGetOwnerKey(id) == llGetOwner())
            {
                list tlist = llParseString2List(message,[" "],[]);
                
                if(message == "HUD Attach")
                    Flags = Flags | 32;
                    
                else if(message == "Showlocks")
                {
                    Flags = Flags | 2;
                    /|/HideShow("lock", 1); /|/== Bit has no locks
                    RLVRefresh();
                }
                else if(message == "Hidelocks")
                {
                    Flags = (Flags | 2) ^ 2;
                    /|/HideShow("lock", 0.0); /|/== Bit has no locks
                    RLVRefresh();
                }
                else if(message == "RLV On")
                {
                    Flags = Flags | 1;
                    RLVRefresh();   
                }
                else if(message == "RLV Off")
                    Flags = (Flags | 1) ^ 1;
                    
                else if(llList2String(tlist,0) == "Reins")
                {
                    key tkey = llList2Key(tlist,2);
                    
                    if(llList2String(tlist,1) == "Coffle")
                    {
                        if(tkey != NULL_KEY)
                        {
                            posstarget = tkey;
                            poster = NULL_KEY;
                            cofflelist = [];
                            /|/==Query the various valid attachment points
                            llShout(-8888,(string)tkey+"bcollar");
                            llShout(-8888,(string)tkey+"bbelt");
                            llShout(-8888,(string)tkey+"back");
                            llShout(-8888,(string)tkey+"fbelt");
                            llShout(-8888,(string)tkey+"collar");
                            llShout(-8888,(string)tkey+"pelvis");
                            replytime = 3;
                        }
                    }
                    else if(llList2String(tlist,1) == "Post")
                    {
                        if(tkey != NULL_KEY)
                        {
                            poster = tkey;
                            posstarget = NULL_KEY;
                            replytime = 60;
                        }   
                    }
                    else if(llList2String(tlist,1) == "Grab")
                    {
                        if(tkey != NULL_KEY)
                        {
                            grabtarget = tkey;
                            Particles("reins",1,grabtarget);
                            llShout(-8888,(string)tkey+"handle");
                        }
                    }
                    else if(llList2String(tlist,1) == "Target")
                    {
                        if(tkey != NULL_KEY)
                            Particles("reins",1,tkey);
                    }
                    else if(llList2String(tlist,1) == "Unleash")
                    {
                        grabtarget = NULL_KEY;
                        posstarget = grabtarget;
                        poster = grabtarget;
                        
                        Particles("reins",0,grabtarget);
                        texture = deftexture;
                    }
                    else if(llList2String(tlist,1) == "Find" && llList2String(tlist,2) == "Handle" && grabtarget != NULL_KEY)
                        llShout(-8888,(string)grabtarget+"handle");
                }
                /|/== Bit/gag options
                else if(llList2String(tlist,0) == "Bit")
                {
                    openMouth = TRUE;

                    if(llList2String(tlist,1) == "Bar")
                    {
                        Flags = Flags | 4;
                        HideShow("Snaffle",0.0);
                        llSleep(0.1);
                        HideShow("Ball",0.0);
                        llSleep(0.1);
                        HideShow("Straight Bar",1.0);
                    }
                    else if(llList2String(tlist,1) == "Ball")
                    {
                        Flags = Flags | 4;
                        HideShow("Snaffle",0.0);
                        llSleep(0.1);
                        HideShow("Ball",1.0);
                        llSleep(0.1);
                        HideShow("Straight Bar",1.0);
                    }
                    else if(llList2String(tlist,1) == "Snaffle")
                    {
                        Flags = Flags | 4;
                        HideShow("Snaffle",1);
                        llSleep(0.1);
                        HideShow("Ball",0.0);
                        llSleep(0.1);
                        HideShow("Straight Bar",0.0);
                    }
                    else if(llList2String(tlist,1) == "None")
                    {
                        Flags = (Flags | 4) ^ 4;
                        HideShow("Snaffle",0.0);
                        HideShow("Ball",0.0);
                        HideShow("Straight Bar",0.0);
                        openMouth = FALSE;
                    }
                    
                    RLVRefresh();
                }
                else if(llList2String(tlist,0) == "Longem")
                {
                    if(llList2String(tlist,1) == "off")
                        Flags = (Flags | 128) ^ 128;
                    else
                        Flags = Flags | 128;
                        
                    RLVRefresh();   
                }
                else if(llList2String(tlist,0) == "Garble")
                {
                    if(llList2String(tlist,1) == "Light")
                    {
                        Gsev = 1;
                    }
                    else if(llList2String(tlist,1) == "Moderate")
                    {
                        Gsev = 2;
                    }
                    else if(llList2String(tlist,1) == "Heavy")
                    {
                        Gsev = 3;
                    }
                    else if(llList2String(tlist,1) == "Pony")
                    {
                        Gsev = 4;
                    }
                    else if(llList2String(tlist,1) == "Silence")
                    {
                        Gsev = 5;
                    }
                    else if(llList2String(tlist,1) == "None")
                    {
                        Gsev = 0;
                    }
                    
                    if(Gsev == 0)
                    {
                        if(Gchan > 0)
                        {
                            if(Flags & 1)
                                llOwnerSay("@sendchat=y,redirchat:"+(string)Gchan+"=y");

                            llListenRemove(GListen);
                            Gchan = 0;
                        }    
                    }
                    else if(Gchan == 0)
                    {
                        if(Flags & 1)
                        {
                            lastchanneltime = llGetUnixTime();
                            Gchan = (integer)llFrand(100000) + 1234;
                            llOwnerSay("@sendchat=n,redirchat:"+(string)Gchan+"=n");
                        }
                        else
                        {
                            Gchan = 3;
                            llOwnerSay("");
                        }
                        
                        llListenRemove(GListen);
                        GListen = llListen(Gchan, "", llGetOwner(), "");   
                    }
                    
                    RLVRefresh();
                }
            }
            else if(channel == -8888)
            {
                if((message == (string)grabtarget +"handle ok" || message == (string)grabtarget+"dari|lhattach"|| message == (string)grabtarget+"dari|rhattach") && llGetOwnerKey(id) == grabtarget && grabtarget != NULL_KEY)
                {
                    Particles("reins",1,id);
                }
                else if(message == (string)poster +"post ok" && poster != NULL_KEY)
                {
                    vector tpos = llList2Vector(llGetObjectDetails(id,[OBJECT_POS]), 0);
                    if(llVecDist(tpos,llGetPos()) <= 20) /|/== Arbitrary limit to prevent long-distance posting
                    {
                        Particles("reins",1,id);
                        llSay(Cchan,"Reins Post Target "+ (string)id);
                        grabtarget = NULL_KEY;
                        poster = NULL_KEY;
                        posstarget = NULL_KEY;
                        replytime = 0;
                    }
                }
                /|/== Reply from a coffle attempt
                else if((key)llGetSubString(message,0,35) == posstarget && llGetSubString(message,-2,-1) == "ok" && posstarget != NULL_KEY && llGetOwnerKey(id) == posstarget)
                {
                    integer tnum = llListFindList(cofflelist,[llGetSubString(message,37,-4)]);
                    if(tnum == -1) /|/== Don't add duplicates, since the reins can only go to one
                        cofflelist += [llGetSubString(message,37,-4),id];
                        
                }
                if((key)llGetSubString(message,0,35) == llGetOwner() && llGetSubString(message,36,43) == "texture|" && (key)llGetSubString(message,44,-1) != NULL_KEY && llGetOwnerKey(id) == grabtarget && grabtarget != NULL_KEY)
                {
                    texture = llGetSubString(message,44,79);
                    if(Flags & 😎
                        Particles("reins",1,target);
                        
                    llSay(-8888,(string)llGetOwner()+"texture ok");
                }
            }
        }
        else if(channel == Gchan)
        {
            if(Gsev < 5)
            {
                string tname = llGetObjectName();
                llSetObjectName("");
                llSleep(0.1);
                llSay(0, "/me " + oName + mumble(message));
                llSetObjectName(tname);
                llSetObjectName(tname);   
            }
        }
        @lbreak;   
    }
    
    touch_start(integer num)
    {
        do
        {
            num--;
            llSay(Cchan,"Touch "+(string)llDetectedKey(num));
        }
        while(num > 0);
    }

    run_time_permissions(integer perms)
    {
        if(perms & (PERMISSION_TRIGGER_ANIMATION))
        {
            Flags = Flags | 16;
            animateMouth();
        }
    }

    timer()
    {
        if(Flags & 64)
            jump tbreak;
        
        /|/== This will tally up the responses from the coffle request and pick the best
        /|/== Also blanks out the Post tracker
        if(replytime > 0)
        {
            replytime--;
            
            if(replytime == 0)
            {
                /|/== Sort through coffle options and see where we want to attach
                if(posstarget != NULL_KEY && cofflelist != [])
                {
                    if(~llListFindList(cofflelist,["bcollar"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["bcollar"]) + 1)));
                    else if(~llListFindList(cofflelist,["bbelt"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["bbelt"]) + 1)));
                    else if(~llListFindList(cofflelist,["back"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["back"]) + 1)));
                    else if(~llListFindList(cofflelist,["fbelt"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["fbelt"]) + 1)));
                    else if(~llListFindList(cofflelist,["collar"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["collar"]) + 1)));
                    else if(~llListFindList(cofflelist,["pelvis"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["pelvis"]) + 1)));
                    else
                    {
                        llSay(Cchan,"Reins Coffle FAIL "+ (string)posstarget);
                        posstarget = NULL_KEY;
                    }
                    
                    if(posstarget != NULL_KEY)
                        llSay(Cchan,"Reins Coffle OK "+ (string)posstarget);
                }
                
                poster = NULL_KEY;
                posstarget = NULL_KEY;   
            }
        }
        
        /|/== Handle random channel evasion
        if(Flags & 4 && Flags & 1 && Gsev > 0)
        {
            if(llGetUnixTime() - lastchanneltime > 600 && lastchanneltime > 0)
            {
                lastchanneltime = llGetUnixTime();
                llOwnerSay("@redirchat:"+(string)Gchan+"=y");
                Gchan = (integer)llFrand(100000) + 1234;
                llOwnerSay("@redirchat:"+(string)Gchan+"=n");
                llListenRemove(GListen);
                GListen = llListen(Gchan, "", llGetOwner(), "");
            }
        }
        
        /|/== Query the main HUD for Bit configuration
        if(Flags & 32)
        {
            Flags = Flags ^ 32;
            llSay(Cchan,"BitQuery");
        }
        
        @tbreak;
    }
}
*/
//end_unprocessed_text
//nfo_preprocessor_version 0
//program_version Firestorm-ZiStorm 6.3.10.58183 - Toy Wylie
//last_compiled 04/21/2021 13:44:19
//mono

 

integer Flags=4;

integer Cchan;
integer Chandle;

integer LMhandle;

integer Gchan;
integer GListen;
integer Gsev=1;

list primlist;

integer lastchanneltime;
integer replytime;

key target;

key posstarget;
list cofflelist;

key poster;

key grabtarget;

string texture = "1ea3a87f-75ae-996e-d7f7-98400ba6c58b";

string deftexture = "1ea3a87f-75ae-996e-d7f7-98400ba6c58b";

integer openMouth;

string oName;

string mumble(string mes)
{
    
    integer i;
    
    list garbrep = [];
    
    if(Gsev == 0 || Flags & 64)
        return mes;
    else if(Gsev == 1)
        garbrep = ["l", "w", "r", "w", "s", "f", "t", "g"];
        
    else if(Gsev == 2)
        garbrep = ["r", "w", "l", "w", "y", "w", "q", "w", "j", "w", "d", "s", "f", "b", "g", "t", "g"];
        
    else if(Gsev == 3)
        garbrep = ["a", "r", "b", "r", "j", "r", "s", "r", "v", "r", "z", "r", "d", "f", "k", "f", "l", "f", "w", "f", "g", "n", "x", "n","h", "d", "i", "d", "m", "d", "u", "d", "q", "m"];
    
    else if(Gsev == 4)
    {
        string ponymessage;
        string ponysound;
        
        
        if(~llSubStringIndex(mes,"!!") || ~llSubStringIndex(mes,"O_O") || ~llSubStringIndex(mes,"O.O"))
        {
            ponymessage = " neighs!!";
            ponysound = "a79f0ef4-e7e1-1213-14b2-55ee970fc11f";
        }
        else if(~llSubStringIndex(llToLower(mes),"yes"))
        {
            ponymessage = " stomps once";
            ponysound = "c584d463-bff6-2b1c-7174-26f54147f70b";
        }
        else if(~llSubStringIndex(llToLower(mes),"no"))
        {
            ponymessage = " stomps twice";
            ponysound = "b4dea94f-8125-31b5-083a-afe340c8a919";
        }
        else if(~llSubStringIndex(mes,"!") || ~llSubStringIndex(mes,":P") || ~llSubStringIndex(mes,">.<"))
        {
            ponymessage = " snorts!";
            ponysound = "b66a31ec-eb53-a422-1f38-36e5e865d44b";
        }
        else if(~llSubStringIndex(mes,"?") || ~llSubStringIndex(llToLower(mes),"o.o") || ~llSubStringIndex(llToLower(mes),"o_o"))
        {
            ponymessage = " whinnys?";
            ponysound = "e22a27df-8819-a670-738d-13b5db6e63a4";   
        }
        else if(~llSubStringIndex(mes,">:(") || ~llSubStringIndex(mes,">:|"))
        {
            ponymessage = " snorts!!";
            ponysound = "04b340a7-cbf4-57cb-6260-4247433e2f18";   
        }
        else if(~llSubStringIndex(mes,":(") || ~llSubStringIndex(mes,";_;") || ~llSubStringIndex(mes,"T_T"))
        {
            ponymessage = " sighs...";
            ponysound = "b6cdb19b-7a03-77e2-63fb-2f6d1d0d7935";   
        }
        else if(llStringLength(mes) > 20 || ~llSubStringIndex(mes,":)") || ~llSubStringIndex(mes,":D") || ~llSubStringIndex(mes,"^_^"))
        {
            ponymessage = " whinnys!";   
            ponysound = "00abbf24-b1d4-570c-f7fd-d69a3d16819a";
        }
        else
        {
            ponymessage = " nickers";
            ponysound = "f91cfcfb-b79b-e1a6-f867-19c1846b36eb";   
        }
        
        if(ponysound != "")
            llPlaySound(ponysound,1.0);
            
        if(ponymessage != "")
            return ponymessage;   
    }
    else if(Gsev == 5)
        return "";
    
    if(garbrep != [] && llGetSubString(mes,0,3) != "/me " && llGetSubString(mes,0,5) != "/me's")
    {
        for(i = 0; i < llGetListLength(garbrep) - 1; i += 2)
        {
            if(~llSubStringIndex(mes, llList2String(garbrep, i)))
                mes = llDumpList2String(llParseStringKeepNulls((mes = "") + mes, [llList2String(garbrep, i)], []), llList2String(garbrep, i+1));

            if(~llSubStringIndex(mes, llToUpper(llList2String(garbrep, i))))
                mes = llDumpList2String(llParseStringKeepNulls((mes = "") + mes, [llToUpper(llList2String(garbrep, i))], []), llToUpper(llList2String(garbrep, i+1)));
        }
        
        mes = (mes = "") + ": " + mes;
    }
    
    return mes;
}

animateMouth()
{
    if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
    {
        if(openMouth)
        {
            llStartAnimation("bento_open_mouth");
        }
        else
        {
            llStopAnimation("bento_open_mouth");
            llStartAnimation("bento_close_mouth");
        }
    }
    else
    {
        
        llSleep(1.0);

        llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
    }
}

RLVRefresh()
{
    if(Flags & 1 && !(Flags & 64))
    {
        if(Flags & 2)
            llOwnerSay("@detach=n");
        else
            llOwnerSay("@detach=y");
        
        if(Flags & 4 && Gsev > 0)
            llOwnerSay("@sendchat=n,redirchat:"+(string)Gchan+"=n");
        else
            llOwnerSay("@sendchat=y,@clear=redirchat");

        if(!(Flags & 128))
            llOwnerSay("@emote=add");
        else
            llOwnerSay("@emote=rem");
    }

    animateMouth();
}

Particles(string tag, integer on, key targ)
{
    list tlist;
    integer tnum = llListFindList(primlist, [tag]);
    
    target = targ;
    
    if(tnum != -1)
    {
        tnum++;
        tlist = llCSV2List(llList2String(primlist, tnum));
        tnum = llGetListLength(tlist);
        
        integer i;
        
        for(i = 0; i < tnum; i++)
        {
            if(on)
            {
                Flags = Flags | 8;
                llLinkParticleSystem(llList2Integer(tlist,i),[
                PSYS_PART_FLAGS,            PSYS_PART_FOLLOW_SRC_MASK|PSYS_PART_FOLLOW_VELOCITY_MASK|PSYS_PART_TARGET_POS_MASK,
                PSYS_SRC_PATTERN,           PSYS_SRC_PATTERN_DROP,
                PSYS_PART_START_SCALE,      <0.07, 0.07, 0.07>,
                PSYS_PART_END_SCALE,        <0.07, 0.07, 0.07>,    
                PSYS_PART_MAX_AGE,          5.0,
                PSYS_SRC_ACCEL,             <0.0, 0.0, -0.5>,
                PSYS_SRC_TEXTURE,           texture,
                PSYS_SRC_BURST_RATE,        0.02,
                PSYS_SRC_TARGET_KEY,        target,
                PSYS_SRC_OMEGA,             <0.0, 0.0, 0.2> ]);
            }
            else
            {
                Flags = (Flags | 😎 ^ 8;
                llLinkParticleSystem(llList2Integer(tlist,i), []);
            }
        }
    }      
}

Init()
{
        if(llGetAttached() <= 0)
        {
            Flags = Flags | 64;
            return;   
        }
        
        Flags = (Flags | 64) ^ 64;
    
        
        if(oName == "" || (oName != llGetDisplayName(llGetOwner()) && llGetDisplayName(llGetOwner()) != "???"))
            oName = llGetDisplayName(llGetOwner());
        if(oName == "" || oName == "???")
        {
            oName = llKey2Name(llGetOwner());
            if(~llSubStringIndex(oName, "Resident"))
                oName = llGetSubString(oName, 0, -10);
        }
    
        Flags = (Flags | 16) ^ 16;
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        
        
        Flags = (Flags | 1) ^ 1;
        
        llListenRemove(Chandle);
        Cchan = ((integer)("0x"+ llGetSubString(llGetOwner(), 9, 12)) + (integer)("0x"+ llGetSubString(llGetOwner(), 13, 16)));
        Chandle = llListen(Cchan, "", NULL_KEY, "");
        
        llListenRemove(LMhandle);
        LMhandle = llListen(-8888, "", NULL_KEY, "");

        
        if(Flags & 1)
        {
            lastchanneltime = llGetUnixTime();
            Gchan = (integer)llFrand(100000) + 1234;
            if(Flags & 4 && Gsev > 0)
                llOwnerSay("@sendchat=n,redirchat:"+(string)Gchan+"=n");
        }
        else
        {
            Gchan = 3;
            llOwnerSay("");
        }

        llListenRemove(GListen);        
        GListen = llListen(Gchan, "", llGetOwner(), "");
        
        llSetTimerEvent(1.0);
        
        
        texture = deftexture;
        
        
        integer tnum = llGetNumberOfPrims();
        integer i;
        integer j;
        integer tnum2;
        string tstring;
        list tlist;
        primlist = [];
        
        tlist = llGetLinkPrimitiveParams(1,[PRIM_DESC]);
        primlist += tlist + ["1"];
        
        for(i = 2; i <= tnum; i++)
        {
            tlist = llGetLinkPrimitiveParams(i, [PRIM_NAME, PRIM_DESC]);
            
            for(j=0; j<llGetListLength(tlist); j++)
            {
                if(llList2String(tlist,j) != "")
                {
                    tnum2 = llListFindList(primlist,llList2List(tlist,j,j));
                    if(tnum2 != -1)
                    {
                        tnum2++;
                        tstring = llList2String(primlist,tnum2) + ","+(string)i;
                        primlist = llListReplaceList(primlist, [tstring], tnum2, tnum2);
                    }
                    else
                        primlist = primlist + llList2List(tlist,j,j) + [(string)i];   
                }
            }
        }
        
        
        Flags = Flags | 32;
}


HideShow(string tag, float show)
{
    list tlist;
    integer tnum = llListFindList(primlist, [tag]);
    
    if(tnum != -1)
    {
        tnum++;
        tlist = llCSV2List(llList2String(primlist, tnum));
        tnum = llGetListLength(tlist);
        
        integer i;
        
        for(i = 0; i < tnum; i++)
        {
            llSetLinkAlpha(llList2Integer(tlist,i), show, ALL_SIDES);
        }
    }
}

default
{
    state_entry()
    {
        Init();
    }
    
    on_rez(integer param)
    {
        Init();   
    }
    
    attach(key id)
    {
        if(id != NULL_KEY)
        {
            llStartAnimation("bento_close_mouth");
            return;
        }

        if(Flags & 1)
            llOwnerSay("@clear");
    }

    listen(integer channel, string name, key id, string message)
    {
        if(Flags & 64)
            jump lbreak;
        
        if(id != llGetOwnerKey(id))
        {
            if(channel == Cchan && llGetOwnerKey(id) == llGetOwner())
            {
                list tlist = llParseString2List(message,[" "],[]);
                
                if(message == "HUD Attach")
                    Flags = Flags | 32;
                    
                else if(message == "Showlocks")
                {
                    Flags = Flags | 2;
                    
                    RLVRefresh();
                }
                else if(message == "Hidelocks")
                {
                    Flags = (Flags | 2) ^ 2;
                    
                    RLVRefresh();
                }
                else if(message == "RLV On")
                {
                    Flags = Flags | 1;
                    RLVRefresh();   
                }
                else if(message == "RLV Off")
                    Flags = (Flags | 1) ^ 1;
                    
                else if(llList2String(tlist,0) == "Reins")
                {
                    key tkey = llList2Key(tlist,2);
                    
                    if(llList2String(tlist,1) == "Coffle")
                    {
                        if(tkey != NULL_KEY)
                        {
                            posstarget = tkey;
                            poster = NULL_KEY;
                            cofflelist = [];
                            
                            llShout(-8888,(string)tkey+"bcollar");
                            llShout(-8888,(string)tkey+"bbelt");
                            llShout(-8888,(string)tkey+"back");
                            llShout(-8888,(string)tkey+"fbelt");
                            llShout(-8888,(string)tkey+"collar");
                            llShout(-8888,(string)tkey+"pelvis");
                            replytime = 3;
                        }
                    }
                    else if(llList2String(tlist,1) == "Post")
                    {
                        if(tkey != NULL_KEY)
                        {
                            poster = tkey;
                            posstarget = NULL_KEY;
                            replytime = 60;
                        }   
                    }
                    else if(llList2String(tlist,1) == "Grab")
                    {
                        if(tkey != NULL_KEY)
                        {
                            grabtarget = tkey;
                            Particles("reins",1,grabtarget);
                            llShout(-8888,(string)tkey+"handle");
                        }
                    }
                    else if(llList2String(tlist,1) == "Target")
                    {
                        if(tkey != NULL_KEY)
                            Particles("reins",1,tkey);
                    }
                    else if(llList2String(tlist,1) == "Unleash")
                    {
                        grabtarget = NULL_KEY;
                        posstarget = grabtarget;
                        poster = grabtarget;
                        
                        Particles("reins",0,grabtarget);
                        texture = deftexture;
                    }
                    else if(llList2String(tlist,1) == "Find" && llList2String(tlist,2) == "Handle" && grabtarget != NULL_KEY)
                        llShout(-8888,(string)grabtarget+"handle");
                }
                
                else if(llList2String(tlist,0) == "Bit")
                {
                    openMouth = TRUE;

                    if(llList2String(tlist,1) == "Bar")
                    {
                        Flags = Flags | 4;
                        HideShow("Snaffle",0.0);
                        llSleep(0.1);
                        HideShow("Ball",0.0);
                        llSleep(0.1);
                        HideShow("Straight Bar",1.0);
                    }
                    else if(llList2String(tlist,1) == "Ball")
                    {
                        Flags = Flags | 4;
                        HideShow("Snaffle",0.0);
                        llSleep(0.1);
                        HideShow("Ball",1.0);
                        llSleep(0.1);
                        HideShow("Straight Bar",1.0);
                    }
                    else if(llList2String(tlist,1) == "Snaffle")
                    {
                        Flags = Flags | 4;
                        HideShow("Snaffle",1);
                        llSleep(0.1);
                        HideShow("Ball",0.0);
                        llSleep(0.1);
                        HideShow("Straight Bar",0.0);
                    }
                    else if(llList2String(tlist,1) == "None")
                    {
                        Flags = (Flags | 4) ^ 4;
                        HideShow("Snaffle",0.0);
                        HideShow("Ball",0.0);
                        HideShow("Straight Bar",0.0);
                        openMouth = FALSE;
                    }
                    
                    RLVRefresh();
                }
                else if(llList2String(tlist,0) == "Longem")
                {
                    if(llList2String(tlist,1) == "off")
                        Flags = (Flags | 128) ^ 128;
                    else
                        Flags = Flags | 128;
                        
                    RLVRefresh();   
                }
                else if(llList2String(tlist,0) == "Garble")
                {
                    if(llList2String(tlist,1) == "Light")
                    {
                        Gsev = 1;
                    }
                    else if(llList2String(tlist,1) == "Moderate")
                    {
                        Gsev = 2;
                    }
                    else if(llList2String(tlist,1) == "Heavy")
                    {
                        Gsev = 3;
                    }
                    else if(llList2String(tlist,1) == "Pony")
                    {
                        Gsev = 4;
                    }
                    else if(llList2String(tlist,1) == "Silence")
                    {
                        Gsev = 5;
                    }
                    else if(llList2String(tlist,1) == "None")
                    {
                        Gsev = 0;
                    }
                    
                    if(Gsev == 0)
                    {
                        if(Gchan > 0)
                        {
                            if(Flags & 1)
                                llOwnerSay("@sendchat=y,redirchat:"+(string)Gchan+"=y");

                            llListenRemove(GListen);
                            Gchan = 0;
                        }    
                    }
                    else if(Gchan == 0)
                    {
                        if(Flags & 1)
                        {
                            lastchanneltime = llGetUnixTime();
                            Gchan = (integer)llFrand(100000) + 1234;
                            llOwnerSay("@sendchat=n,redirchat:"+(string)Gchan+"=n");
                        }
                        else
                        {
                            Gchan = 3;
                            llOwnerSay("");
                        }
                        
                        llListenRemove(GListen);
                        GListen = llListen(Gchan, "", llGetOwner(), "");   
                    }
                    
                    RLVRefresh();
                }
            }
            else if(channel == -8888)
            {
                if((message == (string)grabtarget +"handle ok" || message == (string)grabtarget+"dari|lhattach"|| message == (string)grabtarget+"dari|rhattach") && llGetOwnerKey(id) == grabtarget && grabtarget != NULL_KEY)
                {
                    Particles("reins",1,id);
                }
                else if(message == (string)poster +"post ok" && poster != NULL_KEY)
                {
                    vector tpos = llList2Vector(llGetObjectDetails(id,[OBJECT_POS]), 0);
                    if(llVecDist(tpos,llGetPos()) <= 20)
                    {
                        Particles("reins",1,id);
                        llSay(Cchan,"Reins Post Target "+ (string)id);
                        grabtarget = NULL_KEY;
                        poster = NULL_KEY;
                        posstarget = NULL_KEY;
                        replytime = 0;
                    }
                }
                
                else if((key)llGetSubString(message,0,35) == posstarget && llGetSubString(message,-2,-1) == "ok" && posstarget != NULL_KEY && llGetOwnerKey(id) == posstarget)
                {
                    integer tnum = llListFindList(cofflelist,[llGetSubString(message,37,-4)]);
                    if(tnum == -1)
                        cofflelist += [llGetSubString(message,37,-4),id];
                        
                }
                if((key)llGetSubString(message,0,35) == llGetOwner() && llGetSubString(message,36,43) == "texture|" && (key)llGetSubString(message,44,-1) != NULL_KEY && llGetOwnerKey(id) == grabtarget && grabtarget != NULL_KEY)
                {
                    texture = llGetSubString(message,44,79);
                    if(Flags & 😎
                        Particles("reins",1,target);
                        
                    llSay(-8888,(string)llGetOwner()+"texture ok");
                }
            }
        }
        else if(channel == Gchan)
        {
            if(Gsev < 5)
            {
                string tname = llGetObjectName();
                llSetObjectName("");
                llSleep(0.1);
                llSay(0, "/me " + oName + mumble(message));
                llSetObjectName(tname);
                llSetObjectName(tname);   
            }
        }
        @lbreak;   
    }
    
    touch_start(integer num)
    {
        do
        {
            num--;
            llSay(Cchan,"Touch "+(string)llDetectedKey(num));
        }
        while(num > 0);
    }

    run_time_permissions(integer perms)
    {
        if(perms & (PERMISSION_TRIGGER_ANIMATION))
        {
            Flags = Flags | 16;
            animateMouth();
        }
    }

    timer()
    {
        if(Flags & 64)
            jump tbreak;
        
        
        
        if(replytime > 0)
        {
            replytime--;
            
            if(replytime == 0)
            {
                
                if(posstarget != NULL_KEY && cofflelist != [])
                {
                    if(~llListFindList(cofflelist,["bcollar"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["bcollar"]) + 1)));
                    else if(~llListFindList(cofflelist,["bbelt"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["bbelt"]) + 1)));
                    else if(~llListFindList(cofflelist,["back"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["back"]) + 1)));
                    else if(~llListFindList(cofflelist,["fbelt"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["fbelt"]) + 1)));
                    else if(~llListFindList(cofflelist,["collar"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["collar"]) + 1)));
                    else if(~llListFindList(cofflelist,["pelvis"]))
                        Particles("reins",1,llList2Key(cofflelist,(llListFindList(cofflelist,["pelvis"]) + 1)));
                    else
                    {
                        llSay(Cchan,"Reins Coffle FAIL "+ (string)posstarget);
                        posstarget = NULL_KEY;
                    }
                    
                    if(posstarget != NULL_KEY)
                        llSay(Cchan,"Reins Coffle OK "+ (string)posstarget);
                }
                
                poster = NULL_KEY;
                posstarget = NULL_KEY;   
            }
        }
        
        
        if(Flags & 4 && Flags & 1 && Gsev > 0)
        {
            if(llGetUnixTime() - lastchanneltime > 600 && lastchanneltime > 0)
            {
                lastchanneltime = llGetUnixTime();
                llOwnerSay("@redirchat:"+(string)Gchan+"=y");
                Gchan = (integer)llFrand(100000) + 1234;
                llOwnerSay("@redirchat:"+(string)Gchan+"=n");
                llListenRemove(GListen);
                GListen = llListen(Gchan, "", llGetOwner(), "");
            }
        }
        
        
        if(Flags & 32)
        {
            Flags = Flags ^ 32;
            llSay(Cchan,"BitQuery");
        }
        
        @tbreak;
    }
}

 

 

Link to comment
Share on other sites

Posted (edited)

Would help if it had line numbers, perhaps @Coffee Pancake should suggest copying a long script like that to pastebin next time.

Anyway, change

Gchan = (integer)llFrand(100000) + 1234;

to

Gchan = 3; // or whatever channel you want to use.

That line appears multiple times in the code; you will need to be sure to replace it the same way everywhere it appears.

I'd tell you to set it to a specific value on the first line gChan appears (line 10?), and also change some other things about how the value is checked in other spots in the code, but the script has some sloppy programming which makes even a simple change like this harder than it needs to be, and I'm not about to completely overhaul the script for you.

Edited by Quistess Alpha
  • Thanks 2
Link to comment
Share on other sites

6 minutes ago, Quistess Alpha said:

Would help if it had line numbers, perhaps @Coffee Pancake should suggest copying a long script like that to pastebin next time.

Anyway, change


Gchan = (integer)llFrand(100000) + 1234;

to


Gchan = 3; // or whatever channel you want to use.

That line appears at least twice in the code; you will need to be sure to replace it the same way everywhere it appears.

Well I apologize for making it hard on you. I will try to remember that next time.

However, that did it! So thank you! It's such a little thing, but I and my owner will get to enjoy things so much more because of it.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

7 hours ago, Quistess Alpha said:

Would help if it had line numbers, perhaps @Coffee Pancake should suggest copying a long script like that to pastebin next time.

I wasn't expecting something even a fraction the length!

Had intended to just sort it myself but it would have had to wait till I could fit the time in, so thank you very much.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

37 minutes ago, Coffee Pancake said:

I wasn't expecting something even a fraction the length!

Had intended to just sort it myself but it would have had to wait till I could fit the time in, so thank you very much.

What I get for using such an old script. But I got my answer despite that, so I than you greatly for being willing.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 74 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...