Difference between revisions of "Dialog Message"

From Second Life Wiki
Jump to navigation Jump to search
(Clean up your code before you post it.)
m (<lsl> tag to <source>)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}{{#vardefine:p_channel_desc|channel number the script is listening on
}}{{#vardefine:p_message_desc|message to display
}}


just a simple script thats lets you say messages over a dialog instead of using llSay or llShout  
A simple script thats lets anyone say a messages over a dialog instead of using [[llSay]] or [[llShout]].
so it lets everyone see.


USAGE: /channel dialog "message" (without quotes)
===Usage: /{{LSL Param|channel}} dialog {{LSL Param|message}}===
{|
{{LSL DefineRow|integer|channel|{{#var:p_channel_desc}}}}
{{LSL DefineRow|string|message|{{#var:p_message_desc}}}}
|}


<pre>
<source lang="lsl2">
integer channel = 1000;
integer channel = 1000;


integer llDialogMsg(string msg,string command)
string token;
{
string data;
    return llSubStringIndex(msg,command) == 0;
}


key uuid;
list names;
list keys;
integer handle;
integer gPos = 0;
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         llListen(channel,"", "","");  
         llListen(channel, "", "", "");
     }
     }
      
      
Line 29: Line 27:
     {
     {
         llResetScript();
         llResetScript();
     }
     }
          
          
     sensor(integer num_detected)
     sensor(integer num_detected)
     {  
     {  
         names = [];
         if(token == "dialog")
        gPos = 0;
        integer i;
 
     
        for (i = 0; i < num_detected; i++)
         {
         {
             names = names + llDetectedKey(i);
             integer i = 0;
            for(; i < num_detected; ++i)
                llDialog(llDetectedKey(i), data, [], channel );
         }
         }
     }
     }
       
   
     listen(integer chan, string name, key id, string command)
     listen(integer chan, string name, key id, string command)
     {
     {
         string name0 = llList2String(names, 0);
         integer s = llSubStringIndex(command," ");
        string name1 = llList2String(names, 1);
         if (~s)
        string name2 = llList2String(names, 2);
        string name3 = llList2String(names, 3);
        string name4 = llList2String(names, 4);
        string name5 = llList2String(names, 5);
        string name6 = llList2String(names, 6);
        string name7 = llList2String(names, 7);
        string name8 = llList2String(names, 8);
        string name9 = llList2String(names, 9);
        string name10 = llList2String(names, 10);
        string name11 = llList2String(names, 11);
        string name12 = llList2String(names, 12);
        string name13 = llList2String(names, 13);
        string name14 = llList2String(names, 14);
        string name15 = llList2String(names, 15);
        string name16 = llList2String(names, 16);
        string name17 = llList2String(names, 17);
        string name18 = llList2String(names, 18);
        string name19 = llList2String(names, 19);
        string name20 = llList2String(names, 20);
        string name21 = llList2String(names, 21);
        string name22 = llList2String(names, 22);
        string name23 = llList2String(names, 23);
        string name24 = llList2String(names, 24);
        string name25 = llList2String(names, 25);
        string name26 = llList2String(names, 26);
        string name27 = llList2String(names, 27);
        string name28 = llList2String(names, 28);
        string name29 = llList2String(names, 29);
        string name30 = llList2String(names, 30);
        uuid=llGetOwner();
 
         if (llDialogMsg(command,"dialog"))
         {
         {
             name = llGetSubString(command,7,-1);
             token = llDeleteSubString(command, s, -1);
             if (name != "dialog")
             data = llDeleteSubString(command, 0, s);
                llDialog(uuid,name,["OK"],channel );
             if(token == "dialog")
             llDialog(name0,name,["OK"],channel );
                llSensor( "", "", AGENT, 32, PI );
            llDialog(name1,name,["OK"],channel );
            llDialog(name2,name,["OK"],channel );
            llDialog(name3,name,["OK"],channel );
            llDialog(name4,name,["OK"],channel );
            llDialog(name5,name,["OK"],channel );
            llDialog(name6,name,["OK"],channel );
            llDialog(name7,name,["OK"],channel );
            llDialog(name8,name,["OK"],channel );
            llDialog(name9,name,["OK"],channel );
            llDialog(name10,name,["OK"],channel );
            llDialog(name11,name,["OK"],channel );
            llDialog(name12,name,["OK"],channel );
            llDialog(name13,name,["OK"],channel );
            llDialog(name14,name,["OK"],channel );
            llDialog(name15,name,["OK"],channel );
            llDialog(name16,name,["OK"],channel );
            llDialog(name17,name,["OK"],channel );
            llDialog(name18,name,["OK"],channel );
            llDialog(name19,name,["OK"],channel );
            llDialog(name20,name,["OK"],channel );
            llDialog(name21,name,["OK"],channel );
            llDialog(name22,name,["OK"],channel );           
            llDialog(name23,name,["OK"],channel );
            llDialog(name24,name,["OK"],channel );
            llDialog(name25,name,["OK"],channel );
            llDialog(name26,name,["OK"],channel );
            llDialog(name27,name,["OK"],channel );
            llDialog(name28,name,["OK"],channel );
            llDialog(name29,name,["OK"],channel );
            llDialog(name30,name,["OK"],channel );
            llListenRemove(handle);
            llSleep(1);
         }
         }
     }
     }
}
}
</pre>
</source>
 
Enjoy :)
 
For technical support, requests, etc., use the Search under the Groups Tab and search for .::Prototype::.
</pre>
if you have any problems getting this script to work either contact me inworld [[User:Revolution_Perenti|Revolution Perenti]]
or visit out Open Source Section at skidz partz we have many different versions of this system.
[http://slurl.com/secondlife/Snow%20Crash/128/128/23 Snow Crash]


{{#vardefine:sort|Dialog Message}}{{LSLC|Library}}{{LSLC|Examples}}
{{LSLC|Examples}}

Latest revision as of 14:47, 24 January 2015

A simple script thats lets anyone say a messages over a dialog instead of using llSay or llShout.

Usage: /channel dialog message

• integer channel channel number the script is listening on
• string message message to display
integer channel = 1000;

string token;
string data;

default
{
    state_entry()
    {
        llListen(channel, "", "", "");
    }
    
    on_rez(integer start_param)
    {
        llResetScript();
    }
        
    sensor(integer num_detected)
    { 
        if(token == "dialog")
        {
            integer i = 0;
            for(; i < num_detected; ++i)
                llDialog(llDetectedKey(i), data, [], channel );
        }
    }
    
    listen(integer chan, string name, key id, string command)
    {
        integer s = llSubStringIndex(command," ");
        if (~s)
        {
            token = llDeleteSubString(command, s, -1);
            data = llDeleteSubString(command, 0, s);
            if(token == "dialog")
                llSensor( "", "", AGENT, 32, PI );
        }
    }
}