Titler Script Help

Ask technical support questions about other topics
Post Reply
User avatar
Roswenthe Blackwell
Posts: 163
Joined: Sat Mar 29, 2014 10:14 pm
Has thanked: 76 times
Been thanked: 158 times

Titler Script Help

Post by Roswenthe Blackwell »

I've been using this titler script for awhile, but it has a problem of changing everyone's titlers nearby if one person changes theirs. Is there a way I can edit it so only the user changes their own titler?

Code: Select all

//TSs's Multi-Titler
// Say "/1title1 bananas" to set the title to "bananas"
// For the color you could say "/1title1 setcolor <255,255,0>" or since yellow is in the presets you culd say "/1title1 setcolor yellow"
// to toggle it on and off say "/1title1 toggleit"
//to clear the text say "/1title1 clear" or simply "/1title1" without anything after the name
string mynameis = "title1"; //caps doesn't matter, to use more than one titler at once put this script on another prim and change its name
integer HelpOnStartup = TRUE; // change TRUE to FALSE if you don't want it to provide the help info when it starts
list colors = [ "red",      255,    0,      0,
                "green",    0,      255,    0, 
                "blue" ,    0,      0,      255, 
                "orange" ,  255,    128,    0, 
                "pink" ,    255,    0 ,     128 , 
                "purple" ,  255 ,   0 ,     255, 
                "yellow",   255,    255,    0, 
                "cyan",     0,      255,    255 , 
                "white",    255,    255,    255
                ];
                
                
//////////////////////////////////////
/////end of customization section/////
//////////////////////////////////////
//THIS SCRIPT SHOULD NEVER BE PUT FOR SALE OR PACKED WITH SOMTHIGN THAT IS GONNA BE SOLD, AND MUST ALWAYS REMAIN +MOD, IF YOU WANT USE SOME OF THE
//CODE HERE IN A COMERCIAL PRODUCT LOOK THE CODE UP ON THE WIKI (and if possible give TigroSpottystripes some of the money you made sellign it ;)
string text;
vector color = <1,1,1>;
setColor(string command)
{
     color = <1,1,1>;
    list bits = llParseString2List(command, ["setcolor"],[]);
    integer index = llListFindList(colors,llCSV2List(llList2String(bits,1)));
    if ( index > -1)
    {
        list thiscolor = llList2List(colors,index+1, index+4);
        color = <llList2Float(thiscolor,0), llList2Float(thiscolor,1), llList2Float(thiscolor,2)>/255;
    }
    else
    {
        list thiscolor = llParseString2List(command, ["<", ","],[]);
        color = <llList2Float(thiscolor,1), llList2Float(thiscolor,2), llList2Float(thiscolor,3)>/255;
    }
    
    
    llSetText(text,color, 1);
}
setText(string command)
{
    
   list bits = llParseString2List(command, [" "],[]);
   text = llDumpList2String(llList2List(bits,1, llGetListLength(bits)), " ");
   text = llDumpList2String(llParseString2List(text, ["\\n"],[]), "\n");
   llSetText(text,color, 1);
}
 
clearText()
{
    text = "";
    llSetText(text,color, 1);
}
toggleText()
{
    toggle = !toggle;
    llSetText(llList2String(["", text],toggle), color, 1);
}
   
        
        
        
    
integer lishan;
integer toggle = TRUE;
default
{
    state_entry()
    {
       lishan = llListen(1,"",llGetOwner(),"");
    }
    on_rez(integer param)
    {
        llWhisper(0,"/me : TSs's Multi-Titler started\nget a free copy at http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryMultiTitler");
        if(HelpOnStartup)
        llWhisper(0, "/me : Lost me? Just turn on \"Highlight Transparent\" on the view menu. I'm a small cube, probably above your head. :) \n
Say \"/1title1 bananas\" to set the title to \"bananas\"\n
For the color, you could say \"/1title1 setcolor <255,255,0>\" or since yellow is in the presets, you could say \"/1title1 setcolor yellow\"\n
To toggle it on and off say \"/1title1 toggleit\"\n
To clear the text say \"/1title1 clearit\" or simply \"/1title1\" without anything after the name");
    }
    changed (integer change)
    {
        if (change & CHANGED_OWNER)
        {
            llListenRemove(lishan);
            lishan = llListen(1,"",llGetOwner(),"");
        }
    }
            
    
    listen(integer chan, string name, key id, string msg)
    {
        list messie = llParseString2List(msg, [" "],[]);
        if (llToLower(llList2String(messie,0)) == llToLower(mynameis))
        {
            //list breakdown = llParseString2List(
            if (llToLower(llList2String(messie,1)) == "setcolor")
            {
                setColor(msg);
            }
            else if(llToLower(llList2String(messie,1)) == "clearit")
            {
                clearText();
            }
            else if(llToLower(llList2String(messie,1)) == "toggleit")
            {
                toggleText();
            }
            else
            {
                setText(msg);
            }
        }
    }
    
   
}
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

Re: Titler Script Help

Post by Constance Peregrine »

I think if you change all instances of "/1title1" to whatever other channel name this will work.
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

Re: Titler Script Help

Post by Constance Peregrine »

well, i think you leave the "/" and the first character has to be a channel number, up to 99 if I recall correctly. Anywho, I hope that helps.
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Titler Script Help

Post by Graham Mills »

(See Handy's comment below)

Does this work? You could address other channels by changing the value in the llListen command (then you would start commands /2 for channel 2, for example) but I've amended the code to explicitly listen to channel 1 and ensure that the message comes from the owner.

Stuff deleted to avoid confusion
Last edited by Graham Mills on Mon Jul 06, 2015 10:19 pm, edited 2 times in total.
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: Titler Script Help

Post by Handy Low »

For what it's worth, you don't actually need to check the channel and sender in the listen() event, because your llListen specifies them. So any message that's not sent by the owner on channel 1 will not trigger the listen() event at all in this case.
Handy Low
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Titler Script Help

Post by Graham Mills »

Oh yeah, my bad -- why does Ros get the problem then? :oops:
These users thanked the author Graham Mills for the post:
Roswenthe Blackwell
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: Titler Script Help

Post by Handy Low »

I've just done some testing, and reproduced the problem. The change() event for changing owner isn't working, so it's always listening to the original owner.

For a short-term fix, get people to reset the script when they receive their copy. For a longer-term fix, I suggest using the on_rez() or attach() events to reset the script when the titler is attached. I'd code up a fix and paste it here, but I've run out of time for today. :/
These users thanked the author Handy Low for the post (total 3):
Dot MatrixGraham MillsRoswenthe Blackwell
Handy Low
User avatar
Roswenthe Blackwell
Posts: 163
Joined: Sat Mar 29, 2014 10:14 pm
Has thanked: 76 times
Been thanked: 158 times

Re: Titler Script Help

Post by Roswenthe Blackwell »

Aw, interesting. It's an SL code, so maybe a bug with slightly different programming. I will definitely remind everyone to reset the script. 

I really appreciate all the help.
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: Titler Script Help

Post by Handy Low »

Yes, this is a bug in OpenSim itself. It's a known issue, over three years old and still with no fix.

This is the bug report: http://opensimulator.org/mantis/view.php?id=6056.
These users thanked the author Handy Low for the post:
Roswenthe Blackwell
Handy Low
Post Reply