User:Zand Gundersen/Scripts: Difference between revisions
No edit summary |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
==Zand Gundersen's Mail Box Script== | Here is some scripts I did. | ||
These scripts are under the Creative Commons Attribution-Share Alike 3.0 United States License. | |||
You can go to http://creativecommons.org/licenses/by-sa/3.0/us/ to view a copy of this license. | |||
==Block Buddy== | |||
===Code=== | |||
<lsl>// Block Buddy | |||
// by Zand Gundersen | |||
// Causes Object to look at nearest Avitar. | |||
// | |||
// This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSensorRepeat("", NULL_KEY, AGENT, 20, PI, 0.2); | |||
} | |||
sensor(integer total_number) | |||
{ | |||
llLookAt(llDetectedPos(0) + <0,0,1>, 3, 1 ); | |||
} | |||
}</lsl> | |||
==Zand's Keyboard Script== | |||
This is my keyboard script. | |||
It makes object only appear while typing. | |||
===Version 1.1 Code=== | |||
<lsl>// Zand's Keyboard Script | |||
// by Zand Gundersen | |||
// Makes Object only appear while typing. | |||
// | |||
// This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | |||
key owner; | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSetTimerEvent(0.2); | |||
owner = llGetOwner(); | |||
} | |||
timer() | |||
{ | |||
if(AGENT_TYPING == llGetAgentInfo(owner)) | |||
{ | |||
llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES); | |||
} | |||
else | |||
{ | |||
llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); | |||
} | |||
} | |||
}</lsl> | |||
==Zand's Mail Box Script== | |||
This is my mail box script i have been working on. | This is my mail box script i have been working on. | ||
I will try to keep it updated. | I will try to keep it updated. | ||
| Line 5: | Line 65: | ||
===Version 1.0 Code=== | ===Version 1.0 Code=== | ||
<lsl> | <lsl>// Mail Box Script | ||
// Zand Gundersen | // by Zand Gundersen | ||
// This script turns an ordenary prim into a Mail Box. | // This script turns an ordenary prim into a Mail Box. | ||
// | // | ||
// - | // This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | ||
// | |||
// | |||
// | |||
default | default | ||
| Line 23: | Line 77: | ||
llAllowInventoryDrop(TRUE); | llAllowInventoryDrop(TRUE); | ||
llSetClickAction(CLICK_ACTION_OPEN); | llSetClickAction(CLICK_ACTION_OPEN); | ||
llSetText(llKey2Name(llGetOwner()) + "'s Mail Box:\nClick to Open then Drag and Drop\n Item into Box",<1,1,.5>,.75 ); | llSetText(llKey2Name(llGetOwner()) + "'s Mail Box:\nClick to Open then Drag and Drop\n Item into Box", <1, 1, 0.5>, 0.75); | ||
} | } | ||
} | }</lsl> | ||
</lsl> | |||
===Version 1.1a Code=== | ===Version 1.1a Code=== | ||
<lsl> | This version is still alpha so it is likely to chang but keep the same name. | ||
// Zand Gundersen's Mail Box Script Version 1.1a | <lsl>// Zand Gundersen's Mail Box Script Version 1.1a | ||
// This script turns an ordenary prim into a Mail Box. | // This script turns an ordenary prim into a Mail Box. | ||
// It now has a Dialog Menu and the option to IM you about new mail. | // It now has a Dialog Menu and the option to IM you about new mail. | ||
string credits=" | string credits = " | ||
-=Credits=- | -=Credits=- | ||
Apr 7, 2008 - | Apr 7, 2008 - Created by Zand Gundersen | ||
Apr 8, 2008 - Tested by Honyii Iwish | |||
This script is public domain and should be copyable! | This script is public domain and should be copyable! | ||
"; | "; | ||
// | // This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | ||
// | |||
// | //Config | ||
integer chan = 11; //Dialog Chat Channel | |||
integer sendim = TRUE; //Im You if theres New Mail | |||
integer updatetime = 10; //How often in seconds to update info | |||
integer face = 6; // What face To change the color of | |||
integer | vector newcolor = <1,0,1>;// What color to set the face on New Mail | ||
vector oldcolor = <0,1,0>;// What color to set the face on Reset | |||
//End of Config | //End of Config | ||
//Variables that make the script work | // Variables that make the script work | ||
//Don't edit unless you know what your doing | // Don't edit unless you know what your doing | ||
string version="1.1a"; //Version Number | string version = "1.1a"; // Version Number | ||
string endcmd="Close"; //End Dialog | string endcmd = "Close"; // End Dialog | ||
list usercmd=["About","Status","Admin"]; //User Menu | list usercmd = ["About", "Status", "Admin"]; // User Menu | ||
string usertext="User"; | string usertext = "User"; // User Menu Text | ||
list admincmd=["Back","Reset","Test"]; //Admin Menu | list admincmd = ["Back", "Reset", "Test", "IM"]; // Admin Menu | ||
string admintext="Admin"; | string admintext = "Admin"; // Admin Menu Text | ||
string owner; //Owner Key | string owner; // Owner Key | ||
string im=""; | string im = ""; | ||
integer online=TRUE; | integer online = TRUE; | ||
SetNew(integer new) | SetNew(integer new) | ||
{ | { | ||
vector pos=llGetPos(); | vector pos = llGetPos(); | ||
if (new) //Yay New Mail | if (new) // Yay New Mail | ||
im="You Got Mail | { | ||
// Run Code for New Mail | |||
llSetColor( | im = "You Got Mail (http://slurl.com/secondlife/" + llGetRegionName() + "/" + (string) pos.x + "/"+(string)pos.y + "/" + (string) pos.z + ")"; | ||
llSetColor(newcolor, face); | |||
} | |||
else | |||
{ | |||
// Run Code for No New Mail | |||
llSetColor(oldcolor, face); | |||
} | |||
} | } | ||
| Line 88: | Line 152: | ||
llSetClickAction(CLICK_ACTION_OPEN); | llSetClickAction(CLICK_ACTION_OPEN); | ||
llAllowInventoryDrop(TRUE); | llAllowInventoryDrop(TRUE); | ||
owner=llGetOwner(); | owner = llGetOwner(); | ||
llSetText( llKey2Name(owner) + "'s Mail Box:\ | llSetText( llKey2Name(owner) + "'s Mail Box:\nTo add an Item\nRight Click and Open\n then Drag and Drop\n Item into Box.\n---\nNote: This is still in the testing phase", <1,1,.5>, .75 ); | ||
} | } | ||
touch(integer num) | touch(integer num) | ||
{ | { | ||
key id=llDetectedKey(0); | key id = llDetectedKey(0); | ||
llDialog(id, usertext, endcmd+usercmd, chan); //Show user menu | llDialog(id, usertext, endcmd + usercmd, chan); //Show user menu | ||
} | } | ||
timer() | timer() | ||
{ | { | ||
if (im!="") | if (im != "") | ||
{ | { | ||
if (sendim) | |||
llInstantMessage(owner, im); | llInstantMessage(owner, im); | ||
im=""; | im = ""; | ||
} | } | ||
llRequestAgentData(owner, DATA_ONLINE); | llRequestAgentData(owner, DATA_ONLINE); | ||
| Line 126: | Line 191: | ||
listen( integer channel, string name, key id, string msg ) | listen( integer channel, string name, key id, string msg ) | ||
{ | { | ||
msg=llToLower(msg); | msg = llToLower(msg); | ||
if (msg==llToLower(endcmd)) //End | if (msg == llToLower(endcmd)) //End | ||
{ | { | ||
//Do Nothing | //Do Nothing | ||
} | } | ||
else if (msg=="back") //Back | else if (msg == "back") //Back | ||
{ | { | ||
llDialog(id, usertext, endcmd+usercmd, chan); //Show user menu | llDialog(id, usertext, endcmd+usercmd, chan); //Show user menu | ||
} | } | ||
else if (msg=="status") //Status | else if (msg == "status") //Status | ||
{ | { | ||
if (online) //Check Online | if (online) //Check Online | ||
{ | { | ||
llDialog(id, llKey2Name(owner)+" is Online",endcmd+["Back"],chan); | llDialog(id, llKey2Name(owner) + " is Online", endcmd+["Back"], chan); | ||
} | } | ||
else | else | ||
{ | { | ||
llDialog(id, llKey2Name(owner)+" is Offline",endcmd+["Back"],chan); | llDialog(id, llKey2Name(owner) + " is Offline", endcmd+["Back"], chan); | ||
} | } | ||
} | } | ||
else if (msg=="about") //About | else if (msg == "about") //About | ||
{ | { | ||
llDialog(id, "Zand Gundersen's Mail Box Script Version "+version+credits,endcmd+["Back"],chan); | llDialog(id, "Zand Gundersen's Mail Box Script Version " + version + credits, endcmd + ["Back"], chan); | ||
} | } | ||
else if (msg=="admin") //Admin | else if (msg == "admin") //Admin | ||
{ | { | ||
if (id==owner) | if (id == owner) | ||
{ | { | ||
llDialog(id, admintext, endcmd+admincmd,chan); //Show admin menu | llDialog(id, admintext, endcmd+admincmd, chan); //Show admin menu | ||
} | } | ||
else | else | ||
{ | { | ||
llDialog(id, "Only Owner Can Do That", endcmd+["Back"],chan); | llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan); | ||
} | } | ||
} | } | ||
else if (msg=="reset") //Reset | else if (msg == "reset") //Reset | ||
{ | { | ||
if (id==owner) | if (id == owner) | ||
{ | { | ||
llDialog(id, "Rested",endcmd+["Back"],chan); | llDialog(id, "Rested", endcmd + ["Back"], chan); | ||
llResetScript(); | llResetScript(); | ||
} | } | ||
else | else | ||
{ | { | ||
llDialog(id, "Only Owner Can Do That",endcmd+["Back"],chan); | llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan); | ||
} | } | ||
} | } | ||
else if (msg=="test") //Test | else if (msg == "test") //Test | ||
{ | { | ||
if (id==owner) | if (id == owner) | ||
{ | { | ||
llDialog(id, "Test Send",endcmd+["Back"],chan); | llDialog(id, "Test Send", endcmd + ["Back"], chan); | ||
SetNew(TRUE); | SetNew(TRUE); | ||
} | } | ||
else | else | ||
{ | { | ||
llDialog(id, "Only Owner Can Do That",endcmd+["Back"],chan); | llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan); | ||
} | |||
} | |||
else if (msg == "im") //IM | |||
{ | |||
if (id == owner) | |||
{ | |||
sendim = !sendim; | |||
if (sendim) | |||
llDialog(id, "Send Im is now On!\nYou will be notified vea IM about new mail.\nPress IM to change this", endcmd + ["Back", "IM"], chan); | |||
else | |||
llDialog(id, "Send Im is now Off!\nYou will not be notified vea IM about new mail.\nPress IM to change this", endcmd + ["Back", "IM"], chan); | |||
} | |||
else | |||
{ | |||
llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan); | |||
} | } | ||
} | } | ||
} | } | ||
} | }</lsl> | ||
</lsl> | |||
Latest revision as of 19:07, 9 April 2008
Here is some scripts I did. These scripts are under the Creative Commons Attribution-Share Alike 3.0 United States License. You can go to http://creativecommons.org/licenses/by-sa/3.0/us/ to view a copy of this license.
Block Buddy
Code
<lsl>// Block Buddy // by Zand Gundersen // Causes Object to look at nearest Avitar. // // This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
default {
state_entry()
{
llSensorRepeat("", NULL_KEY, AGENT, 20, PI, 0.2);
}
sensor(integer total_number)
{
llLookAt(llDetectedPos(0) + <0,0,1>, 3, 1 );
}
}</lsl>
Zand's Keyboard Script
This is my keyboard script. It makes object only appear while typing.
Version 1.1 Code
<lsl>// Zand's Keyboard Script // by Zand Gundersen // Makes Object only appear while typing. // // This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
key owner;
default {
state_entry()
{
llSetTimerEvent(0.2);
owner = llGetOwner();
}
timer()
{
if(AGENT_TYPING == llGetAgentInfo(owner))
{
llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
}
else
{
llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
}
}
}</lsl>
Zand's Mail Box Script
This is my mail box script i have been working on. I will try to keep it updated.
Version 1.0 Code
<lsl>// Mail Box Script // by Zand Gundersen // This script turns an ordenary prim into a Mail Box. // // This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
default {
state_entry()
{
llAllowInventoryDrop(TRUE);
llSetClickAction(CLICK_ACTION_OPEN);
llSetText(llKey2Name(llGetOwner()) + "'s Mail Box:\nClick to Open then Drag and Drop\n Item into Box", <1, 1, 0.5>, 0.75);
}
}</lsl>
Version 1.1a Code
This version is still alpha so it is likely to chang but keep the same name. <lsl>// Zand Gundersen's Mail Box Script Version 1.1a
// This script turns an ordenary prim into a Mail Box. // It now has a Dialog Menu and the option to IM you about new mail. string credits = "
-=Credits=- Apr 7, 2008 - Created by Zand Gundersen Apr 8, 2008 - Tested by Honyii Iwish
This script is public domain and should be copyable! "; // This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
//Config
integer chan = 11; //Dialog Chat Channel
integer sendim = TRUE; //Im You if theres New Mail integer updatetime = 10; //How often in seconds to update info
integer face = 6; // What face To change the color of vector newcolor = <1,0,1>;// What color to set the face on New Mail vector oldcolor = <0,1,0>;// What color to set the face on Reset //End of Config
// Variables that make the script work // Don't edit unless you know what your doing string version = "1.1a"; // Version Number string endcmd = "Close"; // End Dialog list usercmd = ["About", "Status", "Admin"]; // User Menu string usertext = "User"; // User Menu Text list admincmd = ["Back", "Reset", "Test", "IM"]; // Admin Menu string admintext = "Admin"; // Admin Menu Text string owner; // Owner Key string im = ""; integer online = TRUE;
SetNew(integer new) {
vector pos = llGetPos();
if (new) // Yay New Mail
{
// Run Code for New Mail
im = "You Got Mail (http://slurl.com/secondlife/" + llGetRegionName() + "/" + (string) pos.x + "/"+(string)pos.y + "/" + (string) pos.z + ")";
llSetColor(newcolor, face);
}
else
{
// Run Code for No New Mail
llSetColor(oldcolor, face);
}
}
default {
state_entry()
{
//Init
llListen(chan, "", "", "");
llSetTimerEvent(updatetime);
SetNew(FALSE);
//Set up the Prims Settings
llSetTouchText("Menu");
llSetClickAction(CLICK_ACTION_OPEN);
llAllowInventoryDrop(TRUE);
owner = llGetOwner();
llSetText( llKey2Name(owner) + "'s Mail Box:\nTo add an Item\nRight Click and Open\n then Drag and Drop\n Item into Box.\n---\nNote: This is still in the testing phase", <1,1,.5>, .75 );
}
touch(integer num)
{
key id = llDetectedKey(0);
llDialog(id, usertext, endcmd + usercmd, chan); //Show user menu
}
timer()
{
if (im != "")
{
if (sendim)
llInstantMessage(owner, im);
im = "";
}
llRequestAgentData(owner, DATA_ONLINE);
}
dataserver(key request, string data)
{
if (data == "1")
online = TRUE;
else
online = FALSE;
}
changed(integer change)
{
if (change & CHANGED_ALLOWED_DROP) //Did we get a new item?
{
SetNew(TRUE);
}
}
listen( integer channel, string name, key id, string msg )
{
msg = llToLower(msg);
if (msg == llToLower(endcmd)) //End
{
//Do Nothing
}
else if (msg == "back") //Back
{
llDialog(id, usertext, endcmd+usercmd, chan); //Show user menu
}
else if (msg == "status") //Status
{
if (online) //Check Online
{
llDialog(id, llKey2Name(owner) + " is Online", endcmd+["Back"], chan);
}
else
{
llDialog(id, llKey2Name(owner) + " is Offline", endcmd+["Back"], chan);
}
}
else if (msg == "about") //About
{
llDialog(id, "Zand Gundersen's Mail Box Script Version " + version + credits, endcmd + ["Back"], chan);
}
else if (msg == "admin") //Admin
{
if (id == owner)
{
llDialog(id, admintext, endcmd+admincmd, chan); //Show admin menu
}
else
{
llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan);
}
}
else if (msg == "reset") //Reset
{
if (id == owner)
{
llDialog(id, "Rested", endcmd + ["Back"], chan);
llResetScript();
}
else
{
llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan);
}
}
else if (msg == "test") //Test
{
if (id == owner)
{
llDialog(id, "Test Send", endcmd + ["Back"], chan);
SetNew(TRUE);
}
else
{
llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan);
}
}
else if (msg == "im") //IM
{
if (id == owner)
{
sendim = !sendim;
if (sendim)
llDialog(id, "Send Im is now On!\nYou will be notified vea IM about new mail.\nPress IM to change this", endcmd + ["Back", "IM"], chan);
else
llDialog(id, "Send Im is now Off!\nYou will not be notified vea IM about new mail.\nPress IM to change this", endcmd + ["Back", "IM"], chan);
}
else
{
llDialog(id, "Only Owner Can Do That", endcmd + ["Back"], chan);
}
}
}
}</lsl>