Jump to content
AodhanDomhnall

Hover Text Line Breaking Via Chat

Recommended Posts

So I've been trying to create a basic Titler for my group to use. My intention is to have a Titler that allows you to change both the text and color on the /55 channel. Currently, the script works perfectly in changing the text by using the /55 channel. However, I cannot figure out how to get the script to parse \n for the function, instead of setting it as text. Also, I can't seem to get the script to parse RGB commands either, for changing the title color.

 

So far, this is the FUNCTIONING script that I've compiled. Any help with adding the ability to add new lines via chat command, or change the color via chat, would be very appreciated. Thank you in advance.

 

 
 integer CommandIs(string msg,string cmd)
 {
     return llSubStringIndex(msg,cmd) == 0;
 }
 ParseAndIssueCommand(string cmd)
 {
 
     if(CommandIs(cmd,"Title"))
     {
         string name = llGetSubString(cmd,6,-1);
         if(name == "Title")
             llSetText("",<0,1,0>,1.0);
         else
             llSetText(name,<0,1,0>,1.0);   
     }
 }
 default
 {
     state_entry()
     {
          llListen(55,"",llGetOwner(),"");
     }
         on_rez(integer start_param)
         {
         llResetScript();
         }  
         listen(integer channel, string name, key id, string msg)
     {
         ParseAndIssueCommand(msg);
     }
 }

 

Share this post


Link to post
Share on other sites

for breaking a text into multiple lines have a look at Ruthven's code example down in this thread here: 

Ruthven parses the input text into a list, and then processes the list

in your case then break the /55 text into a list as Ruthven does. Command words like "title" and "color"  will be in the 0th element of the list. The command parameters will be in element 1 upwards

when the command is 'color' then is a couple of options. Can either treat list element 1 as a vector containing the color value. Or can treat it as a label and map it to a color vector in a lookup list.  Example pcode:

list colors = [
   "white", <1.0,1.0,1.0>,
   "red",   <1.0,0.0,0.0>,
   "green", <0.0,1.0,0.0>,
   "blue",  <0.0,0.0,1.0>
]

vector color = <1.0,1.0,1.0>;
string outputtext;


.. /55 color blue  ..
.. /55 title Hello hello hello something something else somthing more

.. in the listen event then something like this

list data = llParseString2List(text, [" "], []);
string command = llToLower(llList2String(data, 0));
data = llDeleteSubList(data, 0, 0);  // remove the command
if (command == "title")
{
   breaktext(data);
   ...  llSetText( ... ) ...
}
else if (command == "color")
{
   integer i = llListFindList(colors, [llToLower(llList2String(data, 0))]);
   if (~i)
   {
      color = llList2Vector(colors, i + 1);
      llSetText(outputtext, color ...);
   }
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...