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

From Second Life Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
<div style="padding: 0.5em">
<div style="padding: 0.5em">
The script below will give the width of the screen in meters by touching anywhere on the visible face, given that the prim is a box with zero rotation and attached at one of the corner HUD attachment points.
The script below will give the width of the screen in meters by touching anywhere on the visible face, given that the prim is a box with zero rotation and attached at one of the corner HUD attachment points.
<mono>default
<lsl>default
{
{
     touch_start(integer total_number)
     touch_start(integer total_number)
Line 18: Line 18:
         llOwnerSay((string)screen_width);
         llOwnerSay((string)screen_width);
     }
     }
}</mono></div></div>
}</lsl></div></div>
  | date difference = <div id="box">
  | date difference = <div id="box">
==Date Difference==
==Date Difference==
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()
{
    llSetTimerEvent(10);
    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();
}
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 || message == "0")
        {
            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>

Latest revision as of 02:29, 6 October 2009

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