Difference between revisions of "Template:Darwin's Scripts"

From Second Life Wiki
Jump to: navigation, search
m
Line 272: Line 272:
 
     {
 
     {
 
         llOwnerSay("Button "+(string)detected_buttonUV(llDetectedTouchUV(0)));
 
         llOwnerSay("Button "+(string)detected_buttonUV(llDetectedTouchUV(0)));
 +
    }
 +
}</lsl></div></div>
 +
| pass code dialog = <div id="box">
 +
==Pass Code Dialog==
 +
<div style="padding: 0.5em">
 +
A simple script that will receive number inputs through menu like a number pad, and will grant access when submission matches pass code
 +
<lsl>string pass_code = "1234";
 +
string code_input;
 +
 +
integer dialog_ch;
 +
integer dialog_handle;
 +
key dialog_user;
 +
 +
list rebutton(list src)
 +
{
 +
    list temp;
 +
   
 +
    temp += llList2List(src, -3, -1);
 +
    temp += llList2List(src, -6, -4);
 +
    temp += llList2List(src, -9, -7);
 +
    temp += llList2List(src, -12, -10);
 +
   
 +
    return temp;
 +
}
 +
 +
integer rand(integer max)
 +
{
 +
    return llAbs((integer)("0x"+llGetSubString(llMD5String((string)llFrand(10000), 0), 0, 7)))%max;
 +
}
 +
 +
num_pad()
 +
{
 +
    list buttons = [
 +
"1", "2", "3",
 +
"4", "5", "6",
 +
"7", "8", "9",
 +
"Submit", "0", "Cancel"];
 +
   
 +
    llDialog(dialog_user, "Enter pass code.\n\n"+code_input, rebutton(buttons), dialog_ch);
 +
}
 +
 +
new_channel()
 +
{
 +
    dialog_ch = rand(1 << 30);
 +
    llListenRemove(dialog_handle);
 +
    dialog_handle = llListen(dialog_ch, "", "", "");
 +
}
 +
 +
new_user(key user)
 +
{
 +
    dialog_user = user;
 +
    code_input = "";
 +
    new_channel();
 +
    num_pad();
 +
   
 +
    llSetTimerEvent(10);
 +
}
 +
 +
clear_user()
 +
{
 +
    llSetTimerEvent(0);
 +
    dialog_user = NULL_KEY;
 +
    llListenRemove(dialog_handle);
 +
    dialog_handle = 0;
 +
}
 +
 +
default
 +
{
 +
    touch_start(integer s)
 +
    {
 +
        if(dialog_user);
 +
        else
 +
            new_user(llDetectedKey(0));
 +
    }
 +
   
 +
    timer()
 +
    {
 +
        clear_user();
 +
    }
 +
   
 +
    listen(integer channle, string name, key id, string message)
 +
    {
 +
        if(id != dialog_user) return;
 +
       
 +
        if((integer)message)
 +
        {
 +
            code_input += message;
 +
            num_pad();
 +
        }
 +
       
 +
        if(message == "Submit")
 +
        {
 +
            if(code_input == pass_code)
 +
                llSay(0, "Access granted.");
 +
            else
 +
                llSay(0, "Access denied.");
 +
           
 +
            clear_user();
 +
        }
 +
       
 +
        if(message == "Cancel")
 +
            clear_user();
 
     }
 
     }
 
}</lsl></div></div>
 
}</lsl></div></div>
Line 287: Line 389:
 
* date difference (1)
 
* date difference (1)
 
* uv button maker (2)
 
* uv button maker (2)
 +
* pass code dialog (1)
  
 
==Templates List==
 
==Templates List==
 
[https://wiki.secondlife.com/w/index.php?title=Special%3APrefixIndex&from=&namespace=10 List of all wiki templates]
 
[https://wiki.secondlife.com/w/index.php?title=Special%3APrefixIndex&from=&namespace=10 List of all wiki templates]
 
</noinclude>
 
</noinclude>

Revision as of 10:03, 14 December 2008

Usage

{{Darwin's Scripts|script name}}

Returns lsl scripts in a div box with descriptions

Contents:

  • find screen width (1)
  • color picker (2)
  • date difference (1)
  • uv button maker (2)
  • pass code dialog (1)

Templates List

List of all wiki templates